ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSettingsTemplateGUI Class Reference

Settings template. More...

+ Collaboration diagram for ilSettingsTemplateGUI:

Public Member Functions

 __construct ($a_config)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 setConfig ($a_val)
 Set config object. More...
 
 getConfig ()
 Get config object. More...
 
 readSettingsTemplate ()
 Read settings template. More...
 
 listSettingsTemplates ()
 List all settings template. More...
 
 addSettingsTemplate ()
 Add settings template. More...
 
 editSettingsTemplate ()
 Edit settings template. More...
 
 initSettingsTemplateForm ($a_mode="edit")
 Init settings template form. More...
 
 getSettingsTemplateValues ()
 Get current values for settings template from. More...
 
 saveSettingsTemplate ()
 Save settings template form. More...
 
 updateSettingsTemplate ()
 Update settings template. More...
 
 setValuesFromForm ($a_set_templ)
 Set values from form. More...
 
 confirmSettingsTemplateDeletion ()
 Confirm settings template deletion. More...
 
 deleteSettingsTemplate ()
 Delete settings template. More...
 

Protected Attributes

 $ctrl
 
 $tpl
 
 $toolbar
 
 $lng
 

Private Attributes

 $config
 

Detailed Description

Settings template.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilSettingsTemplateGUI::__construct (   $a_config)

Constructor.

Parameters

return

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

44 {
45 global $DIC;
46
47 $this->ctrl = $DIC->ctrl();
48 $this->tpl = $DIC["tpl"];
49 $this->toolbar = $DIC->toolbar();
50 $this->lng = $DIC->language();
51 $ilCtrl = $DIC->ctrl();
52
53 $ilCtrl->saveParameter($this, array("templ_id"));
54
55 $this->setConfig($a_config);
56
57 $this->readSettingsTemplate();
58 }
readSettingsTemplate()
Read settings template.
setConfig($a_val)
Set config object.
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

References $DIC, $ilCtrl, readSettingsTemplate(), and setConfig().

+ Here is the call graph for this function:

Member Function Documentation

◆ addSettingsTemplate()

ilSettingsTemplateGUI::addSettingsTemplate ( )

Add settings template.

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

138 {
140
141 $this->initSettingsTemplateForm("create");
142 $tpl->setContent($this->form->getHTML());
143 }
initSettingsTemplateForm($a_mode="edit")
Init settings template form.

References $tpl, and initSettingsTemplateForm().

+ Here is the call graph for this function:

◆ confirmSettingsTemplateDeletion()

ilSettingsTemplateGUI::confirmSettingsTemplateDeletion ( )

Confirm settings template deletion.

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

390 {
394
395 if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0) {
396 ilUtil::sendInfo($lng->txt("no_checkbox"), true);
397 $ilCtrl->redirect($this, "listSettingsTemplates");
398 } else {
399 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
400 $cgui = new ilConfirmationGUI();
401 $cgui->setFormAction($ilCtrl->getFormAction($this));
402 $cgui->setHeaderText($lng->txt("adm_sure_delete_settings_template"));
403 $cgui->setCancel($lng->txt("cancel"), "listSettingsTemplates");
404 $cgui->setConfirm($lng->txt("delete"), "deleteSettingsTemplate");
405
406 foreach ($_POST["tid"] as $i) {
407 $cgui->addItem("tid[]", $i, ilSettingsTemplate::lookupTitle($i));
408 }
409
410 $tpl->setContent($cgui->getHTML());
411 }
412 }
$_POST["username"]
Confirmation screen class.
static lookupTitle($a_id)
Lookup title.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$i
Definition: disco.tpl.php:19

References $_POST, $ctrl, $i, $ilCtrl, $lng, $tpl, ilSettingsTemplate\lookupTitle(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ deleteSettingsTemplate()

ilSettingsTemplateGUI::deleteSettingsTemplate ( )

Delete settings template.

Parameters

return

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

421 {
424
425 if (is_array($_POST["tid"])) {
426 foreach ($_POST["tid"] as $i) {
427 $templ = new ilSettingsTemplate($i);
428 $templ->delete();
429 }
430 }
431 ilUtil::sendSuccess("msg_obj_modified");
432 $ilCtrl->redirect($this, "listSettingsTemplates");
433 }
Settings template application class.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $_POST, $ctrl, $i, $ilCtrl, $lng, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ editSettingsTemplate()

ilSettingsTemplateGUI::editSettingsTemplate ( )

Edit settings template.

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

149 {
151
152 $this->initSettingsTemplateForm("edit");
154 $tpl->setContent($this->form->getHTML());
155 }
getSettingsTemplateValues()
Get current values for settings template from.

References $tpl, getSettingsTemplateValues(), and initSettingsTemplateForm().

+ Here is the call graph for this function:

◆ executeCommand()

ilSettingsTemplateGUI::executeCommand ( )

Execute command.

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

64 {
66
67 $cmd = $ilCtrl->getCmd("listSettingsTemplates");
68 $this->$cmd();
69 }

References $ctrl, and $ilCtrl.

◆ getConfig()

ilSettingsTemplateGUI::getConfig ( )

Get config object.

Returns
object config object

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

References $config.

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

+ Here is the caller graph for this function:

◆ getSettingsTemplateValues()

ilSettingsTemplateGUI::getSettingsTemplateValues ( )

Get current values for settings template from.

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

271 {
272 $values = array();
273
274 $values["title"] = $this->settings_template->getTitle();
275 $values["description"] = $this->settings_template->getDescription();
276
277 // save tabs to be hidden
278 $tabs = $this->settings_template->getHiddenTabs();
279 foreach ($tabs as $t) {
280 $values["tab_" . $t] = true;
281 }
282
283 // save settings values
284 $set = $this->settings_template->getSettings();
285 foreach ($this->getConfig()->getSettings() as $s) {
286 if (isset($set[$s["id"]])) {
287 $values["set_" . $s["id"]] = true;
288
289 if ($s['type'] == ilSettingsTemplateConfig::CHECKBOX) {
290 if (!is_array($set[$s["id"]]["value"])) {
291 $ar = @unserialize($set[$s["id"]]["value"]);
292 } else {
293 $ar = $set[$s["id"]]["value"];
294 }
295 $values["value_" . $s["id"]] = is_array($ar) ? $ar : array();
296 } else {
297 $values["value_" . $s["id"]] = $set[$s["id"]]["value"];
298 }
299
300 $values["hide_" . $s["id"]] = $set[$s["id"]]["hide"];
301 }
302 }
303 $this->form->setValuesByArray($values);
304 }
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
$s
Definition: pwgen.php:45

References $s, $t, $tabs, ilSettingsTemplateConfig\CHECKBOX, and getConfig().

Referenced by editSettingsTemplate().

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

◆ initSettingsTemplateForm()

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

Init settings template form.

Parameters
int$a_modeEdit Mode

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

163 {
166
167 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
168 $this->form = new ilPropertyFormGUI();
169
170 // title
171 $ti = new ilTextInputGUI($lng->txt("title"), "title");
172 $ti->setMaxLength(200);
173 $ti->setRequired(true);
174 // begin-patch lok
175 if ($this->settings_template->getAutoGenerated()) {
176 $ti->setDisabled(true);
177 }
178 // end-patch lok
179 $this->form->addItem($ti);
180
181 // description
182 $ti = new ilTextAreaInputGUI($lng->txt("description"), "description");
183 // begin-patch lok
184 if ($this->settings_template->getAutoGenerated()) {
185 $ti->setDisabled(true);
186 }
187 $this->form->addItem($ti);
188
189 // hidable tabs
190 $tabs = $this->getConfig()->getHidableTabs();
191 if (is_array($tabs) && count($tabs) > 0) {
192 $sec = new ilFormSectionHeaderGUI();
193 $sec->setTitle($lng->txt("adm_hide_tabs"));
194 $this->form->addItem($sec);
195
196 foreach ($tabs as $t) {
197 // hide tab $t?
198 $cb = new ilCheckboxInputGUI($t["text"], "tab_" . $t["id"]);
199 $this->form->addItem($cb);
200 }
201 }
202
203 // settings
204 $settings = $this->getConfig()->getSettings();
205 if (is_array($settings) && count($settings) > 0) {
206 $sec = new ilFormSectionHeaderGUI();
207 $sec->setTitle($lng->txt("adm_predefined_settings"));
208 $this->form->addItem($sec);
209
210 foreach ($settings as $s) {
211 // setting
212 $cb = new ilCheckboxInputGUI($s["text"], "set_" . $s["id"]);
213 $this->form->addItem($cb);
214
215 switch ($s["type"]) {
217
218 $ti = new ilTextInputGUI($lng->txt("adm_value"), "value_" . $s["id"]);
219 //$ti->setMaxLength();
220 //$ti->setSize();
221 $cb->addSubItem($ti);
222 break;
223
225 $cb2 = new ilCheckboxInputGUI($lng->txt("adm_value"), "value_" . $s["id"]);
226 $cb->addSubItem($cb2);
227 break;
228
230 $si = new ilSelectInputGUI($lng->txt("adm_value"), "value_" . $s["id"]);
231 $si->setOptions($s["options"]);
232 $cb->addSubItem($si);
233 break;
234
236 $chbs = new ilCheckboxGroupInputGUI($lng->txt("adm_value"), "value_" . $s["id"]);
237 foreach ($s['options'] as $key => $value) {
238 $chbs->addOption($c = new ilCheckboxInputGUI($value, $key));
239 $c->setValue($key);
240 }
241 $cb->addSubItem($chbs);
242 break;
243 }
244
245 if ($s['hidable']) {
246 // hide setting
247 $cb_hide = new ilCheckboxInputGUI($lng->txt("adm_hide"), "hide_" . $s["id"]);
248 $cb->addSubItem($cb_hide);
249 }
250 }
251 }
252
253 // save and cancel commands
254 if ($a_mode == "create") {
255 $this->form->addCommandButton("saveSettingsTemplate", $lng->txt("save"));
256 $this->form->addCommandButton("listSettingsTemplates", $lng->txt("cancel"));
257 $this->form->setTitle($lng->txt("adm_add_settings_template"));
258 } else {
259 $this->form->addCommandButton("updateSettingsTemplate", $lng->txt("save"));
260 $this->form->addCommandButton("listSettingsTemplates", $lng->txt("cancel"));
261 $this->form->setTitle($lng->txt("adm_edit_settings_template"));
262 }
263
264 $this->form->setFormAction($ilCtrl->getFormAction($this));
265 }
This class represents a property in a property form.
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
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.
$key
Definition: croninfo.php:18

References $ctrl, $ilCtrl, $key, $lng, $s, $si, $t, $tabs, ilSettingsTemplateConfig\BOOL, ilSettingsTemplateConfig\CHECKBOX, getConfig(), ilSettingsTemplateConfig\SELECT, and ilSettingsTemplateConfig\TEXT.

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 ( )

List all settings template.

Parameters

return

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

113 {
115 $ilToolbar = $this->toolbar;
118
119 $ilToolbar->addButton(
120 $lng->txt("adm_add_settings_template"),
121 $ilCtrl->getLinkTarget($this, "addSettingsTemplate")
122 );
123
124 include_once("./Services/Administration/classes/class.ilSettingsTemplateTableGUI.php");
126 $this,
127 "listSettingsTemplates",
128 $this->getConfig()->getType()
129 );
130
131 $tpl->setContent($table->getHTML());
132 }
if(empty($password)) $table
Definition: pwgen.php:24

References $ctrl, $ilCtrl, $lng, $table, $toolbar, $tpl, and getConfig().

+ Here is the call graph for this function:

◆ readSettingsTemplate()

ilSettingsTemplateGUI::readSettingsTemplate ( )

Read settings template.

Parameters

return

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

98 {
99 if ($this->getConfig()) {
100 $this->settings_template = new ilSettingsTemplate((int) $_GET["templ_id"], $this->getConfig());
101 } else {
102 $this->settings_template = new ilSettingsTemplate((int) $_GET["templ_id"]);
103 }
104 }
$_GET["client_id"]

References $_GET, and getConfig().

Referenced by __construct().

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

◆ saveSettingsTemplate()

ilSettingsTemplateGUI::saveSettingsTemplate ( )

Save settings template form.

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

310 {
314
315 $this->initSettingsTemplateForm("create");
316 if ($this->form->checkInput()) {
317 $settings_template = new ilSettingsTemplate();
318 $settings_template->setType($this->getConfig()->getType());
319
320 $this->setValuesFromForm($settings_template);
321 $settings_template->create();
322
323 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
324 $ilCtrl->redirect($this, "listSettingsTemplates");
325 }
326
327 $this->form->setValuesByPost();
328 $tpl->setContent($this->form->getHtml());
329 }
setValuesFromForm($a_set_templ)
Set values from form.

References $ctrl, $ilCtrl, $lng, $tpl, getConfig(), initSettingsTemplateForm(), ilUtil\sendSuccess(), and setValuesFromForm().

+ Here is the call graph for this function:

◆ setConfig()

ilSettingsTemplateGUI::setConfig (   $a_val)

Set config object.

Parameters
object$a_valconfig object

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

77 {
78 $this->config = $a_val;
79 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setValuesFromForm()

ilSettingsTemplateGUI::setValuesFromForm (   $a_set_templ)

Set values from form.

Parameters

return

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

360 {
361 // perform update
362 $a_set_templ->setTitle($_POST["title"]);
363 $a_set_templ->setDescription($_POST["description"]);
364
365 // save tabs to be hidden
366 $a_set_templ->removeAllHiddenTabs();
367 foreach ($this->getConfig()->getHidableTabs() as $t) {
368 if ($_POST["tab_" . $t["id"]]) {
369 $a_set_templ->addHiddenTab($t["id"]);
370 }
371 }
372
373 // save settings values
374 $a_set_templ->removeAllSettings();
375 foreach ($this->getConfig()->getSettings() as $s) {
376 if ($_POST["set_" . $s["id"]]) {
377 $a_set_templ->setSetting(
378 $s["id"],
379 $_POST["value_" . $s["id"]],
380 $_POST["hide_" . $s["id"]]
381 );
382 }
383 }
384 }

References $_POST, $s, $t, and getConfig().

Referenced by saveSettingsTemplate(), and updateSettingsTemplate().

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

◆ updateSettingsTemplate()

ilSettingsTemplateGUI::updateSettingsTemplate ( )

Update settings template.

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

335 {
339
340 $this->initSettingsTemplateForm("edit");
341 if ($this->form->checkInput()) {
342 $this->setValuesFromForm($this->settings_template);
343 $this->settings_template->update();
344
345 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
346 $ilCtrl->redirect($this, "listSettingsTemplates");
347 }
348
349 $this->form->setValuesByPost();
350 $tpl->setContent($this->form->getHtml());
351 }

References $ctrl, $ilCtrl, $lng, $tpl, initSettingsTemplateForm(), ilUtil\sendSuccess(), and setValuesFromForm().

+ Here is the call graph for this function:

Field Documentation

◆ $config

ilSettingsTemplateGUI::$config
private

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

Referenced by getConfig().

◆ $ctrl

◆ $lng

◆ $toolbar

ilSettingsTemplateGUI::$toolbar
protected

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

Referenced by listSettingsTemplates().

◆ $tpl


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