4include_once(
"./Services/Administration/classes/class.ilSettingsTemplate.php");
47 $this->ctrl =
$DIC->ctrl();
48 $this->tpl =
$DIC[
"tpl"];
49 $this->toolbar =
$DIC->toolbar();
50 $this->lng =
$DIC->language();
53 $ilCtrl->saveParameter($this, array(
"templ_id"));
67 $cmd =
$ilCtrl->getCmd(
"listSettingsTemplates");
78 $this->config = $a_val;
119 $ilToolbar->addButton(
120 $lng->txt(
"adm_add_settings_template"),
121 $ilCtrl->getLinkTarget($this,
"addSettingsTemplate")
124 include_once(
"./Services/Administration/classes/class.ilSettingsTemplateTableGUI.php");
127 "listSettingsTemplates",
142 $tpl->setContent($this->form->getHTML());
154 $tpl->setContent($this->form->getHTML());
167 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
172 $ti->setMaxLength(200);
173 $ti->setRequired(
true);
175 if ($this->settings_template->getAutoGenerated()) {
176 $ti->setDisabled(
true);
179 $this->form->addItem($ti);
184 if ($this->settings_template->getAutoGenerated()) {
185 $ti->setDisabled(
true);
187 $this->form->addItem($ti);
193 $sec->setTitle(
$lng->txt(
"adm_hide_tabs"));
194 $this->form->addItem($sec);
199 $this->form->addItem($cb);
204 $settings = $this->
getConfig()->getSettings();
205 if (is_array($settings) && count($settings) > 0) {
207 $sec->setTitle(
$lng->txt(
"adm_predefined_settings"));
208 $this->form->addItem($sec);
210 foreach ($settings as
$s) {
213 $this->form->addItem($cb);
215 switch (
$s[
"type"]) {
221 $cb->addSubItem($ti);
226 $cb->addSubItem($cb2);
231 $si->setOptions(
$s[
"options"]);
232 $cb->addSubItem(
$si);
237 foreach (
$s[
'options'] as
$key => $value) {
241 $cb->addSubItem($chbs);
248 $cb->addSubItem($cb_hide);
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"));
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"));
264 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
274 $values[
"title"] = $this->settings_template->getTitle();
275 $values[
"description"] = $this->settings_template->getDescription();
278 $tabs = $this->settings_template->getHiddenTabs();
280 $values[
"tab_" .
$t] =
true;
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;
290 if (!is_array($set[
$s[
"id"]][
"value"])) {
291 $ar = @unserialize($set[
$s[
"id"]][
"value"]);
293 $ar = $set[
$s[
"id"]][
"value"];
295 $values[
"value_" .
$s[
"id"]] = is_array($ar) ? $ar : array();
297 $values[
"value_" .
$s[
"id"]] = $set[
$s[
"id"]][
"value"];
300 $values[
"hide_" .
$s[
"id"]] = $set[
$s[
"id"]][
"hide"];
303 $this->form->setValuesByArray($values);
316 if ($this->form->checkInput()) {
318 $settings_template->setType($this->
getConfig()->getType());
321 $settings_template->create();
324 $ilCtrl->redirect($this,
"listSettingsTemplates");
327 $this->form->setValuesByPost();
328 $tpl->setContent($this->form->getHtml());
341 if ($this->form->checkInput()) {
343 $this->settings_template->update();
346 $ilCtrl->redirect($this,
"listSettingsTemplates");
349 $this->form->setValuesByPost();
350 $tpl->setContent($this->form->getHtml());
362 $a_set_templ->setTitle(
$_POST[
"title"]);
363 $a_set_templ->setDescription(
$_POST[
"description"]);
366 $a_set_templ->removeAllHiddenTabs();
367 foreach ($this->
getConfig()->getHidableTabs() as
$t) {
369 $a_set_templ->addHiddenTab(
$t[
"id"]);
374 $a_set_templ->removeAllSettings();
375 foreach ($this->
getConfig()->getSettings() as
$s) {
377 $a_set_templ->setSetting(
395 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
397 $ilCtrl->redirect($this,
"listSettingsTemplates");
399 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
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");
410 $tpl->setContent($cgui->getHTML());
425 if (is_array(
$_POST[
"tid"])) {
432 $ilCtrl->redirect($this,
"listSettingsTemplates");
An exception for terminatinating execution or to throw for unit testing.
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.
if(!empty($this->data['faventry'])) $tabs
if(empty($password)) $table