ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBiblFieldFilterFormGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 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 ()
 

Protected Attributes

ilBiblFactoryFacade $facade
 
ilBiblFieldFilterInterface $filter
 
ilBiblFieldFilterGUI $parent_gui
 
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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilBiblFieldFilterFormGUI

Author
Benjamin Seglias bs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

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

Constructor & Destructor Documentation

◆ __construct()

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

ilBiblFieldFilterFormGUI constructor.

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

References $facade, $parent_gui, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), ilBiblFieldFilterGUI\FILTER_ID, ILIAS\FileDelivery\http(), initForm(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

38  {
39  $this->facade = $facade;
40  $this->filter = $field_filter;
41  $this->parent_gui = $parent_gui;
42  $q = $this->http()->wrapper()->query();
43  $this->filter_id = $q->has(ilBiblFieldFilterGUI::FILTER_ID)
44  ? $q->retrieve(ilBiblFieldFilterGUI::FILTER_ID, $this->dic()->refinery()->kindlyTo()->int())
45  : null;
46 
47  $this->lng()->loadLanguageModule('bibl');
48  $this->ctrl()->saveParameterByClass(ilBiblFieldFilterGUI::class, ilBiblFieldFilterGUI::FILTER_ID);
49 
51  $this->initForm();
52  }
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillForm()

ilBiblFieldFilterFormGUI::fillForm ( )

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

References ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), and ilPropertyFormGUI\setValuesByArray().

119  : void
120  {
121  $array = array(self::F_FIELD_ID => $this->filter->getFieldId(), self::F_FILTER_TYPE => $this->filter->getFilterType(),);
122  $this->setValuesByArray($array);
123  }
setValuesByArray(array $a_values, bool $a_restrict_to_value_keys=false)
+ Here is the call graph for this function:

◆ fillObject()

ilBiblFieldFilterFormGUI::fillObject ( )
protected

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

References ilPropertyFormGUI\checkInput(), ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), and ilPropertyFormGUI\getInput().

Referenced by saveObject().

126  : bool
127  {
128  if (!$this->checkInput()) {
129  return false;
130  }
131 
132  $this->filter->setFieldId($this->getInput(self::F_FIELD_ID));
133  $this->filter->setFilterType($this->getInput(self::F_FILTER_TYPE));
134 
135  if ($this->filter->getId()) {
136  $this->filter->update();
137  } else {
138  $this->filter->create();
139  }
140 
141  return true;
142  }
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-...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initButtons()

ilBiblFieldFilterFormGUI::initButtons ( )
protected

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

References ilPropertyFormGUI\addCommandButton(), ilBiblFieldFilterGUI\CMD_CANCEL, ilBiblFieldFilterGUI\CMD_CREATE, ilBiblFieldFilterGUI\CMD_UPDATE, ILIAS\UI\examples\Symbol\Glyph\Filter\filter(), and ILIAS\Repository\lng().

Referenced by initForm().

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

◆ initForm()

ilBiblFieldFilterFormGUI::initForm ( )

Definition at line 55 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(), ilFormGUI\setFormAction(), ilFormGUI\setTarget(), and ilPropertyFormGUI\setTitle().

Referenced by __construct().

55  : void
56  {
57  $this->setTarget('_top');
58 
59  $available_fields_for_object = $this->facade->fieldFactory()->getAvailableFieldsForObjId($this->facade->iliasObjId());
60  if (null !== $this->filter_id) {
61  $edited_filter = $this->facade->filterFactory()->findById($this->filter_id);
62  }
63 
64 
65  //show only the fields as options which don't have already a filter
66  $options = [];
67  foreach ($available_fields_for_object as $available_field) {
68  if (empty($this->facade->filterFactory()->findByFieldId($available_field->getId()))
69  || (!empty($edited_filter)
70  && $edited_filter->getFieldId() == $available_field->getId())
71  ) {
72  if (!empty($edited_filter)
73  && $edited_filter->getFieldId() == $available_field->getId()
74  ) {
75  array_unshift($options, $available_field);
76  continue;
77  }
78  $options[] = $available_field;
79  }
80  }
81 
82  $select_options = [];
83  foreach ($options as $ilBiblField) {
84  $select_options[$ilBiblField->getId()] = $this->facade->translationFactory()->translate($ilBiblField);
85  }
86 
87  asort($select_options);
88  $si = new ilSelectInputGUI($this->lng()->txt("field"), self::F_FIELD_ID);
89  $si->setInfo($this->lng()->txt("filter_field_info"));
90  $si->setOptions($select_options);
91  $si->setRequired(true);
92  $this->addItem($si);
93 
94  $options = [
97  ),
100  ),
103  ),
104  ];
105  $si = new ilSelectInputGUI($this->lng()->txt("filter_type"), self::F_FILTER_TYPE);
106  $si->setInfo($this->lng()->txt("filter_type_info"));
107  $si->setOptions($options);
108  $si->setRequired(true);
109  $this->addItem($si);
110 
111  $this->setTitle($this->lng()->txt('filter_form_title'));
112 
113  $this->initButtons();
114 
115  $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
116  }
setTarget(string $a_target)
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 145 of file class.ilBiblFieldFilterFormGUI.php.

References fillObject().

145  : bool
146  {
147  return $this->fillObject();
148  }
+ Here is the call graph for this function:

Field Documentation

◆ $facade

ilBiblFactoryFacade ilBiblFieldFilterFormGUI::$facade
protected

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

Referenced by __construct().

◆ $filter

ilBiblFieldFilterInterface ilBiblFieldFilterFormGUI::$filter
protected

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

◆ $filter_id

int ilBiblFieldFilterFormGUI::$filter_id
protected

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

◆ $parent_gui

ilBiblFieldFilterGUI ilBiblFieldFilterFormGUI::$parent_gui
protected

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

Referenced by __construct().

◆ F_FIELD_ID

const ilBiblFieldFilterFormGUI::F_FIELD_ID = "field_id"

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

◆ F_FILTER_TYPE

const ilBiblFieldFilterFormGUI::F_FILTER_TYPE = "filter_type"

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


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