ILIAS  Release_5_0_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.
 setAutoGenerated ($a_status)
 Set auto generated status.
 getAutoGenerated ()
 Get auto generated status.
 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, $a_include_auto_generated=false)
 Get all settings templates of type.
static lookupTitle ($a_id)
 Lookup title.
static lookupDescription ($a_id)
 Lookup title.
static translate ($a_title_desc)

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()
 $auto_generated = false
 $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 35 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 204 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 290 of file class.ilSettingsTemplate.php.

References $ilDB, getAutoGenerated(), 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()),
// begin-patch lok
"description" => array("clob", $this->getDescription()),
'auto_generated' => array('integer',$this->getAutoGenerated())
// end-patch lok
));
// 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 385 of file class.ilSettingsTemplate.php.

References $ilDB.

{
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,
  $a_include_auto_generated = false 
)
static

Get all settings templates of type.

Parameters
string$a_typeobject type

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

References $ilDB.

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

{
global $ilDB;
// begin-patch lok
if($a_include_auto_generated)
{
$set = $ilDB->query("SELECT * FROM adm_settings_template ".
" WHERE type = ".$ilDB->quote($a_type, "text").
" ORDER BY title");
}
else
{
$set = $ilDB->query("SELECT * FROM adm_settings_template ".
" WHERE type = ".$ilDB->quote($a_type, "text").
'AND auto_generated = '.$ilDB->quote(0,'integer').' '.
" ORDER BY title");
}
// end-patch lok
$settings_template = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$settings_template[] = $rec;
}
return $settings_template;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::getAutoGenerated ( )

Get auto generated status.

Returns
type

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

References $auto_generated.

Referenced by create(), and update().

{
}

+ 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 231 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 141 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 220 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 61 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 193 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 101 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 121 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 368 of file class.ilSettingsTemplate.php.

References $ilDB, and 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 349 of file class.ilSettingsTemplate.php.

References $ilDB, and 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::lookupDescription (   $a_id)
static

Lookup title.

Parameters
@return

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

References lookupProperty().

{
return self::lookupProperty($a_id, 'description');
}

+ Here is the call graph for this function:

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

Lookup property.

Parameters
idlevel id
Returns
mixed property value

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

References $ilDB.

Referenced by lookupDescription(), and 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 458 of file class.ilSettingsTemplate.php.

References lookupProperty().

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

{
return self::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 251 of file class.ilSettingsTemplate.php.

References $ilDB, addHiddenTab(), setAutoGenerated(), 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"]);
// begin-patch lok
$this->setAutoGenerated($rec['auto_generated']);
// end-patch lok
// 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 212 of file class.ilSettingsTemplate.php.

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

Remove all settings.

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

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

Remove setting.

Parameters
stringsetting

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

{
unset($this->setting[$a_setting]);
}
ilSettingsTemplate::setAutoGenerated (   $a_status)

Set auto generated status.

Parameters
type$a_status

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

Referenced by read().

{
$this->auto_generated = $a_status;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::setConfig ( ilSettingsTemplateConfig  $config)

Sets the template config for this template.

Parameters
ilSettingsTemplateConfig$config

Definition at line 240 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 131 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 51 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 153 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 91 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 111 of file class.ilSettingsTemplate.php.

Referenced by read().

{
$this->type = $a_val;
}

+ Here is the caller graph for this function:

static ilSettingsTemplate::translate (   $a_title_desc)
static

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

References $GLOBALS.

Referenced by ilSettingsTemplateTableGUI\fillRow().

{
if(substr($a_title_desc, 0, 3) == 'il_')
{
return $GLOBALS['lng']->txt($a_title_desc);
}
return $a_title_desc;
}

+ Here is the caller graph for this function:

ilSettingsTemplate::update ( )

Update settings template.

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

References $ilDB, getAutoGenerated(), 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()),
// begin-patch lok
"description" => array("clob", $this->getDescription()),
'auto_generated' => array('integer',$this->getAutoGenerated())
), 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::$auto_generated = false
private

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

Referenced by getAutoGenerated().

ilSettingsTemplate::$config
private

Definition at line 28 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: