ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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: shib_login.php:26

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 117 of file class.ilContainerFilterAdminGUI.php.

117 : Standard
118 {
119 $ui = $this->ui;
120 $f = $ui->factory();
123
124 $adv = $this->container_filter_service->advancedMetadata();
126
127
128 $fields[] = [];
129
130
131 // current filter set
132 $current_filters = $service->data()->getFilterSetForRefId($this->ref_id);
133
134 // standar set
135 $selected = [];
136 $options = [];
137 foreach ($service->standardSet()->getFields() as $field) {
138 $options[$field->getFieldId()] = $service->util()->getContainerFieldTitle($field->getRecordSetId(), $field->getFieldId());
139 if ($current_filters->has(0, $field->getFieldId())) {
140 $selected[] = $field->getFieldId();
141 }
142 }
143
144 $fields[0] = $f->input()->field()->multiSelect($lng->txt("cont_std_record_title"), $options)
145 ->withRequired(false)
146 ->withValue($selected);
147
148 // ADV MD record sets
149 foreach ($adv->getAvailableRecordSets() as $rs) {
150 $options = [];
151 $selected = [];
152 foreach ($adv->getFields($rs->getRecordId()) as $fl) {
153 $options[$fl->getFieldId()] = $fl->getTitle();
154 if ($current_filters->has($rs->getRecordId(), $fl->getFieldId())) {
155 $selected[] = $fl->getFieldId();
156 }
157 }
158 $fields[$rs->getRecordId()] = $f->input()->field()->multiSelect($rs->getTitle(), $options, $rs->getDescription())
159 ->withRequired(false)
160 ->withValue($selected);
161 }
162
163 // Standard filter fields
164 $section1 = $f->input()->field()->section($fields, $lng->txt("cont_filter_fields"), "");
165
166 $form_action = $ctrl->getLinkTarget($this, "saveFields", "", false, false);
167 return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
168 }
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:29
$service
Definition: ltiresult.php:36

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 170 of file class.ilContainerFilterAdminGUI.php.

170 : void
171 {
174 $form = $this->getFieldSelectionForm();
177
178 $fields = [];
179 if ($request->getMethod() === "POST") {
180 $form = $form->withRequest($request);
181 $data = $form->getData();
182
183 // ADV MD record sets
184 if (is_array($data["sec"])) {
185 foreach ($data["sec"] as $rec_id => $ids) {
186 if (is_array($ids)) {
187 foreach ($ids as $field_id) {
188 $fields[] = $service->field($rec_id, $field_id);
189 }
190 }
191 }
192 }
193 $this->main_tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
194 $service->data()->saveFilterSetForRefId($this->ref_id, $service->set($fields));
195 }
196 $ctrl->redirect($this, "");
197 }
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 108 of file class.ilContainerFilterAdminGUI.php.

108 : void
109 {
111 $ui = $this->ui;
112 $r = $ui->renderer();
113 $form = $this->getFieldSelectionForm();
114 $main_tpl->setContent($r->render($form));
115 }
setContent(string $a_html)
Sets content for standard template.

References $main_tpl, $ui, getFieldSelectionForm(), and ILIAS\UICore\GlobalTemplate\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: