4 include_once(
"./Services/Administration/classes/class.ilSettingsTemplate.php");
27 $ilCtrl->saveParameter($this, array(
"templ_id"));
41 $cmd = $ilCtrl->getCmd(
"listSettingsTemplates");
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");
139 $ti->setRequired(
true);
140 $this->form->addItem($ti);
144 $this->form->addItem($ti);
147 $tabs = $this->
getConfig()->getHidableTabs();
148 if (is_array($tabs) && count($tabs) > 0)
151 $sec->setTitle($lng->txt(
"adm_hide_tabs"));
152 $this->form->addItem($sec);
158 $this->form->addItem($cb);
163 $settings = $this->
getConfig()->getSettings();
164 if (is_array($settings) && count($settings) > 0)
167 $sec->setTitle($lng->txt(
"adm_predefined_settings"));
168 $this->form->addItem($sec);
170 foreach($settings as $s)
174 $this->form->addItem($cb);
180 $ti =
new ilTextInputGUI($lng->txt(
"adm_value"),
"value_".$s[
"id"]);
194 $cb->addSubItem($si);
199 foreach($s[
'options'] as $key => $value) {
203 $cb->addSubItem($chbs);
216 if ($a_mode ==
"create")
218 $this->form->addCommandButton(
"saveSettingsTemplate", $lng->txt(
"save"));
219 $this->form->addCommandButton(
"listSettingsTemplates", $lng->txt(
"cancel"));
220 $this->form->setTitle($lng->txt(
"adm_add_settings_template"));
224 $this->form->addCommandButton(
"updateSettingsTemplate", $lng->txt(
"save"));
225 $this->form->addCommandButton(
"listSettingsTemplates", $lng->txt(
"cancel"));
226 $this->form->setTitle($lng->txt(
"adm_edit_settings_template"));
229 $this->form->setFormAction($ilCtrl->getFormAction($this));
239 $values[
"title"] = $this->settings_template->getTitle();
240 $values[
"description"] = $this->settings_template->getDescription();
243 $tabs = $this->settings_template->getHiddenTabs();
244 foreach ($tabs as
$t)
246 $values[
"tab_".$t] =
true;
250 $set = $this->settings_template->getSettings();
251 foreach($this->
getConfig()->getSettings() as $s)
253 if (isset($set[$s[
"id"]]))
255 $values[
"set_".$s[
"id"]] =
true;
258 if (!is_array($set[$s[
"id"]][
"value"]))
259 $ar = @unserialize($set[$s[
"id"]][
"value"]);
261 $ar = $set[$s[
"id"]][
"value"];
262 $values[
"value_".$s[
"id"]] = is_array($ar) ? $ar : array();
265 $values[
"value_".$s[
"id"]] = $set[$s[
"id"]][
"value"];
268 $values[
"hide_".$s[
"id"]] = $set[$s[
"id"]][
"hide"];
271 $this->form->setValuesByArray($values);
282 if ($this->form->checkInput())
285 $settings_template->setType($this->
getConfig()->getType());
288 $settings_template->create();
291 $ilCtrl->redirect($this,
"listSettingsTemplates");
294 $this->form->setValuesByPost();
295 $tpl->setContent($this->form->getHtml());
306 if ($this->form->checkInput())
309 $this->settings_template->update();
312 $ilCtrl->redirect($this,
"listSettingsTemplates");
315 $this->form->setValuesByPost();
316 $tpl->setContent($this->form->getHtml());
328 $a_set_templ->setTitle(
$_POST[
"title"]);
329 $a_set_templ->setDescription(
$_POST[
"description"]);
332 $a_set_templ->removeAllHiddenTabs();
333 foreach ($this->
getConfig()->getHidableTabs() as
$t)
335 if (
$_POST[
"tab_".$t[
"id"]])
337 $a_set_templ->addHiddenTab($t[
"id"]);
342 $a_set_templ->removeAllSettings();
343 foreach($this->
getConfig()->getSettings() as $s)
345 if (
$_POST[
"set_".$s[
"id"]])
347 $a_set_templ->setSetting(
348 $s[
"id"],
$_POST[
"value_".$s[
"id"]],
349 $_POST[
"hide_".$s[
"id"]]);
361 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0)
364 $ilCtrl->redirect($this,
"listSettingsTemplates");
368 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
370 $cgui->setFormAction($ilCtrl->getFormAction($this));
371 $cgui->setHeaderText($lng->txt(
"adm_sure_delete_settings_template"));
372 $cgui->setCancel($lng->txt(
"cancel"),
"listSettingsTemplates");
373 $cgui->setConfirm($lng->txt(
"delete"),
"deleteSettingsTemplate");
375 foreach (
$_POST[
"tid"] as $i)
380 $tpl->setContent($cgui->getHTML());
394 if (is_array(
$_POST[
"tid"]))
396 foreach (
$_POST[
"tid"] as $i)
403 $ilCtrl->redirect($this,
"listSettingsTemplates");