55 function __construct($a_module =
"common", $a_disabled_cache =
false)
59 $this->cache_disabled = $a_disabled_cache;
60 $this->module = $a_module;
62 if (!is_object($ilDB))
64 die (
"Fatal Error: ilSettings object instantiated without DB initialisation.");
88 if (!$this->cache_disabled)
90 if (isset(self::$settings_cache[$this->module]))
97 $this->setting =
array();
102 $query =
"SELECT * FROM settings WHERE module=".$ilDB->quote($this->module,
"text");
105 while (
$row = $ilDB->fetchAssoc(
$res))
107 $this->setting[
$row[
"keyword"]] = $row[
"value"];
122 function get($a_keyword, $a_default_value =
false)
124 if ($a_keyword ==
"ilias_version")
129 if (isset($this->setting[$a_keyword]))
131 return $this->setting[$a_keyword];
135 return $a_default_value;
149 $query =
"DELETE FROM settings WHERE module = ".$ilDB->quote($this->module,
"text");
150 $ilDB->manipulate(
$query);
152 $this->setting =
array();
167 $query =
"SELECT keyword FROM settings".
168 " WHERE module = ".$ilDB->quote($this->module,
"text").
169 " AND ".$ilDB->like(
"keyword",
"text", $a_like);
171 while(
$row = $ilDB->fetchAssoc(
$res))
173 $this->
delete(
$row[
"keyword"]);
185 function delete($a_keyword)
189 $st = $ilDB->manipulate(
"DELETE FROM settings WHERE keyword = ".
190 $ilDB->quote($a_keyword,
"text").
" AND module = ".
191 $ilDB->quote($this->module,
"text"));
193 unset($this->setting[$a_keyword]);
217 function set($a_key, $a_val)
221 $this->
delete($a_key);
223 if (!isset(self::$value_type))
225 self::$value_type = self::_getValueType();
228 if (self::$value_type ==
'text' and strlen($a_val) >= 4000)
231 $a_val = substr($a_val, 0, 4000);
234 $ilDB->insert(
"settings",
array(
235 "module" =>
array(
"text", $this->module),
236 "keyword" =>
array(
"text", $a_key),
237 "value" =>
array(self::$value_type, $a_val)));
239 $this->setting[$a_key] = $a_val;
248 $ilDB->query(
"UPDATE sahs_lm SET debug = 'n'");
258 $query =
"SELECT value FROM settings WHERE module = %s AND keyword = %s";
261 return $data[
'value'];
272 include_once (
'./Services/Database/classes/class.ilDBAnalyzer.php');
274 $info = $analyzer->getFieldInformation(
'settings');
276 if (
$info[
'value'][
'type'] ==
'clob')
297 $old_type = self::_getValueType();
299 if ($a_new_type == $old_type)
303 elseif ($a_new_type ==
'clob')
305 $ilDB->addTableColumn(
'settings',
'value2',
306 array(
"type" =>
"clob",
310 $ilDB->query(
"UPDATE settings SET value2 = value");
311 $ilDB->dropTableColumn(
'settings',
'value');
312 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
316 elseif ($a_new_type ==
'text')
318 $ilDB->addTableColumn(
'settings',
'value2',
319 array(
"type" =>
"text",
324 $ilDB->query(
"UPDATE settings SET value2 = value");
325 $ilDB->dropTableColumn(
'settings',
'value');
326 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
349 $query =
"SELECT * FROM settings WHERE LENGTH(value) > " 350 . $ilDB->quote($a_limit,
'integer');
set($a_key, $a_val)
write one value to db-table settings public
setScormDebug($a_key, $a_val)
static _getLongerSettings($a_limit='4000')
get a list of setting records with values loger than a limit
static _changeValueType($a_new_type='text')
change the type of the value column in the database
static _getValueType()
Get the type of the value column in the database.
__construct($a_module="common", $a_disabled_cache=false)
Initialize settings.
getAll()
read all values from settingstable public
static $settings_cache
cache for the read settings ilSetting is instantiated more than once per request for some modules The...
static _lookupValue($a_module, $a_keyword)
read()
Read settings data.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
deleteAll()
Delete all settings of a current module.
This class gives all kind of DB information using the MDB2 manager and reverse module.
getModule()
Get currernt module.
static $value_type
the type of settings value field in database This is determined in the set method to get a correct DB...
deleteLike($a_like)
Delete all settings corresponding to a like string.