ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerFilterAdminGUI Class Reference

Filter administration for containers. More...

+ Collaboration diagram for ilContainerFilterAdminGUI:

Public Member Functions

 __construct (ilContainerGUI $container_gui)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 

Protected Member Functions

 show ()
 Show table. More...
 
 selectFields ()
 Select fields. More...
 
 getFieldSelectionForm ()
 Get field selection form. More...
 
 saveFields ()
 Save field selection. More...
 

Protected Attributes

 $ctrl
 
 $lng
 
 $main_tpl
 
 $toolbar
 
 $ui
 
 $container_filter_service
 
 $ref_id
 

Detailed Description

Filter administration for containers.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilContainerFilterAdminGUI::__construct ( ilContainerGUI  $container_gui)

Constructor.

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

References $DIC, and ui().

52  {
53  global $DIC;
54 
55  $this->ctrl = $DIC->ctrl();
56  $this->lng = $DIC->language();
57  $this->main_tpl = $DIC->ui()->mainTemplate();
58  $this->container_gui = $container_gui;
59  $this->ref_id = $this->container_gui->object->getRefId();
60  $this->toolbar = $DIC["ilToolbar"];
61  $this->ui = $DIC->ui();
62  $this->request = $DIC->http()->request();
63  // not sure if this should go to dic someday, currently this is not an internal API
64  $this->container_filter_service = new ilContainerFilterService();
65  }
ui()
Definition: ui.php:5
$DIC
Definition: xapitoken.php:46
Container filter service factory.
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilContainerFilterAdminGUI::executeCommand ( )

Execute command.

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

References $ctrl.

71  {
73 
74  $next_class = $ctrl->getNextClass($this);
75  $cmd = $ctrl->getCmd("show");
76 
77  switch ($next_class) {
78  default:
79  if (in_array($cmd, array("show", "selectFields", "saveFields"))) {
80  $this->$cmd();
81  }
82  }
83  }

◆ getFieldSelectionForm()

ilContainerFilterAdminGUI::getFieldSelectionForm ( )
protected

Get field selection form.

Returns

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

References $container_filter_service, $ctrl, Vendor\Package\$f, $lng, $service, and $ui.

Referenced by saveFields(), and selectFields().

131  {
132  $ui = $this->ui;
133  $f = $ui->factory();
134  $ctrl = $this->ctrl;
135  $lng = $this->lng;
136 
137  $adv = $this->container_filter_service->advancedMetadata();
139 
140 
141  $fields[] = array();
142 
143 
144  // current filter set
145  $current_filters = $service->data()->getFilterSetForRefId($this->ref_id);
146 
147  // standar set
148  $selected = [];
149  foreach ($service->standardSet()->getFields() as $field) {
150  $options[$field->getFieldId()] = $service->util()->getContainerFieldTitle($field->getRecordSetId(), $field->getFieldId());
151  if ($current_filters->has(0, $field->getFieldId())) {
152  $selected[] = $field->getFieldId();
153  }
154  }
155 
156  $fields[0] = $f->input()->field()->multiselect($lng->txt("cont_std_record_title"), $options)
157  ->withRequired(false)
158  ->withValue($selected);
159 
160  // ADV MD record sets
161  foreach ($adv->getAvailableRecordSets() as $rs) {
162  $options = [];
163  $selected = [];
164  foreach ($adv->getFields($rs->getRecordId()) as $fl) {
165  $options[$fl->getFieldId()] = $fl->getTitle();
166  if ($current_filters->has($rs->getRecordId(), $fl->getFieldId())) {
167  $selected[] = $fl->getFieldId();
168  }
169  }
170  $fields[$rs->getRecordId()] = $f->input()->field()->multiselect($rs->getTitle(), $options, $rs->getDescription())
171  ->withRequired(false)
172  ->withValue($selected);
173  }
174 
175  // Standard filter fields
176  $section1 = $f->input()->field()->section($fields, $lng->txt("cont_filter_fields"), "");
177 
178  $form_action = $ctrl->getLinkTarget($this, "saveFields", "", false, false);
179  return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
180  }
$service
Definition: result.php:17
+ Here is the caller graph for this function:

◆ saveFields()

ilContainerFilterAdminGUI::saveFields ( )
protected

Save field selection.

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

References $container_filter_service, $ctrl, $data, $lng, $service, getFieldSelectionForm(), and ilUtil\sendInfo().

186  {
187  $request = $this->request;
189  $form = $this->getFieldSelectionForm();
190  $lng = $this->lng;
191  $ctrl = $this->ctrl;
192 
193  $fields = [];
194  if ($request->getMethod() == "POST") {
195  $form = $form->withRequest($request);
196  $data = $form->getData();
197 
198  // ADV MD record sets
199  if (is_array($data["sec"])) {
200  foreach ($data["sec"] as $rec_id => $ids) {
201  if (is_array($ids)) {
202  foreach ($ids as $field_id) {
203  $fields[] = $service->field($rec_id, $field_id);
204  }
205  }
206  }
207  }
208  ilUtil::sendInfo($lng->txt("msg_obj_modified"), true);
209  $service->data()->saveFilterSetForRefId($this->ref_id, $service->set($fields));
210  }
211  $ctrl->redirect($this, "");
212  }
$data
Definition: storeScorm.php:23
getFieldSelectionForm()
Get field selection form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$service
Definition: result.php:17
+ Here is the call graph for this function:

◆ selectFields()

ilContainerFilterAdminGUI::selectFields ( )
protected

Select fields.

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

References $main_tpl, $ui, and getFieldSelectionForm().

117  {
119  $ui = $this->ui;
120  $r = $ui->renderer();
121  $form = $this->getFieldSelectionForm();
122  $main_tpl->setContent($r->render($form));
123  }
getFieldSelectionForm()
Get field selection form.
+ Here is the call graph for this function:

◆ show()

ilContainerFilterAdminGUI::show ( )
protected

Show table.

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

References $ctrl, Vendor\Package\$f, $lng, $main_tpl, and $ui.

89  {
91  $ui = $this->ui;
93  $lng = $this->lng;
94 
95  $f = $ui->factory();
96 
97  $button = $f->button()->standard(
98  $lng->txt("cont_select_fields"),
99  $ctrl->getLinkTarget($this, "selectFields")
100  );
101 
102  $this->toolbar->addComponent($button);
103 
104  $table = new ilContainerFilterTableGUI(
105  $this,
106  "show",
107  $this->container_filter_service,
108  $this->container_gui->object
109  );
110  $main_tpl->setContent($table->getHTML());
111  }

Field Documentation

◆ $container_filter_service

ilContainerFilterAdminGUI::$container_filter_service
protected

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

Referenced by getFieldSelectionForm(), and saveFields().

◆ $ctrl

ilContainerFilterAdminGUI::$ctrl
protected

◆ $lng

ilContainerFilterAdminGUI::$lng
protected

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

Referenced by getFieldSelectionForm(), saveFields(), and show().

◆ $main_tpl

ilContainerFilterAdminGUI::$main_tpl
protected

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

Referenced by selectFields(), and show().

◆ $ref_id

ilContainerFilterAdminGUI::$ref_id
protected

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

◆ $toolbar

ilContainerFilterAdminGUI::$toolbar
protected

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

◆ $ui

ilContainerFilterAdminGUI::$ui
protected

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

Referenced by getFieldSelectionForm(), selectFields(), and show().


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