ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSetting Class Reference

ILIAS Setting Class. More...

+ Collaboration diagram for ilSetting:

Public Member Functions

 ilSetting ($a_module="common")
 Initialise Settings.
 read ()
 Read settings data.
 get ($a_keyword, $a_default_value=false)
 get setting
 deleteAll ()
 Delete all settings of a current module.
 deleteLike ($a_like)
 Delete all settings corresponding to a like string.
 delete ($a_keyword)
 delete one value from settingstable public
 getAll ()
 read all values from settingstable public
 set ($a_key, $a_val)
 write one value to db-table settings public

Static Public Member Functions

static _lookupValue ($a_module, $a_keyword)

Data Fields

 $setting = array()
 $module = ""

Detailed Description

ILIAS Setting Class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@d.nosp@m.atab.nosp@m.ay.de
Version
Id:
class.ilSetting.php 22951 2010-02-11 14:40:16Z mjansen

Definition at line 32 of file class.ilSetting.php.

Member Function Documentation

static ilSetting::_lookupValue (   $a_module,
  $a_keyword 
)
static

Definition at line 192 of file class.ilSetting.php.

References $data, $ilDB, $query, and $res.

Referenced by ilObjSAHSLearningModuleAccess\_lookupCertificate().

{
global $ilDB;
$query = "SELECT value FROM settings WHERE module = %s AND keyword = %s";
$res = $ilDB->queryF($query, array('text', 'text'), array($a_module, $a_keyword));
$data = $ilDB->fetchAssoc($res);
return $data['value'];
}

+ Here is the caller graph for this function:

ilSetting::delete (   $a_keyword)

delete one value from settingstable public

Parameters
stringkeyword
Returns
string value

Definition at line 140 of file class.ilSetting.php.

References $ilDB.

{
global $ilDB;
$st = $ilDB->manipulate("DELETE FROM settings WHERE keyword = ".
$ilDB->quote($a_keyword, "text")." AND module = ".
$ilDB->quote($this->module, "text"));
unset($this->setting[$a_keyword]);
return true;
}
ilSetting::deleteAll ( )

Delete all settings of a current module.

public

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

References $ilDB, and $query.

{
global $ilDB;
$query = "DELETE FROM settings WHERE module = ".$ilDB->quote($this->module, "text");
$ilDB->manipulate($query);
$this->setting = array();
return true;
}
ilSetting::deleteLike (   $a_like)

Delete all settings corresponding to a like string.

public

Definition at line 122 of file class.ilSetting.php.

References $ilDB, $query, and read().

{
global $ilDB;
$query = "DELETE FROM settings WHERE module = ".$ilDB->quote($this->module, "text").
" AND ".$ilDB->like("keyword", "text", $a_like);
$ilDB->manipulate($query);
$this->read();
return true;
}

+ Here is the call graph for this function:

ilSetting::get (   $a_keyword,
  $a_default_value = false 
)

get setting

public

Parameters
stringkeyword
stringdefault_value This value is returned, when no setting has been found for the keyword.
Returns
string value

Definition at line 81 of file class.ilSetting.php.

References ILIAS_VERSION.

{
if ($a_keyword == "ilias_version")
{
return ILIAS_VERSION;
}
if (isset($this->setting[$a_keyword]))
{
return $this->setting[$a_keyword];
}
else
{
return $a_default_value;
}
}
ilSetting::getAll ( )

read all values from settingstable public

Returns
array keyword/value pairs

Definition at line 160 of file class.ilSetting.php.

References $setting.

{
}
ilSetting::ilSetting (   $a_module = "common")

Initialise Settings.

Definition at line 40 of file class.ilSetting.php.

References $ilDB, and read().

{
global $ilDB;
$this->module = $a_module;
// check whether ini file object exists
if (!is_object($ilDB))
{
die ("Fatal Error: ilSettings object instantiated without DB initialisation.");
}
$this->read();
}

+ Here is the call graph for this function:

ilSetting::read ( )

Read settings data.

Definition at line 56 of file class.ilSetting.php.

References $ilDB, $query, $res, and $row.

Referenced by deleteLike(), and ilSetting().

{
global $ilDB;
$this->setting = array();
$query = "SELECT * FROM settings WHERE module=".$ilDB->quote($this->module, "text");
$res = $ilDB->query($query);
while ($row = $ilDB->fetchAssoc($res))
{
$this->setting[$row["keyword"]] = $row["value"];
}
}

+ Here is the caller graph for this function:

ilSetting::set (   $a_key,
  $a_val 
)

write one value to db-table settings public

Parameters
stringkeyword
stringvalue
Returns
boolean true on success

Definition at line 172 of file class.ilSetting.php.

References $ilDB.

{
global $ilDB;
$this->delete($a_key);
/*$sql = "INSERT INTO settings (module, keyword, value) VALUES (".
$ilDB->quote($this->module, "text") .
",".$ilDB->quote($a_key, "text").",".$ilDB->quote((string) $a_val, "clob").")";
$ilDB->manipulate($sql);*/
$ilDB->insert("settings", array(
"module" => array("text", $this->module),
"keyword" => array("text", $a_key),
"value" => array("clob", $a_val)));
$this->setting[$a_key] = $a_val;
return true;
}

Field Documentation

ilSetting::$module = ""

Definition at line 35 of file class.ilSetting.php.

ilSetting::$setting = array()

Definition at line 34 of file class.ilSetting.php.

Referenced by getAll().


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