ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSettingsTemplateGUI Class Reference

Settings template. More...

+ Collaboration diagram for ilSettingsTemplateGUI:

Public Member Functions

 __construct ($a_config)
 Constructor.
 executeCommand ()
 Execute command.
 setConfig ($a_val)
 Set config object.
 getConfig ()
 Get config object.
 readSettingsTemplate ()
 Read settings template.
 listSettingsTemplates ()
 List all settings template.
 addSettingsTemplate ()
 Add settings template.
 editSettingsTemplate ()
 Edit settings template.
 initSettingsTemplateForm ($a_mode="edit")
 Init settings template form.
 getSettingsTemplateValues ()
 Get current values for settings template from.
 saveSettingsTemplate ()
 Save settings template form.
 updateSettingsTemplate ()
 Update settings template.
 setValuesFromForm ($a_set_templ)
 Set values from form.
 confirmSettingsTemplateDeletion ()
 Confirm settings template deletion.
 deleteSettingsTemplate ()
 Delete settings template.

Private Attributes

 $config

Detailed Description

Settings template.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilSettingsTemplateGUI.php.

Constructor & Destructor Documentation

ilSettingsTemplateGUI::__construct (   $a_config)

Constructor.

Parameters
@return

Definition at line 23 of file class.ilSettingsTemplateGUI.php.

References $ilCtrl, readSettingsTemplate(), and setConfig().

{
global $ilCtrl;
$ilCtrl->saveParameter($this, array("templ_id"));
$this->setConfig($a_config);
}

+ Here is the call graph for this function:

Member Function Documentation

ilSettingsTemplateGUI::addSettingsTemplate ( )

Add settings template.

Definition at line 104 of file class.ilSettingsTemplateGUI.php.

References $tpl, and initSettingsTemplateForm().

{
global $tpl;
$this->initSettingsTemplateForm("create");
$tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

ilSettingsTemplateGUI::confirmSettingsTemplateDeletion ( )

Confirm settings template deletion.

Definition at line 357 of file class.ilSettingsTemplateGUI.php.

References $_POST, $ilCtrl, $lng, $tpl, ilSettingsTemplate\lookupTitle(), and ilUtil\sendInfo().

{
global $ilCtrl, $tpl, $lng;
if (!is_array($_POST["tid"]) || count($_POST["tid"]) == 0)
{
ilUtil::sendInfo($lng->txt("no_checkbox"), true);
$ilCtrl->redirect($this, "listSettingsTemplates");
}
else
{
include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
$cgui = new ilConfirmationGUI();
$cgui->setFormAction($ilCtrl->getFormAction($this));
$cgui->setHeaderText($lng->txt("adm_sure_delete_settings_template"));
$cgui->setCancel($lng->txt("cancel"), "listSettingsTemplates");
$cgui->setConfirm($lng->txt("delete"), "deleteSettingsTemplate");
foreach ($_POST["tid"] as $i)
{
$cgui->addItem("tid[]", $i, ilSettingsTemplate::lookupTitle($i));
}
$tpl->setContent($cgui->getHTML());
}
}

+ Here is the call graph for this function:

ilSettingsTemplateGUI::deleteSettingsTemplate ( )

Delete settings template.

Parameters
@return

Definition at line 390 of file class.ilSettingsTemplateGUI.php.

References $_POST, $ilCtrl, $lng, and ilUtil\sendSuccess().

{
global $ilCtrl, $lng;
if (is_array($_POST["tid"]))
{
foreach ($_POST["tid"] as $i)
{
$templ = new ilSettingsTemplate($i);
$templ->delete();
}
}
ilUtil::sendSuccess("msg_obj_modified");
$ilCtrl->redirect($this, "listSettingsTemplates");
}

+ Here is the call graph for this function:

ilSettingsTemplateGUI::editSettingsTemplate ( )

Edit settings template.

Definition at line 115 of file class.ilSettingsTemplateGUI.php.

References $tpl, getSettingsTemplateValues(), and initSettingsTemplateForm().

{
global $tpl;
$this->initSettingsTemplateForm("edit");
$tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

ilSettingsTemplateGUI::executeCommand ( )

Execute command.

Definition at line 37 of file class.ilSettingsTemplateGUI.php.

References $cmd, and $ilCtrl.

{
global $ilCtrl;
$cmd = $ilCtrl->getCmd("listSettingsTemplates");
$this->$cmd();
}
ilSettingsTemplateGUI::getConfig ( )

Get config object.

Returns
object config object

Definition at line 60 of file class.ilSettingsTemplateGUI.php.

References $config.

Referenced by getSettingsTemplateValues(), initSettingsTemplateForm(), listSettingsTemplates(), readSettingsTemplate(), saveSettingsTemplate(), and setValuesFromForm().

{
return $this->config;
}

+ Here is the caller graph for this function:

ilSettingsTemplateGUI::getSettingsTemplateValues ( )

Get current values for settings template from.

Definition at line 235 of file class.ilSettingsTemplateGUI.php.

References $t, ilSettingsTemplateConfig\CHECKBOX, and getConfig().

Referenced by editSettingsTemplate().

{
$values = array();
$values["title"] = $this->settings_template->getTitle();
$values["description"] = $this->settings_template->getDescription();
// save tabs to be hidden
$tabs = $this->settings_template->getHiddenTabs();
foreach ($tabs as $t)
{
$values["tab_".$t] = true;
}
// save settings values
$set = $this->settings_template->getSettings();
foreach($this->getConfig()->getSettings() as $s)
{
if (isset($set[$s["id"]]))
{
$values["set_".$s["id"]] = true;
if (!is_array($set[$s["id"]]["value"]))
$ar = @unserialize($set[$s["id"]]["value"]);
else
$ar = $set[$s["id"]]["value"];
$values["value_".$s["id"]] = is_array($ar) ? $ar : array();
}
else {
$values["value_".$s["id"]] = $set[$s["id"]]["value"];
}
$values["hide_".$s["id"]] = $set[$s["id"]]["hide"];
}
}
$this->form->setValuesByArray($values);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSettingsTemplateGUI::initSettingsTemplateForm (   $a_mode = "edit")

Init settings template form.

Parameters
int$a_modeEdit Mode

Definition at line 129 of file class.ilSettingsTemplateGUI.php.

References $ilCtrl, $lng, $si, $t, ilCheckboxGroupInputGUI\addOption(), ilSubEnabledFormPropertyGUI\addSubItem(), ilSettingsTemplateConfig\BOOL, ilSettingsTemplateConfig\CHECKBOX, getConfig(), ilSettingsTemplateConfig\SELECT, ilTextInputGUI\setMaxLength(), and ilSettingsTemplateConfig\TEXT.

Referenced by addSettingsTemplate(), editSettingsTemplate(), saveSettingsTemplate(), and updateSettingsTemplate().

{
global $lng, $ilCtrl;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
// title
$ti = new ilTextInputGUI($lng->txt("title"), "title");
$ti->setMaxLength(200);
$ti->setRequired(true);
$this->form->addItem($ti);
// description
$ti = new ilTextAreaInputGUI($lng->txt("description"), "description");
$this->form->addItem($ti);
// hidable tabs
$tabs = $this->getConfig()->getHidableTabs();
if (is_array($tabs) && count($tabs) > 0)
{
$sec = new ilFormSectionHeaderGUI();
$sec->setTitle($lng->txt("adm_hide_tabs"));
$this->form->addItem($sec);
foreach($tabs as $t)
{
// hide tab $t?
$cb = new ilCheckboxInputGUI($t["text"], "tab_".$t["id"]);
$this->form->addItem($cb);
}
}
// settings
$settings = $this->getConfig()->getSettings();
if (is_array($settings) && count($settings) > 0)
{
$sec = new ilFormSectionHeaderGUI();
$sec->setTitle($lng->txt("adm_predefined_settings"));
$this->form->addItem($sec);
foreach($settings as $s)
{
// setting
$cb = new ilCheckboxInputGUI($s["text"], "set_".$s["id"]);
$this->form->addItem($cb);
switch ($s["type"])
{
$ti = new ilTextInputGUI($lng->txt("adm_value"), "value_".$s["id"]);
//$ti->setMaxLength();
//$ti->setSize();
$cb->addSubItem($ti);
break;
$cb2 = new ilCheckboxInputGUI($lng->txt("adm_value"), "value_".$s["id"]);
$cb->addSubItem($cb2);
break;
$si = new ilSelectInputGUI($lng->txt("adm_value"), "value_".$s["id"]);
$si->setOptions($s["options"]);
$cb->addSubItem($si);
break;
$chbs = new ilCheckboxGroupInputGUI($lng->txt("adm_value"), "value_".$s["id"]);
foreach($s['options'] as $key => $value) {
$chbs->addOption($c = new ilCheckboxInputGUI($value, $key));
$c->setValue($key);
}
$cb->addSubItem($chbs);
break;
}
if ($s['hidable']) {
// hide setting
$cb_hide = new ilCheckboxInputGUI($lng->txt("adm_hide"), "hide_".$s["id"]);
$cb->addSubItem($cb_hide);
}
}
}
// save and cancel commands
if ($a_mode == "create")
{
$this->form->addCommandButton("saveSettingsTemplate", $lng->txt("save"));
$this->form->addCommandButton("listSettingsTemplates", $lng->txt("cancel"));
$this->form->setTitle($lng->txt("adm_add_settings_template"));
}
else
{
$this->form->addCommandButton("updateSettingsTemplate", $lng->txt("save"));
$this->form->addCommandButton("listSettingsTemplates", $lng->txt("cancel"));
$this->form->setTitle($lng->txt("adm_edit_settings_template"));
}
$this->form->setFormAction($ilCtrl->getFormAction($this));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSettingsTemplateGUI::listSettingsTemplates ( )

List all settings template.

Parameters
@return

Definition at line 87 of file class.ilSettingsTemplateGUI.php.

References $ilCtrl, $lng, $tpl, and getConfig().

{
global $tpl, $ilToolbar, $ilCtrl, $lng;
$ilToolbar->addButton($lng->txt("adm_add_settings_template"),
$ilCtrl->getLinkTarget($this, "addSettingsTemplate"));
include_once("./Services/Administration/classes/class.ilSettingsTemplateTableGUI.php");
$table = new ilSettingsTemplateTableGUI($this, "listSettingsTemplates",
$this->getConfig()->getType());
$tpl->setContent($table->getHTML());
}

+ Here is the call graph for this function:

ilSettingsTemplateGUI::readSettingsTemplate ( )

Read settings template.

Parameters
@return

Definition at line 71 of file class.ilSettingsTemplateGUI.php.

References $_GET, and getConfig().

Referenced by __construct().

{
if ($this->getConfig()) {
$this->settings_template = new ilSettingsTemplate((int) $_GET[templ_id], $this->getConfig());
}
else {
$this->settings_template = new ilSettingsTemplate((int) $_GET[templ_id]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSettingsTemplateGUI::saveSettingsTemplate ( )

Save settings template form.

Definition at line 277 of file class.ilSettingsTemplateGUI.php.

References $ilCtrl, $lng, $tpl, getConfig(), initSettingsTemplateForm(), ilUtil\sendSuccess(), and setValuesFromForm().

{
global $tpl, $lng, $ilCtrl;
$this->initSettingsTemplateForm("create");
if ($this->form->checkInput())
{
$settings_template = new ilSettingsTemplate();
$settings_template->setType($this->getConfig()->getType());
$this->setValuesFromForm($settings_template);
$settings_template->create();
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$ilCtrl->redirect($this, "listSettingsTemplates");
}
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHtml());
}

+ Here is the call graph for this function:

ilSettingsTemplateGUI::setConfig (   $a_val)

Set config object.

Parameters
object$a_valconfig object

Definition at line 50 of file class.ilSettingsTemplateGUI.php.

Referenced by __construct().

{
$this->config = $a_val;
}

+ Here is the caller graph for this function:

ilSettingsTemplateGUI::setValuesFromForm (   $a_set_templ)

Set values from form.

Parameters
@return

Definition at line 325 of file class.ilSettingsTemplateGUI.php.

References $_POST, $t, and getConfig().

Referenced by saveSettingsTemplate(), and updateSettingsTemplate().

{
// perform update
$a_set_templ->setTitle($_POST["title"]);
$a_set_templ->setDescription($_POST["description"]);
// save tabs to be hidden
$a_set_templ->removeAllHiddenTabs();
foreach ($this->getConfig()->getHidableTabs() as $t)
{
if ($_POST["tab_".$t["id"]])
{
$a_set_templ->addHiddenTab($t["id"]);
}
}
// save settings values
$a_set_templ->removeAllSettings();
foreach($this->getConfig()->getSettings() as $s)
{
if ($_POST["set_".$s["id"]])
{
$a_set_templ->setSetting(
$s["id"], $_POST["value_".$s["id"]],
$_POST["hide_".$s["id"]]);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSettingsTemplateGUI::updateSettingsTemplate ( )

Update settings template.

Definition at line 301 of file class.ilSettingsTemplateGUI.php.

References $ilCtrl, $lng, $tpl, initSettingsTemplateForm(), ilUtil\sendSuccess(), and setValuesFromForm().

{
global $lng, $ilCtrl, $tpl;
$this->initSettingsTemplateForm("edit");
if ($this->form->checkInput())
{
$this->setValuesFromForm($this->settings_template);
$this->settings_template->update();
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$ilCtrl->redirect($this, "listSettingsTemplates");
}
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHtml());
}

+ Here is the call graph for this function:

Field Documentation

ilSettingsTemplateGUI::$config
private

Definition at line 15 of file class.ilSettingsTemplateGUI.php.

Referenced by getConfig().


The documentation for this class was generated from the following file: