4include_once(
"./Services/Administration/classes/class.ilSettingsTemplate.php");
27 $ilCtrl->saveParameter($this, array(
"templ_id"));
52 $this->config = $a_val;
91 $ilToolbar->addButton(
$lng->txt(
"adm_add_settings_template"),
92 $ilCtrl->getLinkTarget($this,
"addSettingsTemplate"));
94 include_once(
"./Services/Administration/classes/class.ilSettingsTemplateTableGUI.php");
98 $tpl->setContent($table->getHTML());
109 $tpl->setContent($this->form->getHTML());
121 $tpl->setContent($this->form->getHTML());
133 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
138 $ti->setMaxLength(200);
139 $ti->setRequired(
true);
141 if($this->settings_template->getAutoGenerated())
143 $ti->setDisabled(
true);
146 $this->form->addItem($ti);
151 if($this->settings_template->getAutoGenerated())
153 $ti->setDisabled(
true);
155 $this->form->addItem($ti);
158 $tabs = $this->
getConfig()->getHidableTabs();
159 if (is_array($tabs) && count($tabs) > 0)
162 $sec->setTitle(
$lng->txt(
"adm_hide_tabs"));
163 $this->form->addItem($sec);
169 $this->form->addItem($cb);
174 $settings = $this->
getConfig()->getSettings();
175 if (is_array($settings) && count($settings) > 0)
178 $sec->setTitle(
$lng->txt(
"adm_predefined_settings"));
179 $this->form->addItem($sec);
181 foreach($settings as $s)
185 $this->form->addItem($cb);
194 $cb->addSubItem($ti);
199 $cb->addSubItem($cb2);
204 $si->setOptions($s[
"options"]);
205 $cb->addSubItem(
$si);
210 foreach($s[
'options'] as $key => $value) {
214 $cb->addSubItem($chbs);
221 $cb->addSubItem($cb_hide);
227 if ($a_mode ==
"create")
229 $this->form->addCommandButton(
"saveSettingsTemplate",
$lng->txt(
"save"));
230 $this->form->addCommandButton(
"listSettingsTemplates",
$lng->txt(
"cancel"));
231 $this->form->setTitle(
$lng->txt(
"adm_add_settings_template"));
235 $this->form->addCommandButton(
"updateSettingsTemplate",
$lng->txt(
"save"));
236 $this->form->addCommandButton(
"listSettingsTemplates",
$lng->txt(
"cancel"));
237 $this->form->setTitle(
$lng->txt(
"adm_edit_settings_template"));
240 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
250 $values[
"title"] = $this->settings_template->getTitle();
251 $values[
"description"] = $this->settings_template->getDescription();
254 $tabs = $this->settings_template->getHiddenTabs();
255 foreach ($tabs as
$t)
257 $values[
"tab_".$t] =
true;
261 $set = $this->settings_template->getSettings();
262 foreach($this->
getConfig()->getSettings() as $s)
264 if (isset($set[$s[
"id"]]))
266 $values[
"set_".$s[
"id"]] =
true;
269 if (!is_array($set[$s[
"id"]][
"value"]))
270 $ar = @unserialize($set[$s[
"id"]][
"value"]);
272 $ar = $set[$s[
"id"]][
"value"];
273 $values[
"value_".$s[
"id"]] = is_array($ar) ? $ar : array();
276 $values[
"value_".$s[
"id"]] = $set[$s[
"id"]][
"value"];
279 $values[
"hide_".$s[
"id"]] = $set[$s[
"id"]][
"hide"];
282 $this->form->setValuesByArray($values);
293 if ($this->form->checkInput())
296 $settings_template->setType($this->
getConfig()->getType());
299 $settings_template->create();
302 $ilCtrl->redirect($this,
"listSettingsTemplates");
305 $this->form->setValuesByPost();
306 $tpl->setContent($this->form->getHtml());
317 if ($this->form->checkInput())
320 $this->settings_template->update();
323 $ilCtrl->redirect($this,
"listSettingsTemplates");
326 $this->form->setValuesByPost();
327 $tpl->setContent($this->form->getHtml());
339 $a_set_templ->setTitle(
$_POST[
"title"]);
340 $a_set_templ->setDescription(
$_POST[
"description"]);
343 $a_set_templ->removeAllHiddenTabs();
344 foreach ($this->
getConfig()->getHidableTabs() as
$t)
348 $a_set_templ->addHiddenTab(
$t[
"id"]);
353 $a_set_templ->removeAllSettings();
354 foreach($this->
getConfig()->getSettings() as $s)
356 if (
$_POST[
"set_".$s[
"id"]])
358 $a_set_templ->setSetting(
359 $s[
"id"],
$_POST[
"value_".$s[
"id"]],
360 $_POST[
"hide_".$s[
"id"]]);
372 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
375 $ilCtrl->redirect($this,
"listSettingsTemplates");
379 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
381 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
382 $cgui->setHeaderText(
$lng->txt(
"adm_sure_delete_settings_template"));
383 $cgui->setCancel(
$lng->txt(
"cancel"),
"listSettingsTemplates");
384 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteSettingsTemplate");
386 foreach (
$_POST[
"tid"] as $i)
391 $tpl->setContent($cgui->getHTML());
405 if (is_array(
$_POST[
"tid"]))
407 foreach (
$_POST[
"tid"] as $i)
414 $ilCtrl->redirect($this,
"listSettingsTemplates");
Confirmation screen class.
editSettingsTemplate()
Edit settings template.
initSettingsTemplateForm($a_mode="edit")
Init settings template form.
saveSettingsTemplate()
Save settings template form.
listSettingsTemplates()
List all settings template.
__construct($a_config)
Constructor.
getSettingsTemplateValues()
Get current values for settings template from.
addSettingsTemplate()
Add settings template.
deleteSettingsTemplate()
Delete settings template.
executeCommand()
Execute command.
readSettingsTemplate()
Read settings template.
updateSettingsTemplate()
Update settings template.
confirmSettingsTemplateDeletion()
Confirm settings template deletion.
getConfig()
Get config object.
setConfig($a_val)
Set config object.
setValuesFromForm($a_set_templ)
Set values from form.
Settings templates table.
Settings template application class.
static lookupTitle($a_id)
Lookup title.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.