ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilContainerFilterAdminGUI Class Reference

Filter administration for containers. More...

+ Collaboration diagram for ilContainerFilterAdminGUI:

Public Member Functions

 __construct (ilContainerGUI $container_gui)
 
 executeCommand ()
 

Protected Member Functions

 selectFields ()
 
 getFieldSelectionForm ()
 
 saveFields ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $main_tpl
 
ilToolbarGUI $toolbar
 
ILIAS DI UIServices $ui
 
ilContainerFilterService $container_filter_service
 
int $ref_id
 
ilContainerGUI $container_gui
 
ServerRequestInterface $request
 

Detailed Description

Filter administration for containers.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilContainerFilterAdminGUI::__construct ( ilContainerGUI  $container_gui)

Definition at line 39 of file class.ilContainerFilterAdminGUI.php.

References $container_gui, $DIC, ILIAS\Repository\ctrl(), ilObjectGUI\getObject(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

40  {
41  global $DIC;
42 
43  $this->ctrl = $DIC->ctrl();
44  $this->lng = $DIC->language();
45  $this->main_tpl = $DIC->ui()->mainTemplate();
46  $this->container_gui = $container_gui;
47  $this->ref_id = $this->container_gui->getObject()->getRefId();
48  $this->toolbar = $DIC["ilToolbar"];
49  $this->ui = $DIC->ui();
50  $this->request = $DIC->http()->request();
51  // not sure if this should go to dic someday, currently this is not an internal API
52  $this->container_filter_service = new ilContainerFilterService();
53  }
global $DIC
Definition: shib_login.php:22
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilContainerFilterAdminGUI::executeCommand ( )

Definition at line 55 of file class.ilContainerFilterAdminGUI.php.

References $container, $ctrl, Vendor\Package\$f, $lng, $main_tpl, $ui, ilCtrl\getCmd(), ilCtrl\getLinkTarget(), ilCtrl\getNextClass(), ILIAS\UICore\GlobalTemplate\setContent(), ILIAS\Repository\toolbar(), and ilLanguage\txt().

55  : void
56  {
58 
59  $next_class = $ctrl->getNextClass($this);
60  $cmd = $ctrl->getCmd("show");
61 
62  switch ($next_class) {
63  default:
64  if (in_array($cmd, ["show", "selectFields", "saveFields"])) {
65  $this->$cmd();
66  }
67  }
68  }
getCmd(?string $fallback_command=null)
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ getFieldSelectionForm()

ilContainerFilterAdminGUI::getFieldSelectionForm ( )
protected

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

References $container_filter_service, $ctrl, Vendor\Package\$f, $lng, $service, $ui, ilCtrl\getLinkTarget(), and ilLanguage\txt().

Referenced by saveFields(), and selectFields().

109  : Standard
110  {
111  $ui = $this->ui;
112  $f = $ui->factory();
113  $ctrl = $this->ctrl;
114  $lng = $this->lng;
115 
116  $adv = $this->container_filter_service->advancedMetadata();
118 
119 
120  $fields[] = [];
121 
122 
123  // current filter set
124  $current_filters = $service->data()->getFilterSetForRefId($this->ref_id);
125 
126  // standar set
127  $selected = [];
128  $options = [];
129  foreach ($service->standardSet()->getFields() as $field) {
130  $options[$field->getFieldId()] = $service->util()->getContainerFieldTitle($field->getRecordSetId(), $field->getFieldId());
131  if ($current_filters->has(0, $field->getFieldId())) {
132  $selected[] = $field->getFieldId();
133  }
134  }
135 
136  $fields[0] = $f->input()->field()->multiSelect($lng->txt("cont_std_record_title"), $options)
137  ->withRequired(false)
138  ->withValue($selected);
139 
140  // ADV MD record sets
141  foreach ($adv->getAvailableRecordSets() as $rs) {
142  $options = [];
143  $selected = [];
144  foreach ($adv->getFields($rs->getRecordId()) as $fl) {
145  $options[$fl->getFieldId()] = $fl->getTitle();
146  if ($current_filters->has($rs->getRecordId(), $fl->getFieldId())) {
147  $selected[] = $fl->getFieldId();
148  }
149  }
150  $fields[$rs->getRecordId()] = $f->input()->field()->multiSelect($rs->getTitle(), $options, $rs->getDescription())
151  ->withRequired(false)
152  ->withValue($selected);
153  }
154 
155  // Standard filter fields
156  $section1 = $f->input()->field()->section($fields, $lng->txt("cont_filter_fields"), "");
157 
158  $form_action = $ctrl->getLinkTarget($this, "saveFields", "", false, false);
159  return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
160  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
This describes a standard form.
Definition: Standard.php:28
ilContainerFilterService $container_filter_service
$service
Definition: ltiservices.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveFields()

ilContainerFilterAdminGUI::saveFields ( )
protected

Definition at line 162 of file class.ilContainerFilterAdminGUI.php.

References $container_filter_service, $ctrl, $data, $lng, $request, $service, getFieldSelectionForm(), ilCtrl\redirect(), and ilLanguage\txt().

162  : void
163  {
166  $form = $this->getFieldSelectionForm();
167  $lng = $this->lng;
168  $ctrl = $this->ctrl;
169 
170  $fields = [];
171  if ($request->getMethod() === "POST") {
172  $form = $form->withRequest($request);
173  $data = $form->getData();
174 
175  // ADV MD record sets
176  if (is_array($data["sec"])) {
177  foreach ($data["sec"] as $rec_id => $ids) {
178  if (is_array($ids)) {
179  foreach ($ids as $field_id) {
180  $fields[] = $service->field($rec_id, $field_id);
181  }
182  }
183  }
184  }
185  $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
186  $service->data()->saveFilterSetForRefId($this->ref_id, $service->set($fields));
187  }
188  $ctrl->redirect($this, "");
189  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
ilContainerFilterService $container_filter_service
$service
Definition: ltiservices.php:40
+ Here is the call graph for this function:

◆ selectFields()

ilContainerFilterAdminGUI::selectFields ( )
protected

Definition at line 100 of file class.ilContainerFilterAdminGUI.php.

References $main_tpl, $r, $ui, getFieldSelectionForm(), and ILIAS\UICore\GlobalTemplate\setContent().

100  : void
101  {
103  $ui = $this->ui;
104  $r = $ui->renderer();
105  $form = $this->getFieldSelectionForm();
106  $main_tpl->setContent($r->render($form));
107  }
setContent(string $a_html)
Sets content for standard template.
$r
+ Here is the call graph for this function:

Field Documentation

◆ $container_filter_service

ilContainerFilterService ilContainerFilterAdminGUI::$container_filter_service
protected

Definition at line 34 of file class.ilContainerFilterAdminGUI.php.

Referenced by getFieldSelectionForm(), and saveFields().

◆ $container_gui

ilContainerGUI ilContainerFilterAdminGUI::$container_gui
protected

Definition at line 36 of file class.ilContainerFilterAdminGUI.php.

Referenced by __construct().

◆ $ctrl

ilCtrl ilContainerFilterAdminGUI::$ctrl
protected

◆ $lng

ilLanguage ilContainerFilterAdminGUI::$lng
protected

◆ $main_tpl

ilGlobalTemplateInterface ilContainerFilterAdminGUI::$main_tpl
protected

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

Referenced by executeCommand(), and selectFields().

◆ $ref_id

int ilContainerFilterAdminGUI::$ref_id
protected

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

◆ $request

ServerRequestInterface ilContainerFilterAdminGUI::$request
protected

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

Referenced by saveFields().

◆ $toolbar

ilToolbarGUI ilContainerFilterAdminGUI::$toolbar
protected

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

◆ $ui

ILIAS DI UIServices ilContainerFilterAdminGUI::$ui
protected

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