ILIAS  release_8 Revision v8.24
ilSettingsTemplateGUI Class Reference

Settings template. More...

+ Collaboration diagram for ilSettingsTemplateGUI:

Public Member Functions

 executeCommand ()
 
 setConfig (ilSettingsTemplateConfig $a_val)
 
 getConfig ()
 
 readSettingsTemplate ()
 
 listSettingsTemplates ()
 
 addSettingsTemplate ()
 
 editSettingsTemplate ()
 
 initSettingsTemplateForm (string $a_mode="edit")
 
 getSettingsTemplateValues ()
 
 saveSettingsTemplate ()
 
 updateSettingsTemplate ()
 
 setValuesFromForm (ilSettingsTemplate $a_set_templ)
 
 confirmSettingsTemplateDeletion ()
 
 deleteSettingsTemplate ()
 

Protected Attributes

ilCtrlInterface $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ILIAS DI Container $dic
 
ilRbacSystem $rbacsystem
 
ilPropertyFormGUI $form
 
ilSettingsTemplate $settings_template
 
SettingsTemplateGUIRequest $request
 

Private Attributes

ilSettingsTemplateConfig $config
 

Detailed Description

Settings template.

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

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

Member Function Documentation

◆ addSettingsTemplate()

ilSettingsTemplateGUI::addSettingsTemplate ( )

Definition at line 120 of file class.ilSettingsTemplateGUI.php.

120 : void
121 {
123
124 $this->initSettingsTemplateForm("create");
125 $tpl->setContent($this->form->getHTML());
126 }
ilGlobalTemplateInterface $tpl
initSettingsTemplateForm(string $a_mode="edit")
setContent(string $a_html)
Sets content for standard template.
form( $class_path, string $cmd)

References $tpl, ILIAS\Repository\form(), initSettingsTemplateForm(), and ilGlobalTemplateInterface\setContent().

+ Here is the call graph for this function:

◆ confirmSettingsTemplateDeletion()

ilSettingsTemplateGUI::confirmSettingsTemplateDeletion ( )

Definition at line 347 of file class.ilSettingsTemplateGUI.php.

347 : void
348 {
349 $ilCtrl = $this->ctrl;
352
353 if (count($this->request->getTemplateIds()) === 0) {
354 $this->tpl->setOnScreenMessage('info', $lng->txt("no_checkbox"), true);
355 $ilCtrl->redirect($this, "listSettingsTemplates");
356 } else {
357 $cgui = new ilConfirmationGUI();
358 $cgui->setFormAction($ilCtrl->getFormAction($this));
359 $cgui->setHeaderText($lng->txt("adm_sure_delete_settings_template"));
360 $cgui->setCancel($lng->txt("cancel"), "listSettingsTemplates");
361 $cgui->setConfirm($lng->txt("delete"), "deleteSettingsTemplate");
362
363 foreach ($this->request->getTemplateIds() as $i) {
364 $cgui->addItem("tid[]", (string) $i, ilSettingsTemplate::lookupTitle($i));
365 }
366
367 $tpl->setContent($cgui->getHTML());
368 }
369 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
$i
Definition: metadata.php:41

References $ctrl, $i, $lng, $tpl, ilSettingsTemplate\lookupTitle(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ deleteSettingsTemplate()

ilSettingsTemplateGUI::deleteSettingsTemplate ( )

Definition at line 371 of file class.ilSettingsTemplateGUI.php.

371 : void
372 {
373 $ilCtrl = $this->ctrl;
374
375 foreach ($this->request->getTemplateIds() as $i) {
376 $templ = new ilSettingsTemplate($i);
377 $templ->delete();
378 }
379 $this->tpl->setOnScreenMessage('success', "msg_obj_modified");
380 $ilCtrl->redirect($this, "listSettingsTemplates");
381 }
Settings template application class.

References $ctrl, and $i.

◆ editSettingsTemplate()

ilSettingsTemplateGUI::editSettingsTemplate ( )

Definition at line 128 of file class.ilSettingsTemplateGUI.php.

128 : void
129 {
131
132 $this->initSettingsTemplateForm("edit");
134 $tpl->setContent($this->form->getHTML());
135 }

References $tpl, ILIAS\Repository\form(), getSettingsTemplateValues(), initSettingsTemplateForm(), and ilGlobalTemplateInterface\setContent().

+ Here is the call graph for this function:

◆ executeCommand()

ilSettingsTemplateGUI::executeCommand ( )

Definition at line 65 of file class.ilSettingsTemplateGUI.php.

65 : void
66 {
67 $ilCtrl = $this->ctrl;
68
69 $cmd = $ilCtrl->getCmd("listSettingsTemplates");
70 $this->$cmd();
71 }
getCmd(string $fallback_command=null)
Returns the command passed with the current POST or GET request.

References $ctrl, and ilCtrlInterface\getCmd().

+ Here is the call graph for this function:

◆ getConfig()

ilSettingsTemplateGUI::getConfig ( )

Definition at line 78 of file class.ilSettingsTemplateGUI.php.

79 {
80 return $this->config;
81 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilSettingsTemplateConfig $config

References $config.

Referenced by getSettingsTemplateValues(), initSettingsTemplateForm(), listSettingsTemplates(), readSettingsTemplate(), saveSettingsTemplate(), and setValuesFromForm().

+ Here is the caller graph for this function:

◆ getSettingsTemplateValues()

ilSettingsTemplateGUI::getSettingsTemplateValues ( )

Definition at line 243 of file class.ilSettingsTemplateGUI.php.

243 : void
244 {
245 $values = array();
246
247 $values["title"] = $this->settings_template->getTitle();
248 $values["description"] = $this->settings_template->getDescription();
249
250 // save tabs to be hidden
251 $tabs = $this->settings_template->getHiddenTabs();
252 foreach ($tabs as $t) {
253 $values["tab_" . $t] = true;
254 }
255
256 // save settings values
257 $set = $this->settings_template->getSettings();
258 foreach ($this->getConfig()->getSettings() as $s) {
259 if (isset($set[$s["id"]])) {
260 $values["set_" . $s["id"]] = true;
261
262 if ($s['type'] === ilSettingsTemplateConfig::CHECKBOX) {
263 if (!is_array($set[$s["id"]]["value"])) {
264 $ar = unserialize($set[$s["id"]]["value"], ['allowed_classes' => false]);
265 } else {
266 $ar = $set[$s["id"]]["value"];
267 }
268 $values["value_" . $s["id"]] = is_array($ar) ? $ar : array();
269 } else {
270 $values["value_" . $s["id"]] = $set[$s["id"]]["value"];
271 }
272
273 $values["hide_" . $s["id"]] = $set[$s["id"]]["hide"];
274 }
275 }
276 $this->form->setValuesByArray($values);
277 }
getSettings()
Get an array of all setting values.
Definition: System.php:287

References ilSettingsTemplateConfig\CHECKBOX, ILIAS\Repository\form(), getConfig(), and ILIAS\LTI\ToolProvider\getSettings().

Referenced by editSettingsTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSettingsTemplateForm()

ilSettingsTemplateGUI::initSettingsTemplateForm ( string  $a_mode = "edit")

Definition at line 137 of file class.ilSettingsTemplateGUI.php.

137 : void
138 {
140 $ilCtrl = $this->ctrl;
141
142 $this->form = new ilPropertyFormGUI();
143
144 // title
145 $ti = new ilTextInputGUI($lng->txt("title"), "title");
146 $ti->setMaxLength(200);
147 $ti->setRequired(true);
148 // begin-patch lok
149 if ($this->settings_template->getAutoGenerated()) {
150 $ti->setDisabled(true);
151 }
152 // end-patch lok
153 $this->form->addItem($ti);
154
155 // description
156 $ti = new ilTextAreaInputGUI($lng->txt("description"), "description");
157 // begin-patch lok
158 if ($this->settings_template->getAutoGenerated()) {
159 $ti->setDisabled(true);
160 }
161 $this->form->addItem($ti);
162
163 // hidable tabs
164 $tabs = $this->getConfig()->getHidableTabs();
165 if (is_array($tabs) && count($tabs) > 0) {
166 $sec = new ilFormSectionHeaderGUI();
167 $sec->setTitle($lng->txt("adm_hide_tabs"));
168 $this->form->addItem($sec);
169
170 foreach ($tabs as $t) {
171 // hide tab $t?
172 $cb = new ilCheckboxInputGUI($t["text"], "tab_" . $t["id"]);
173 $this->form->addItem($cb);
174 }
175 }
176
177 // settings
178 $settings = $this->getConfig()->getSettings();
179 if (is_array($settings) && count($settings) > 0) {
180 $sec = new ilFormSectionHeaderGUI();
181 $sec->setTitle($lng->txt("adm_predefined_settings"));
182 $this->form->addItem($sec);
183
184 foreach ($settings as $s) {
185 // setting
186 $cb = new ilCheckboxInputGUI($s["text"], "set_" . $s["id"]);
187 $this->form->addItem($cb);
188
189 switch ($s["type"]) {
191
192 $ti = new ilTextInputGUI($lng->txt("adm_value"), "value_" . $s["id"]);
193 //$ti->setMaxLength();
194 //$ti->setSize();
195 $cb->addSubItem($ti);
196 break;
197
199 $cb2 = new ilCheckboxInputGUI($lng->txt("adm_value"), "value_" . $s["id"]);
200 $cb->addSubItem($cb2);
201 break;
202
204 $si = new ilSelectInputGUI($lng->txt("adm_value"), "value_" . $s["id"]);
205 $si->setOptions($s["options"]);
206 $cb->addSubItem($si);
207 break;
208
210 $chbs = new ilCheckboxGroupInputGUI($lng->txt("adm_value"), "value_" . $s["id"]);
211 foreach ($s['options'] as $key => $value) {
212 $chbs->addOption($c = new ilCheckboxInputGUI($value, $key));
213 $c->setValue($key);
214 }
215 $cb->addSubItem($chbs);
216 break;
217 }
218
219 if ($s['hidable']) {
220 // hide setting
221 $cb_hide = new ilCheckboxInputGUI($lng->txt("adm_hide"), "hide_" . $s["id"]);
222 $cb->addSubItem($cb_hide);
223 }
224 }
225 }
226
227 if ($this->rbacsystem->checkAccess('write', $this->request->getRefId())) {
228 // save and cancel commands
229 if ($a_mode === "create") {
230 $this->form->addCommandButton("saveSettingsTemplate", $lng->txt("save"));
231 $this->form->addCommandButton("listSettingsTemplates", $lng->txt("cancel"));
232 $this->form->setTitle($lng->txt("adm_add_settings_template"));
233 } else {
234 $this->form->addCommandButton("updateSettingsTemplate", $lng->txt("save"));
235 $this->form->addCommandButton("listSettingsTemplates", $lng->txt("cancel"));
236 $this->form->setTitle($lng->txt("adm_edit_settings_template"));
237 }
238 }
239
240 $this->form->setFormAction($ilCtrl->getFormAction($this));
241 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
$c
Definition: cli.php:38
string $key
Consumer key/client ID value.
Definition: System.php:193
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200

References $c, $ctrl, ILIAS\LTI\ToolProvider\$key, $lng, ILIAS\LTI\ToolProvider\$settings, ilSettingsTemplateConfig\BOOL, ilSettingsTemplateConfig\CHECKBOX, ILIAS\Repository\form(), getConfig(), ilSettingsTemplateConfig\SELECT, ilSettingsTemplateConfig\TEXT, and ilLanguage\txt().

Referenced by addSettingsTemplate(), editSettingsTemplate(), saveSettingsTemplate(), and updateSettingsTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listSettingsTemplates()

ilSettingsTemplateGUI::listSettingsTemplates ( )

Definition at line 97 of file class.ilSettingsTemplateGUI.php.

97 : void
98 {
100 $ilToolbar = $this->toolbar;
101 $ilCtrl = $this->ctrl;
103
104 if ($this->rbacsystem->checkAccess('write', $this->request->getRefId())) {
105 $ilToolbar->addButton(
106 $lng->txt("adm_add_settings_template"),
107 $ilCtrl->getLinkTarget($this, "addSettingsTemplate")
108 );
109 }
110
111 $table = new ilSettingsTemplateTableGUI(
112 $this,
113 "listSettingsTemplates",
114 $this->getConfig()->getType()
115 );
116
117 $tpl->setContent($table->getHTML());
118 }

References $ctrl, $lng, $toolbar, $tpl, getConfig(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ readSettingsTemplate()

ilSettingsTemplateGUI::readSettingsTemplate ( )

Definition at line 83 of file class.ilSettingsTemplateGUI.php.

83 : void
84 {
85 if ($this->getConfig()) {
86 $this->settings_template = new ilSettingsTemplate(
87 $this->request->getTemplateId(),
88 $this->getConfig()
89 );
90 } else {
91 $this->settings_template = new ilSettingsTemplate(
92 $this->request->getTemplateId()
93 );
94 }
95 }

References getConfig().

+ Here is the call graph for this function:

◆ saveSettingsTemplate()

ilSettingsTemplateGUI::saveSettingsTemplate ( )

Definition at line 279 of file class.ilSettingsTemplateGUI.php.

279 : void
280 {
283 $ilCtrl = $this->ctrl;
284
285 $this->initSettingsTemplateForm("create");
286 if ($this->form->checkInput()) {
288 $settings_template->setType($this->getConfig()->getType());
289
292
293 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
294 $ilCtrl->redirect($this, "listSettingsTemplates");
295 }
296
297 $this->form->setValuesByPost();
298 $tpl->setContent($this->form->getHTML());
299 }
setValuesFromForm(ilSettingsTemplate $a_set_templ)

References $ctrl, $lng, $settings_template, $tpl, ilSettingsTemplate\create(), ILIAS\Repository\form(), getConfig(), initSettingsTemplateForm(), ilGlobalTemplateInterface\setContent(), ilSettingsTemplate\setType(), setValuesFromForm(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ setConfig()

ilSettingsTemplateGUI::setConfig ( ilSettingsTemplateConfig  $a_val)

Definition at line 73 of file class.ilSettingsTemplateGUI.php.

73 : void
74 {
75 $this->config = $a_val;
76 }

◆ setValuesFromForm()

ilSettingsTemplateGUI::setValuesFromForm ( ilSettingsTemplate  $a_set_templ)

Definition at line 320 of file class.ilSettingsTemplateGUI.php.

320 : void
321 {
322 // perform update
323 $a_set_templ->setTitle($this->form->getInput("title"));
324 $a_set_templ->setDescription($this->form->getInput("description"));
325
326 // save tabs to be hidden
327 $a_set_templ->removeAllHiddenTabs();
328 foreach ($this->getConfig()->getHidableTabs() as $t) {
329 if ($this->request->getTab($t["id"])) {
330 $a_set_templ->addHiddenTab($t["id"]);
331 }
332 }
333
334 // save settings values
335 $a_set_templ->removeAllSettings();
336 foreach ($this->getConfig()->getSettings() as $s) {
337 if ($this->request->getSetting($s["id"])) {
338 $a_set_templ->setSetting(
339 $s["id"],
340 $this->request->getValue($s["id"]),
341 $this->request->getHide($s["id"])
342 );
343 }
344 }
345 }
setSetting(string $a_setting, $a_value, bool $a_hide=false)
Set setting.
addHiddenTab(string $a_tab_id)

References ilSettingsTemplate\addHiddenTab(), ILIAS\Repository\form(), getConfig(), ILIAS\LTI\ToolProvider\getSettings(), ilSettingsTemplate\removeAllHiddenTabs(), ilSettingsTemplate\removeAllSettings(), ilSettingsTemplate\setDescription(), ilSettingsTemplate\setSetting(), and ilSettingsTemplate\setTitle().

Referenced by saveSettingsTemplate(), and updateSettingsTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSettingsTemplate()

ilSettingsTemplateGUI::updateSettingsTemplate ( )

Definition at line 301 of file class.ilSettingsTemplateGUI.php.

301 : void
302 {
304 $ilCtrl = $this->ctrl;
306
307 $this->initSettingsTemplateForm("edit");
308 if ($this->form->checkInput()) {
309 $this->setValuesFromForm($this->settings_template);
310 $this->settings_template->update();
311
312 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
313 $ilCtrl->redirect($this, "listSettingsTemplates");
314 }
315
316 $this->form->setValuesByPost();
317 $tpl->setContent($this->form->getHTML());
318 }

References $ctrl, $lng, $tpl, ILIAS\Repository\form(), initSettingsTemplateForm(), ilGlobalTemplateInterface\setContent(), setValuesFromForm(), and ilLanguage\txt().

+ Here is the call graph for this function:

Field Documentation

◆ $config

ilSettingsTemplateConfig ilSettingsTemplateGUI::$config
private

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

Referenced by getConfig().

◆ $ctrl

◆ $dic

ILIAS DI Container ilSettingsTemplateGUI::$dic
protected

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

◆ $form

ilPropertyFormGUI ilSettingsTemplateGUI::$form
protected

Definition at line 38 of file class.ilSettingsTemplateGUI.php.

◆ $lng

◆ $rbacsystem

ilRbacSystem ilSettingsTemplateGUI::$rbacsystem
protected

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

◆ $request

SettingsTemplateGUIRequest ilSettingsTemplateGUI::$request
protected

Definition at line 40 of file class.ilSettingsTemplateGUI.php.

◆ $settings_template

ilSettingsTemplate ilSettingsTemplateGUI::$settings_template
protected

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

Referenced by saveSettingsTemplate().

◆ $toolbar

ilToolbarGUI ilSettingsTemplateGUI::$toolbar
protected

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

Referenced by listSettingsTemplates().

◆ $tpl


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