ILIAS  Release_3_10_x_branch Revision 61812
 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.
 get ($a_keyword, $a_default_value=false)
 get setting
 deleteAll ()
 Delete all settings of a current module.
 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

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 15697 2008-01-08 20:04:33Z hschottm

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

Member Function Documentation

ilSetting::delete (   $a_keyword)

delete one value from settingstable public

Parameters
stringkeyword
Returns
string value

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

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

Delete all settings of a current module.

public

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

{
global $ilDB;
$query = "DELETE FROM settings WHERE module = ".$ilDB->quote($this->module)." ";
$ilDB->query($query);
$this->settings = array();
return true;
}
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 71 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 129 of file class.ilSetting.php.

References $setting.

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

Initialise Settings.

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

References $res, and DB_FETCHMODE_ASSOC.

{
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.");
}
$query = "SELECT * FROM settings WHERE module=" . $ilDB->quote($this->module);
$res = $ilDB->query($query);
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$this->setting[$row["keyword"]] = $row["value"];
}
}
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 141 of file class.ilSetting.php.

{
global $ilDB;
$sql = "DELETE FROM settings WHERE keyword=".$ilDB->quote($a_key).
" AND module=" . $ilDB->quote($this->module);
$ilDB->query($sql);
$sql = "INSERT INTO settings (module, keyword, value) VALUES (".
$ilDB->quote($this->module) . ",".$ilDB->quote($a_key).",".$ilDB->quote($a_val).")";
$ilDB->query($sql);
$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: