ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilBiblFieldFilterFormGUI Class Reference

Class ilBiblFieldFilterFormGUI. More...

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

Public Member Functions

 __construct (protected \ilBiblFieldFilterGUI $parent_gui, protected \ilBiblFieldFilterInterface $filter, protected \ilBiblFactoryFacade $facade)
 ilBiblFieldFilterFormGUI constructor. More...
 
 initForm ()
 
 fillForm ()
 
 saveObject ()
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 
 executeCommand ()
 
 setTableWidth (string $a_width)
 
 getTableWidth ()
 
 setMode (string $a_mode)
 
 getMode ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setTitleIcon (string $a_titleicon)
 
 getTitleIcon ()
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setShowTopButtons (bool $a_val)
 
 getShowTopButtons ()
 
 setForceTopButtons (bool $a_val)
 
 getForceTopButtons ()
 
 addItem ($a_item)
 
 removeItemByPostVar (string $a_post_var, bool $a_remove_unused_headers=false)
 
 getItemByPostVar (string $a_post_var)
 
 setItems (array $a_items)
 
 getItems ()
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage (bool $a_val)
 
 getDisableStandardMessage ()
 
 getHideLabels ()
 
 setHideLabels (bool $a_value=true)
 
 setValuesByArray (array $a_values, bool $a_restrict_to_value_keys=false)
 
 setValuesByPost ()
 
 checkInput ()
 
 getInput (string $a_post_var, bool $ensureValidation=true)
 Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-POST variable, identified by the passed postvar. More...
 
 addCommandButton (string $a_cmd, string $a_text, string $a_id="")
 
 getCommandButtons ()
 
 clearCommandButtons ()
 
 getContent ()
 
 insertItem ( $item, bool $a_sub_item=false)
 
 addAsyncOnloadCode (string $code)
 
 getHTML ()
 
 getHTMLAsync ()
 
 getFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 
 moveFileUpload (string $a_target_directory, string $a_field, ?string $a_target_name=null, ?string $a_index=null, ?string $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction (string $a_formaction)
 
 getFormAction ()
 
 setTarget (string $a_target)
 
 getTarget ()
 
 setMultipart (bool $a_multipart)
 
 getMultipart ()
 
 setId (string $a_id)
 
 getId ()
 
 setName (string $a_name)
 
 getName ()
 
 setKeepOpen (bool $a_keepopen)
 
 getKeepOpen ()
 
 setOpenTag (bool $a_open)
 
 getOpenTag ()
 
 setCloseTag (bool $a_val)
 
 getCloseTag ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 getHTML ()
 
 getContent ()
 

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
 getRequestedPostVar ()
 
 getFileHash ()
 
 hideRequired (string $a_type)
 
 appendOnloadCode (string $html)
 
 rebuildUploadedFiles ()
 
 checkForRequiredField ()
 

Protected Attributes

int $filter_id
 
- Protected Attributes inherited from ilPropertyFormGUI
bool $required_text = false
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTemplate $tpl
 
ilObjUser $user = null
 
ilSetting $settings = null
 
string $mode = "std"
 
bool $check_input_called = false
 
bool $disable_standard_message = false
 
string $top_anchor = "il_form_top"
 
string $title = ''
 
string $titleicon = ""
 
string $description = ""
 
string $tbl_width = ""
 
bool $show_top_buttons = true
 
bool $hide_labels = false
 
bool $force_top_buttons = false
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
ilGlobalTemplateInterface $global_tpl = null
 
 $onload_code = []
 
- Protected Attributes inherited from ilFormGUI
string $formaction = ""
 
bool $multipart = false
 
bool $keepopen = false
 
bool $opentag = true
 
string $id = ''
 
string $name = ''
 
string $target = ''
 
bool $prevent_double_submission = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblFieldFilterFormGUI::__construct ( protected \ilBiblFieldFilterGUI  $parent_gui,
protected \ilBiblFieldFilterInterface  $filter,
protected \ilBiblFactoryFacade  $facade 
)

ilBiblFieldFilterFormGUI constructor.

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

References ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\filter(), ilBiblFieldFilterGUI\FILTER_ID, initForm(), and ILIAS\Repository\lng().

38  {
39  $this->filter_id = $this->filter->getId();
40 
41  $this->lng()->loadLanguageModule('bibl');
42  $this->ctrl()->saveParameterByClass(ilBiblFieldFilterGUI::class, ilBiblFieldFilterGUI::FILTER_ID);
43 
45  $this->initForm();
46  }
__construct(Container $dic, ilPlugin $plugin)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillForm()

ilBiblFieldFilterFormGUI::fillForm ( )

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

References ILIAS\Repository\filter(), and ilPropertyFormGUI\setValuesByArray().

113  : void
114  {
115  $array = [self::F_FIELD_ID => $this->filter->getFieldId(), self::F_FILTER_TYPE => $this->filter->getFilterType(),];
116  $this->setValuesByArray($array);
117  }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:

◆ fillObject()

ilBiblFieldFilterFormGUI::fillObject ( )
protected

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

References ilPropertyFormGUI\checkInput(), ILIAS\Repository\filter(), and ilPropertyFormGUI\getInput().

Referenced by saveObject().

120  : bool
121  {
122  if (!$this->checkInput()) {
123  return false;
124  }
125 
126  $this->filter->setFieldId($this->getInput(self::F_FIELD_ID));
127  $this->filter->setFilterType($this->getInput(self::F_FILTER_TYPE));
128 
129  if ($this->filter->getId()) {
130  $this->filter->update();
131  } else {
132  $this->filter->create();
133  }
134 
135  return true;
136  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initButtons()

ilBiblFieldFilterFormGUI::initButtons ( )
protected

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

References ilPropertyFormGUI\addCommandButton(), ilBiblFieldFilterGUI\CMD_CANCEL, ilBiblFieldFilterGUI\CMD_CREATE, ilBiblFieldFilterGUI\CMD_UPDATE, ILIAS\Repository\filter(), and ILIAS\Repository\lng().

Referenced by initForm().

145  : void
146  {
147  if ($this->filter->getId()) {
148  $this->addCommandButton(ilBiblFieldFilterGUI::CMD_UPDATE, $this->lng()->txt('save'));
149  $this->addCommandButton(ilBiblFieldFilterGUI::CMD_CANCEL, $this->lng()->txt("cancel"));
150  } else {
151  $this->addCommandButton(ilBiblFieldFilterGUI::CMD_CREATE, $this->lng()->txt('create'));
152  $this->addCommandButton(ilBiblFieldFilterGUI::CMD_CANCEL, $this->lng()->txt("cancel"));
153  }
154  }
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ 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 ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), ilBiblFieldFilterInterface\FILTER_TYPE_MULTI_SELECT_INPUT, ilBiblFieldFilterInterface\FILTER_TYPE_SELECT_INPUT, ilBiblFieldFilterInterface\FILTER_TYPE_TEXT_INPUT, initButtons(), ILIAS\Repository\lng(), null, ilFormGUI\setFormAction(), ilFormGUI\setTarget(), and ilPropertyFormGUI\setTitle().

Referenced by __construct().

49  : void
50  {
51  $this->setTarget('_top');
52 
53  $available_fields_for_object = $this->facade->fieldFactory()->getAvailableFieldsForObjId($this->facade->iliasObjId());
54  if (null !== $this->filter_id && $this->filter_id > 0) {
55  $edited_filter = $this->facade->filterFactory()->findById($this->filter_id);
56  }
57 
58  $existing_fields_of_object = $this->facade->filterFactory()->getAllForObjectId($this->facade->iliasObjId());
59  $existing_field_ids = [];
60  foreach ($existing_fields_of_object as $existing_field) {
61  $existing_field_ids[] = $existing_field->getFieldId();
62  }
63 
64  //show only the fields as options which don't have already a filter
65  $options = [];
66  foreach ($available_fields_for_object as $available_field) {
67  if (isset($edited_filter) && $edited_filter->getFieldId() === $available_field->getId()) {
68  array_unshift($options, $available_field);
69  continue;
70  }
71  if (!in_array($available_field->getId(), $existing_field_ids, false)) {
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 
88  $options = [
91  ),
94  ),
97  ),
98  ];
99  $si = new ilSelectInputGUI($this->lng()->txt("filter_type"), self::F_FILTER_TYPE);
100  $si->setInfo($this->lng()->txt("filter_type_info"));
101  $si->setOptions($options);
102  $si->setRequired(true);
103  $this->addItem($si);
104 
105  $this->setTitle($this->lng()->txt('filter_form_title'));
106 
107  $this->initButtons();
108 
109  $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
110  }
This class represents a selection list property in a property form.
setTarget(string $a_target)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setFormAction(string $a_formaction)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilBiblFieldFilterFormGUI::saveObject ( )

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

References fillObject().

139  : bool
140  {
141  return $this->fillObject();
142  }
+ Here is the call graph for this function:

Field Documentation

◆ $filter_id

int ilBiblFieldFilterFormGUI::$filter_id
protected

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

◆ F_FIELD_ID

const ilBiblFieldFilterFormGUI::F_FIELD_ID = "field_id"

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

◆ F_FILTER_TYPE

const ilBiblFieldFilterFormGUI::F_FILTER_TYPE = "filter_type"

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


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