ILIAS  release_8 Revision v8.24
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.

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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilContainerFilterAdminGUI::executeCommand ( )

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

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 }
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc

References $ctrl, ilCtrl\getCmd(), and ilCtrl\getNextClass().

+ Here is the call graph for this function:

◆ getFieldSelectionForm()

ilContainerFilterAdminGUI::getFieldSelectionForm ( )
protected

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

109 : Standard
110 {
111 $ui = $this->ui;
112 $f = $ui->factory();
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 }
ilContainerFilterService $container_filter_service
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
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...
This describes a standard form.
Definition: Standard.php:27
$service
Definition: ltiservices.php:43

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

Referenced by saveFields(), and selectFields().

+ 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.

162 : void
163 {
166 $form = $this->getFieldSelectionForm();
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 }
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc

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

+ Here is the call graph for this function:

◆ selectFields()

ilContainerFilterAdminGUI::selectFields ( )
protected

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

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.

References $main_tpl, $ui, getFieldSelectionForm(), and ilGlobalTemplateInterface\setContent().

+ 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

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

Referenced by getFieldSelectionForm(), and saveFields().

◆ $main_tpl

ilGlobalTemplateInterface ilContainerFilterAdminGUI::$main_tpl
protected

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

Referenced by 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

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

Referenced by getFieldSelectionForm(), and selectFields().


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