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

Settings template application class. More...

+ Collaboration diagram for ilSettingsTemplate:

Public Member Functions

 __construct ($a_id=0, $config=null)
 Constructor.
 setId ($a_val)
 Set id.
 getId ()
 Get id.
 setTitle ($a_val)
 Set title.
 getTitle ()
 Get title.
 setType ($a_val)
 Set type.
 getType ()
 Get type.
 setDescription ($a_val)
 Set description.
 getDescription ()
 Get description.
 setSetting ($a_setting, $a_value, $a_hide=false)
 Set setting.
 removeSetting ($a_setting)
 Remove setting.
 removeAllSettings ()
 Remove all settings.
 getSettings ()
 Get settings.
 addHiddenTab ($a_tab_id)
 Add hidden tab.
 removeAllHiddenTabs ()
 Remove all hidden tabs.
 getHiddenTabs ()
 Get hidden tabs.
 getConfig ()
 Returns the template config associated with this template or NULL if none is given.
 setConfig (ilSettingsTemplateConfig $config)
 Sets the template config for this template.
 read ()
 Read.
 create ()
 Create settings template.
 update ()
 Update settings template.
 insertHiddenTabs ()
 Insert hidden tabs.
 delete ()
 Delete settings template.

Static Public Member Functions

static getAllSettingsTemplates ($a_type)
 Get all settings templates of type.
static lookupTitle ($a_id)
 Lookup title.

Static Protected Member Functions

static lookupProperty ($a_id, $a_prop)
 Lookup property.

Private Member Functions

 insertSettings ()
 Insert settings to db.

Private Attributes

 $id
 $type
 $title
 $description
 $setting = array()
 $hidden_tab = array()
 $config

Detailed Description

Settings template application class.

Author
Alex Killing <alex.killing>
Version
$Id$

Definition at line 11 of file class.ilSettingsTemplate.php.

Constructor & Destructor Documentation

ilSettingsTemplate::__construct (   $a_id = 0,
  $config = null 
)

Constructor.

Parameters

Definition at line 31 of file class.ilSettingsTemplate.php.

References $config, read(), setConfig(), and setId().

{
if ($a_id > 0)
{
if ($config)
$this->setConfig($config);
$this->setId($a_id);
$this->read();
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilSettingsTemplate::addHiddenTab (   $a_tab_id)

Add hidden tab.

Parameters
stringtab id
Returns

Definition at line 180 of file class.ilSettingsTemplate.php.

Referenced by read().

{
$this->hidden_tab[$a_tab_id] = $a_tab_id;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::create ( )

Create settings template.

Definition at line 263 of file class.ilSettingsTemplate.php.

References getDescription(), getId(), getTitle(), getType(), insertHiddenTabs(), insertSettings(), and setId().

{
global $ilDB;
$this->setId($ilDB->nextId("adm_settings_template"));
// write template
$ilDB->insert("adm_settings_template", array(
"id" => array("integer", $this->getId()),
"title" => array("text", $this->getTitle()),
"type" => array("text", $this->getType()),
"description" => array("clob", $this->getDescription())
));
// write settings
$this->insertSettings();
// write hidden tabs
$this->insertHiddenTabs();
}

+ Here is the call graph for this function:

ilSettingsTemplate::delete ( )

Delete settings template.

Definition at line 353 of file class.ilSettingsTemplate.php.

{
global $ilDB;
$ilDB->manipulate("DELETE FROM adm_settings_template WHERE "
." id = ".$ilDB->quote($this->getId(), "integer")
);
$ilDB->manipulate("DELETE FROM adm_set_templ_value WHERE "
." template_id = ".$ilDB->quote($this->getId(), "integer")
);
$ilDB->manipulate("DELETE FROM adm_set_templ_hide_tab WHERE "
." template_id = ".$ilDB->quote($this->getId(), "integer")
);
}
static ilSettingsTemplate::getAllSettingsTemplates (   $a_type)
static

Get all settings templates of type.

Parameters
string$a_typeobject type

Definition at line 373 of file class.ilSettingsTemplate.php.

Referenced by ilSettingsTemplateTableGUI\__construct(), ilObjSurveyGUI\addDidacticTemplateOptions(), ilObjTestGUI\addDidacticTemplateOptions(), and ilObjSurveyGUI\importFileObject().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM adm_settings_template ".
" WHERE type = ".$ilDB->quote($a_type, "text").
" ORDER BY title");
$settings_template = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$settings_template[] = $rec;
}
return $settings_template;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::getConfig ( )

Returns the template config associated with this template or NULL if none is given.

Returns
ilSettingsTemplateConfig

Definition at line 207 of file class.ilSettingsTemplate.php.

References $config.

Referenced by setSetting().

{
return $this->config;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::getDescription ( )

Get description.

Returns
string description

Definition at line 117 of file class.ilSettingsTemplate.php.

References $description.

Referenced by create(), and update().

{
}

+ Here is the caller graph for this function:

ilSettingsTemplate::getHiddenTabs ( )

Get hidden tabs.

Definition at line 196 of file class.ilSettingsTemplate.php.

References $hidden_tab.

Referenced by insertHiddenTabs().

{
}

+ Here is the caller graph for this function:

ilSettingsTemplate::getId ( )

Get id.

Returns
integer id

Definition at line 57 of file class.ilSettingsTemplate.php.

References $id.

Referenced by create(), and update().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::getSettings ( )

Get settings.

Definition at line 169 of file class.ilSettingsTemplate.php.

References $setting.

Referenced by insertSettings().

{
}

+ Here is the caller graph for this function:

ilSettingsTemplate::getTitle ( )

Get title.

Returns
string title

Definition at line 77 of file class.ilSettingsTemplate.php.

References $title.

Referenced by create(), and update().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::getType ( )

Get type.

Returns
string type

Definition at line 97 of file class.ilSettingsTemplate.php.

References $type.

Referenced by create(), and update().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::insertHiddenTabs ( )

Insert hidden tabs.

Definition at line 336 of file class.ilSettingsTemplate.php.

References getHiddenTabs().

Referenced by create(), and update().

{
global $ilDB;
foreach ($this->getHiddenTabs() as $tab_id)
{
$ilDB->manipulate("INSERT INTO adm_set_templ_hide_tab ".
"(template_id, tab_id) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($tab_id, "text").
")");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSettingsTemplate::insertSettings ( )
private

Insert settings to db.

Definition at line 317 of file class.ilSettingsTemplate.php.

References getSettings().

Referenced by create(), and update().

{
global $ilDB;
foreach ($this->getSettings() as $s => $set)
{
$ilDB->manipulate("INSERT INTO adm_set_templ_value ".
"(template_id, setting, value, hide) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($s, "text").",".
$ilDB->quote($set["value"], "text").",".
$ilDB->quote($set["hide"], "integer").
")");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSettingsTemplate::lookupProperty (   $a_id,
  $a_prop 
)
staticprotected

Lookup property.

Parameters
idlevel id
Returns
mixed property value

Definition at line 396 of file class.ilSettingsTemplate.php.

Referenced by lookupTitle().

{
global $ilDB;
$set = $ilDB->query("SELECT $a_prop FROM adm_settings_template WHERE ".
" id = ".$ilDB->quote($a_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
return $rec[$a_prop];
}

+ Here is the caller graph for this function:

static ilSettingsTemplate::lookupTitle (   $a_id)
static

Lookup title.

Parameters
@return

Definition at line 413 of file class.ilSettingsTemplate.php.

References lookupProperty().

Referenced by ilSettingsTemplateGUI\confirmSettingsTemplateDeletion(), and ilObjSurveyGUI\propertiesObject().

{
return ilSettingsTemplate::lookupProperty($a_id, "title");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSettingsTemplate::read ( )

Read.

Parameters
@return

Definition at line 227 of file class.ilSettingsTemplate.php.

References addHiddenTab(), setDescription(), setSetting(), setTitle(), and setType().

Referenced by __construct().

{
global $ilDB;
// read template
$set = $ilDB->query("SELECT * FROM adm_settings_template WHERE ".
" id = ".$ilDB->quote($this->getId(), "integer")
);
$rec = $ilDB->fetchAssoc($set);
$this->setTitle($rec["title"]);
$this->setType($rec["type"]);
$this->setDescription($rec["description"]);
// read template setttings
$set = $ilDB->query("SELECT * FROM adm_set_templ_value WHERE ".
" template_id = ".$ilDB->quote($this->getId(), "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
$this->setSetting($rec["setting"],
$rec["value"], $rec["hide"]);
}
// read hidden tabs
$set = $ilDB->query("SELECT * FROM adm_set_templ_hide_tab WHERE ".
" template_id = ".$ilDB->quote($this->getId(), "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
$this->addHiddenTab($rec["tab_id"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSettingsTemplate::removeAllHiddenTabs ( )

Remove all hidden tabs.

Definition at line 188 of file class.ilSettingsTemplate.php.

{
$this->hidden_tab = array();
}
ilSettingsTemplate::removeAllSettings ( )

Remove all settings.

Definition at line 161 of file class.ilSettingsTemplate.php.

{
$this->setting = array();
}
ilSettingsTemplate::removeSetting (   $a_setting)

Remove setting.

Parameters
stringsetting

Definition at line 153 of file class.ilSettingsTemplate.php.

{
unset($this->setting[$a_setting]);
}
ilSettingsTemplate::setConfig ( ilSettingsTemplateConfig  $config)

Sets the template config for this template.

Parameters
ilSettingsTemplateConfig$config

Definition at line 216 of file class.ilSettingsTemplate.php.

References $config.

Referenced by __construct().

{
$this->config = $config;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::setDescription (   $a_val)

Set description.

Parameters
string$a_valdescription

Definition at line 107 of file class.ilSettingsTemplate.php.

Referenced by read().

{
$this->description = $a_val;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::setId (   $a_val)

Set id.

Parameters
integerid

Definition at line 47 of file class.ilSettingsTemplate.php.

Referenced by __construct(), and create().

{
$this->id = $a_val;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::setSetting (   $a_setting,
  $a_value,
  $a_hide = false 
)

Set setting.

Parameters
stringsetting
mixedvalue
booleanhide the setting?

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

References ilSettingsTemplateConfig\CHECKBOX, and getConfig().

Referenced by read().

{
if ($this->getConfig()) {
$settings = $this->getConfig()->getSettings();
if ($settings[$a_setting]['type'] == ilSettingsTemplateConfig::CHECKBOX) {
if (is_array($a_value))
$a_value = serialize($a_value);
else
$a_value = unserialize($a_value);
}
}
$this->setting[$a_setting] = array(
"value" => $a_value,
"hide" => $a_hide
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSettingsTemplate::setTitle (   $a_val)

Set title.

Parameters
stringtitle

Definition at line 67 of file class.ilSettingsTemplate.php.

Referenced by read().

{
$this->title = $a_val;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::setType (   $a_val)

Set type.

Parameters
string$a_valtype

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

Referenced by read().

{
$this->type = $a_val;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::update ( )

Update settings template.

Definition at line 287 of file class.ilSettingsTemplate.php.

References getDescription(), getId(), getTitle(), getType(), insertHiddenTabs(), and insertSettings().

{
global $ilDB;
// update template
$ilDB->update("adm_settings_template", array(
"title" => array("text", $this->getTitle()),
"type" => array("text", $this->getType()),
"description" => array("clob", $this->getDescription())
), array(
"id" => array("integer", $this->getId()),
));
// delete settings and hidden tabs
$ilDB->manipulate("DELETE FROM adm_set_templ_value WHERE "
." template_id = ".$ilDB->quote($this->getId(), "integer")
);
$ilDB->manipulate("DELETE FROM adm_set_templ_hide_tab WHERE "
." template_id = ".$ilDB->quote($this->getId(), "integer")
);
// insert settings and hidden tabs
$this->insertSettings();
$this->insertHiddenTabs();
}

+ Here is the call graph for this function:

Field Documentation

ilSettingsTemplate::$config
private

Definition at line 24 of file class.ilSettingsTemplate.php.

Referenced by __construct(), getConfig(), and setConfig().

ilSettingsTemplate::$description
private

Definition at line 16 of file class.ilSettingsTemplate.php.

Referenced by getDescription().

ilSettingsTemplate::$hidden_tab = array()
private

Definition at line 18 of file class.ilSettingsTemplate.php.

Referenced by getHiddenTabs().

ilSettingsTemplate::$id
private

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

Referenced by getId().

ilSettingsTemplate::$setting = array()
private

Definition at line 17 of file class.ilSettingsTemplate.php.

Referenced by getSettings().

ilSettingsTemplate::$title
private

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

Referenced by getTitle().

ilSettingsTemplate::$type
private

Definition at line 14 of file class.ilSettingsTemplate.php.

Referenced by getType().


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