60 public function __construct($a_module =
"common", $a_disabled_cache =
false)
64 $this->db = $DIC->database();
65 $ilDB = $DIC->database();
67 $this->cache_disabled = $a_disabled_cache;
68 $this->module = $a_module;
70 if (!is_object(
$ilDB)) {
71 die(
"Fatal Error: ilSettings object instantiated without DB initialisation.");
95 if (!$this->cache_disabled) {
96 if (isset(self::$settings_cache[$this->module])) {
100 $this->setting =
array();
105 $query =
"SELECT * FROM settings WHERE module=" .
$ilDB->quote($this->module,
"text");
109 $this->setting[
$row[
"keyword"]] = $row[
"value"];
123 public function get($a_keyword, $a_default_value =
false)
125 if ($a_keyword ==
"ilias_version") {
129 if (isset($this->setting[$a_keyword])) {
130 return $this->setting[$a_keyword];
132 return $a_default_value;
146 $query =
"DELETE FROM settings WHERE module = " .
$ilDB->quote($this->module,
"text");
149 $this->setting =
array();
164 $query =
"SELECT keyword FROM settings" .
165 " WHERE module = " .
$ilDB->quote($this->module,
"text") .
166 " AND " .
$ilDB->like(
"keyword",
"text", $a_like);
169 $this->
delete(
$row[
"keyword"]);
181 public function delete($a_keyword)
185 $st =
$ilDB->manipulate(
"DELETE FROM settings WHERE keyword = " .
186 $ilDB->quote($a_keyword,
"text") .
" AND module = " .
187 $ilDB->quote($this->module,
"text"));
189 unset($this->setting[$a_keyword]);
213 public function set($a_key, $a_val)
220 $this->
delete($a_key);
222 if (!isset(self::$value_type)) {
223 self::$value_type = self::_getValueType();
226 if (self::$value_type ==
'text' and strlen($a_val) >= 4000) {
228 $a_val = substr($a_val, 0, 4000);
232 "module" =>
array(
"text", $this->module),
233 "keyword" =>
array(
"text", $a_key),
234 "value" =>
array(self::$value_type, $a_val)));
236 $this->setting[$a_key] = $a_val;
245 $ilDB->query(
"UPDATE sahs_lm SET debug = 'n'");
255 $ilDB = $DIC->database();
257 $query =
"SELECT value FROM settings WHERE module = %s AND keyword = %s";
260 return $data[
'value'];
271 include_once(
'./Services/Database/classes/class.ilDBAnalyzer.php');
273 $info = $analyzer->getFieldInformation(
'settings');
275 if (
$info[
'value'][
'type'] ==
'clob') {
293 $ilDB = $DIC->database();
295 $old_type = self::_getValueType();
297 if ($a_new_type == $old_type) {
299 } elseif ($a_new_type ==
'clob') {
300 $ilDB->addTableColumn(
303 array(
"type" =>
"clob",
308 $ilDB->query(
"UPDATE settings SET value2 = value");
309 $ilDB->dropTableColumn(
'settings',
'value');
310 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
313 } elseif ($a_new_type ==
'text') {
314 $ilDB->addTableColumn(
317 array(
"type" =>
"text",
323 $ilDB->query(
"UPDATE settings SET value2 = value");
324 $ilDB->dropTableColumn(
'settings',
'value');
325 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
344 $ilDB = $DIC->database();
348 $query =
"SELECT * FROM settings WHERE LENGTH(value) > " 349 .
$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)
foreach($_POST as $key=> $value) $res
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.