ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBiblFieldFilterFormGUI Class Reference

Class ilBiblFieldFilterFormGUI. More...

+ Inheritance diagram for ilBiblFieldFilterFormGUI:
+ Collaboration diagram for ilBiblFieldFilterFormGUI:

Public Member Functions

 __construct (ilBiblFieldFilterGUI $parent_gui, ilBiblFieldFilterInterface $field_filter, ilBiblFactoryFacade $facade)
 ilBiblFieldFilterFormGUI constructor. More...
 
 initForm ()
 
 fillForm ()
 
 saveObject ()
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 setTableWidth ($a_width)
 Set table width. More...
 
 getTableWidth ()
 get table width More...
 
 setMode ($a_mode)
 Set Mode ('std', 'subform'). More...
 
 getMode ()
 Get Mode ('std', 'subform'). More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setTitleIcon ($a_titleicon)
 Set TitleIcon. More...
 
 getTitleIcon ()
 Get TitleIcon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setShowTopButtons ($a_val)
 Get show top buttons. More...
 
 getShowTopButtons ()
 Set show top buttons. More...
 
 addItem ($a_item)
 Add Item (Property, SectionHeader). More...
 
 removeItemByPostVar ($a_post_var, $a_remove_unused_headers=false)
 Remove Item. More...
 
 getItemByPostVar ($a_post_var)
 Get Item by POST variable. More...
 
 setItems ($a_items)
 Set Items. More...
 
 getItems ()
 Get Items. More...
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage ($a_val)
 Set disable standard message. More...
 
 getDisableStandardMessage ()
 Get disable standard message. More...
 
 getHideLabels ()
 Get a value indicating whether the labels should be hidden or not. More...
 
 setHideLabels ($a_value=true)
 Set a value indicating whether the labels should be hidden or not. More...
 
 setValuesByArray ($a_values, $a_restrict_to_value_keys=false)
 Set form values from an array. More...
 
 setValuesByPost ()
 Set form values from POST values. More...
 
 checkInput ()
 Check Post Input. More...
 
 getInput ($a_post_var, $ensureValidation=true)
 Returns the value of a HTTP-POST variable, identified by the passed id. More...
 
 addCustomProperty ( $a_title, $a_html, $a_info="", $a_alert="", $a_required=false)
 Add a custom property. More...
 
 addCommandButton ($a_cmd, $a_text, $a_id="")
 Add Command button. More...
 
 getCommandButtons ()
 Return all Command buttons. More...
 
 clearCommandButtons ()
 Remove all command buttons. More...
 
 getContent ()
 Get Content. More...
 
 insertItem ($item, $a_sub_item=false)
 
 getHTML ()
 
 getFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Was any file uploaded? More...
 
 moveFileUpload ($a_target_directory, $a_field, $a_target_name=null, $a_index=null, $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction ($a_formaction)
 Set FormAction. More...
 
 getFormAction ()
 Get FormAction. More...
 
 setTarget ($a_target)
 Set Target. More...
 
 getTarget ()
 Get Target. More...
 
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false. More...
 
 getMultipart ()
 Get Enctype Multipart/Formdata true/false. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setName ($a_name)
 Set Name. More...
 
 getName ()
 Get Name. More...
 
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open. More...
 
 getKeepOpen ()
 Get Keep Form Tag Open. More...
 
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag. More...
 
 getOpenTag ()
 Get Open Form Tag Enabled. More...
 
 setCloseTag ($a_val)
 Set close tag. More...
 
 getCloseTag ()
 Get close tag. More...
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 getHTML ()
 Get HTML. More...
 
 getContent ()
 Get Content. More...
 

Data Fields

const F_FIELD_ID = "field_id"
 
const F_FILTER_TYPE = "filter_type"
 

Protected Member Functions

 fillObject ()
 
 initButtons ()
 
- Protected Member Functions inherited from ilPropertyFormGUI
 hideRequired ($a_type)
 
 rebuildUploadedFiles ()
 try to rebuild files More...
 

Protected Attributes

 $facade
 
 $filter
 
 $parent_gui
 
- Protected Attributes inherited from ilPropertyFormGUI
 $lng
 
 $ctrl
 
 $tpl
 
 $user
 
 $settings
 
 $mode = "std"
 
 $check_input_called = false
 
 $disable_standard_message = false
 
 $top_anchor = "il_form_top"
 
 $titleicon = false
 
 $description = ""
 
 $tbl_width = false
 
 $show_top_buttons = true
 
 $hide_labels = false
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $prevent_double_submission = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblFieldFilterFormGUI::__construct ( ilBiblFieldFilterGUI  $parent_gui,
ilBiblFieldFilterInterface  $field_filter,
ilBiblFactoryFacade  $facade 
)

ilBiblFieldFilterFormGUI constructor.

Parameters
\ilBiblFieldFilterGUI$parent_gui
\ilBiblFieldFilterInterface$field_filter
\ilBiblFactoryFacade$facade

Definition at line 35 of file class.ilBiblFieldFilterFormGUI.php.

References $facade, $parent_gui, ilBiblFieldFilterGUI\FILTER_ID, and initForm().

36  {
37  $this->facade = $facade;
38  $this->filter = $field_filter;
39  $this->parent_gui = $parent_gui;
40 
41  $this->lng()->loadLanguageModule('bibl');
42  $this->ctrl()->saveParameterByClass(ilBiblFieldFilterGUI::class, ilBiblFieldFilterGUI::FILTER_ID);
43 
44  parent::__construct();
45  $this->initForm();
46  }
+ Here is the call graph for this function:

Member Function Documentation

◆ fillForm()

ilBiblFieldFilterFormGUI::fillForm ( )

Definition at line 109 of file class.ilBiblFieldFilterFormGUI.php.

References ilPropertyFormGUI\setValuesByArray().

110  {
111  $array = array(self::F_FIELD_ID => $this->filter->getFieldId(), self::F_FILTER_TYPE => $this->filter->getFilterType(),);
112  $this->setValuesByArray($array);
113  }
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
+ Here is the call graph for this function:

◆ fillObject()

ilBiblFieldFilterFormGUI::fillObject ( )
protected

Definition at line 116 of file class.ilBiblFieldFilterFormGUI.php.

References ilPropertyFormGUI\checkInput(), and ilPropertyFormGUI\getInput().

Referenced by saveObject().

117  {
118  if (!$this->checkInput()) {
119  return false;
120  }
121 
122  $this->filter->setFieldId($this->getInput(self::F_FIELD_ID));
123  $this->filter->setFilterType($this->getInput(self::F_FILTER_TYPE));
124 
125  if ($this->filter->getId()) {
126  $this->filter->update();
127  } else {
128  $this->filter->create();
129  }
130 
131  return true;
132  }
checkInput()
Check Post Input.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initButtons()

ilBiblFieldFilterFormGUI::initButtons ( )
protected

Definition at line 148 of file class.ilBiblFieldFilterFormGUI.php.

References ilPropertyFormGUI\addCommandButton(), ilBiblFieldFilterGUI\CMD_CANCEL, ilBiblFieldFilterGUI\CMD_CREATE, and ilBiblFieldFilterGUI\CMD_UPDATE.

Referenced by initForm().

149  {
150  if ($this->filter->getId()) {
151  $this->addCommandButton(ilBiblFieldFilterGUI::CMD_UPDATE, $this->lng()->txt('save'));
152  $this->addCommandButton(ilBiblFieldFilterGUI::CMD_CANCEL, $this->lng()->txt("cancel"));
153  } else {
154  $this->addCommandButton(ilBiblFieldFilterGUI::CMD_CREATE, $this->lng()->txt('create'));
155  $this->addCommandButton(ilBiblFieldFilterGUI::CMD_CANCEL, $this->lng()->txt("cancel"));
156  }
157  }
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilBiblFieldFilterFormGUI::initForm ( )

Definition at line 49 of file class.ilBiblFieldFilterFormGUI.php.

References PHPMailer\PHPMailer\$options, $si, ilPropertyFormGUI\addItem(), ilBiblFieldFilterGUI\FILTER_ID, ilBiblFieldFilterInterface\FILTER_TYPE_MULTI_SELECT_INPUT, ilBiblFieldFilterInterface\FILTER_TYPE_SELECT_INPUT, ilBiblFieldFilterInterface\FILTER_TYPE_TEXT_INPUT, ILIAS\FileDelivery\http(), initButtons(), ilFormGUI\setFormAction(), ilFormGUI\setTarget(), and ilPropertyFormGUI\setTitle().

Referenced by __construct().

50  {
51  $this->setTarget('_top');
52 
53  $available_fields_for_object = $this->facade->fieldFactory()->getAvailableFieldsForObjId($this->facade->iliasObjId());
54 
55  $edited_filter = $this->facade->filterFactory()->findById(
56  $this->http()->request()->getQueryParams()[ilBiblFieldFilterGUI::FILTER_ID]
57  );
58 
59  //show only the fields as options which don't have already a filter
60  $options = [];
61  foreach ($available_fields_for_object as $available_field) {
62  if (empty($this->facade->filterFactory()->findByFieldId($available_field->getId()))
63  || (!empty($edited_filter)
64  && $edited_filter->getFieldId() == $available_field->getId())
65  ) {
66  if (!empty($edited_filter)
67  && $edited_filter->getFieldId() == $available_field->getId()
68  ) {
69  array_unshift($options, $available_field);
70  continue;
71  }
72  $options[] = $available_field;
73  }
74  }
75 
76  $select_options = [];
77  foreach ($options as $ilBiblField) {
78  $select_options[$ilBiblField->getId()] = $this->facade->translationFactory()->translate($ilBiblField);
79  }
80 
81  asort($select_options);
82  $si = new ilSelectInputGUI($this->lng()->txt("field"), self::F_FIELD_ID);
83  $si->setInfo($this->lng()->txt("filter_field_info"));
84  $si->setOptions($select_options);
85  $si->setRequired(true);
86  $this->addItem($si);
87 
94  ),];
95  $si = new ilSelectInputGUI($this->lng()->txt("filter_type"), self::F_FILTER_TYPE);
96  $si->setInfo($this->lng()->txt("filter_type_info"));
97  $si->setOptions($options);
98  $si->setRequired(true);
99  $this->addItem($si);
100 
101  $this->setTitle($this->lng()->txt('filter_form_title'));
102 
103  $this->initButtons();
104 
105  $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
106  }
This class represents a selection list property in a property form.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
setTarget($a_target)
Set Target.
static http()
Fetches the global http state from ILIAS.
setTitle($a_title)
Set Title.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilBiblFieldFilterFormGUI::saveObject ( )
Returns
bool|string

Definition at line 138 of file class.ilBiblFieldFilterFormGUI.php.

References fillObject().

139  {
140  if (!$this->fillObject()) {
141  return false;
142  }
143 
144  return true;
145  }
+ Here is the call graph for this function:

Field Documentation

◆ $facade

ilBiblFieldFilterFormGUI::$facade
protected

Definition at line 17 of file class.ilBiblFieldFilterFormGUI.php.

Referenced by __construct().

◆ $filter

ilBiblFieldFilterFormGUI::$filter
protected

Definition at line 21 of file class.ilBiblFieldFilterFormGUI.php.

◆ $parent_gui

ilBiblFieldFilterFormGUI::$parent_gui
protected

Definition at line 25 of file class.ilBiblFieldFilterFormGUI.php.

Referenced by __construct().

◆ F_FIELD_ID

const ilBiblFieldFilterFormGUI::F_FIELD_ID = "field_id"

Definition at line 12 of file class.ilBiblFieldFilterFormGUI.php.

◆ F_FILTER_TYPE

const ilBiblFieldFilterFormGUI::F_FILTER_TYPE = "filter_type"

Definition at line 13 of file class.ilBiblFieldFilterFormGUI.php.


The documentation for this class was generated from the following file: