4 include_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();
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");
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()) {
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"]) {
231 $si->setOptions($s[
"options"]);
232 $cb->addSubItem(
$si);
237 foreach ($s[
'options'] as
$key => $value) {
241 $cb->addSubItem($chbs);
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) {
368 if (
$_POST[
"tab_" . $t[
"id"]]) {
369 $a_set_templ->addHiddenTab($t[
"id"]);
374 $a_set_templ->removeAllSettings();
375 foreach ($this->
getConfig()->getSettings() as
$s) {
376 if (
$_POST[
"set_" . $s[
"id"]]) {
377 $a_set_templ->setSetting(
379 $_POST[
"value_" . $s[
"id"]],
380 $_POST[
"hide_" . $s[
"id"]]
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");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
listSettingsTemplates()
List all settings template.
saveSettingsTemplate()
Save settings template form.
editSettingsTemplate()
Edit settings template.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setValuesFromForm($a_set_templ)
Set values from form.
readSettingsTemplate()
Read settings template.
getSettingsTemplateValues()
Get current values for settings template from.
This class represents a text property in a property form.
addSettingsTemplate()
Add settings template.
getConfig()
Get config object.
initSettingsTemplateForm($a_mode="edit")
Init settings template form.
setMaxLength($a_maxlength)
Set Max Length.
static lookupTitle($a_id)
Lookup title.
Create styles array
The data for the language used.
if(!empty($this->data['faventry'])) $tabs
setConfig($a_val)
Set config object.
__construct($a_config)
Constructor.
This class represents a text area property in a property form.
confirmSettingsTemplateDeletion()
Confirm settings template deletion.
Settings templates table.
if(empty($password)) $table
executeCommand()
Execute command.
deleteSettingsTemplate()
Delete settings template.
Settings template application class.
updateSettingsTemplate()
Update settings template.
Confirmation screen class.