4include_once(
"./Services/Administration/classes/class.ilSettingsTemplate.php");
55 $this->rbacsystem = $this->dic->rbac()->system();
56 $this->ctrl = $this->dic->ctrl();
57 $this->tpl = $this->dic[
"tpl"];
58 $this->toolbar = $this->dic->toolbar();
59 $this->lng = $this->dic->language();
60 $ilCtrl = $this->dic->ctrl();
62 $ilCtrl->saveParameter($this, array(
"templ_id"));
76 $cmd = $ilCtrl->getCmd(
"listSettingsTemplates");
87 $this->config = $a_val;
128 if ($this->rbacsystem->checkAccess(
'write',
$_GET[
'ref_id'])) {
129 $ilToolbar->addButton(
130 $lng->txt(
"adm_add_settings_template"),
131 $ilCtrl->getLinkTarget($this,
"addSettingsTemplate")
135 include_once(
"./Services/Administration/classes/class.ilSettingsTemplateTableGUI.php");
138 "listSettingsTemplates",
142 $tpl->setContent($table->getHTML());
153 $tpl->setContent($this->form->getHTML());
165 $tpl->setContent($this->form->getHTML());
178 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
183 $ti->setMaxLength(200);
184 $ti->setRequired(
true);
186 if ($this->settings_template->getAutoGenerated()) {
187 $ti->setDisabled(
true);
190 $this->form->addItem($ti);
195 if ($this->settings_template->getAutoGenerated()) {
196 $ti->setDisabled(
true);
198 $this->form->addItem($ti);
201 $tabs = $this->
getConfig()->getHidableTabs();
202 if (is_array($tabs) && count($tabs) > 0) {
204 $sec->setTitle(
$lng->txt(
"adm_hide_tabs"));
205 $this->form->addItem($sec);
207 foreach ($tabs as $t) {
210 $this->form->addItem($cb);
215 $settings = $this->
getConfig()->getSettings();
216 if (is_array($settings) && count($settings) > 0) {
218 $sec->setTitle(
$lng->txt(
"adm_predefined_settings"));
219 $this->form->addItem($sec);
221 foreach ($settings as $s) {
224 $this->form->addItem($cb);
226 switch ($s[
"type"]) {
232 $cb->addSubItem($ti);
237 $cb->addSubItem($cb2);
242 $si->setOptions($s[
"options"]);
243 $cb->addSubItem(
$si);
248 foreach ($s[
'options'] as $key => $value) {
252 $cb->addSubItem($chbs);
259 $cb->addSubItem($cb_hide);
264 if ($this->rbacsystem->checkAccess(
'write',
$_GET[
'ref_id'])) {
266 if ($a_mode ==
"create") {
267 $this->form->addCommandButton(
"saveSettingsTemplate",
$lng->txt(
"save"));
268 $this->form->addCommandButton(
"listSettingsTemplates",
$lng->txt(
"cancel"));
269 $this->form->setTitle(
$lng->txt(
"adm_add_settings_template"));
271 $this->form->addCommandButton(
"updateSettingsTemplate",
$lng->txt(
"save"));
272 $this->form->addCommandButton(
"listSettingsTemplates",
$lng->txt(
"cancel"));
273 $this->form->setTitle(
$lng->txt(
"adm_edit_settings_template"));
277 $this->form->setFormAction($ilCtrl->getFormAction($this));
287 $values[
"title"] = $this->settings_template->getTitle();
288 $values[
"description"] = $this->settings_template->getDescription();
291 $tabs = $this->settings_template->getHiddenTabs();
292 foreach ($tabs as $t) {
293 $values[
"tab_" . $t] =
true;
297 $set = $this->settings_template->getSettings();
298 foreach ($this->
getConfig()->getSettings() as $s) {
299 if (isset($set[$s[
"id"]])) {
300 $values[
"set_" . $s[
"id"]] =
true;
303 if (!is_array($set[$s[
"id"]][
"value"])) {
304 $ar = @unserialize($set[$s[
"id"]][
"value"]);
306 $ar = $set[$s[
"id"]][
"value"];
308 $values[
"value_" . $s[
"id"]] = is_array($ar) ? $ar : array();
310 $values[
"value_" . $s[
"id"]] = $set[$s[
"id"]][
"value"];
313 $values[
"hide_" . $s[
"id"]] = $set[$s[
"id"]][
"hide"];
316 $this->form->setValuesByArray($values);
329 if ($this->form->checkInput()) {
331 $settings_template->setType($this->
getConfig()->getType());
334 $settings_template->create();
336 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
337 $ilCtrl->redirect($this,
"listSettingsTemplates");
340 $this->form->setValuesByPost();
341 $tpl->setContent($this->form->getHtml());
354 if ($this->form->checkInput()) {
356 $this->settings_template->update();
358 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
359 $ilCtrl->redirect($this,
"listSettingsTemplates");
362 $this->form->setValuesByPost();
363 $tpl->setContent($this->form->getHtml());
375 $a_set_templ->setTitle(
$_POST[
"title"]);
376 $a_set_templ->setDescription(
$_POST[
"description"]);
379 $a_set_templ->removeAllHiddenTabs();
380 foreach ($this->
getConfig()->getHidableTabs() as $t) {
381 if (
$_POST[
"tab_" . $t[
"id"]]) {
382 $a_set_templ->addHiddenTab($t[
"id"]);
387 $a_set_templ->removeAllSettings();
388 foreach ($this->
getConfig()->getSettings() as $s) {
389 if (
$_POST[
"set_" . $s[
"id"]]) {
390 $a_set_templ->setSetting(
392 $_POST[
"value_" . $s[
"id"]],
393 $_POST[
"hide_" . $s[
"id"]]
408 if (!is_array(
$_POST[
"tid"]) || count(
$_POST[
"tid"]) == 0) {
410 $ilCtrl->redirect($this,
"listSettingsTemplates");
412 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
414 $cgui->setFormAction($ilCtrl->getFormAction($this));
415 $cgui->setHeaderText(
$lng->txt(
"adm_sure_delete_settings_template"));
416 $cgui->setCancel(
$lng->txt(
"cancel"),
"listSettingsTemplates");
417 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteSettingsTemplate");
423 $tpl->setContent($cgui->getHTML());
438 if (is_array(
$_POST[
"tid"])) {
444 ilUtil::sendSuccess(
"msg_obj_modified");
445 $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 sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.