40 public static function _lookup($a_type, $a_setting, $a_user = 0, $a_block_id = 0)
44 $key = $a_type.
":".$a_setting.
":".$a_user.
":".$a_block_id;
45 if (isset(self::$setting[$key]))
47 return self::$setting[$key];
50 $set = $ilDB->query(sprintf(
"SELECT value FROM il_block_setting WHERE type = %s ".
51 "AND user_id = %s AND setting = %s AND block_id = %s",
52 $ilDB->quote($a_type,
"text"),
53 $ilDB->quote($a_user,
"integer"),
54 $ilDB->quote($a_setting,
"text"),
55 $ilDB->quote($a_block_id,
"integer")));
56 if ($rec = $ilDB->fetchAssoc($set))
58 self::$setting[$key] = $rec[
"value"];
61 else if ($ilSetting->get(
'block_default_setting_'.$a_type.
'_'.$a_setting,
false))
63 self::$setting[$key] = $ilSetting->get(
'block_default_setting_'.$a_type.
'_'.$a_setting,
false);
64 return $ilSetting->get(
'block_default_setting_'.$a_type.
'_'.$a_setting,
false);
68 self::$setting[$key] =
false;
85 $ilSetting->set(
'block_default_setting_'.$a_type.
'_'.$a_setting, $a_value);
99 $ilSetting->delete(
'block_default_setting_'.$a_type.
'_'.$a_setting);
112 if (!self::$pd_preloaded)
114 $blocks = array(
"pdbookm",
"pdcal",
"pdfeedb",
"pditems",
115 "pdmail",
"pdnews",
"pdnotes",
"pdsysmess",
"pdtag",
"pdusers");
116 $settings = array(
"detail",
"nr",
"side");
117 $user_id = $ilUser->getId();
119 foreach ($blocks as $b)
121 foreach ($settings as $s)
123 $key = $b.
":".$s.
":".$user_id.
":0";
126 self::$setting[$key] = 2;
130 self::$setting[$key] =
false;
135 $set = $ilDB->query($q =
"SELECT type, setting, value FROM il_block_setting WHERE ".
136 " user_id = ".$ilDB->quote($user_id,
"integer").
137 " AND ".$ilDB->in(
"type", $blocks,
false,
"text").
138 " AND ".$ilDB->in(
"setting", $settings,
false,
"text")
140 while ($rec = $ilDB->fetchAssoc($set))
142 $key = $rec[
"type"].
":".$rec[
"setting"].
":".$user_id.
":0";
143 self::$setting[$key] = $rec[
"value"];
146 self::$pd_preloaded =
true;
155 public static function _write($a_type, $a_setting, $a_value, $a_user = 0, $a_block_id = 0)
159 $ilDB->manipulate(sprintf(
"DELETE FROM il_block_setting WHERE type = %s AND user_id = %s AND block_id = %s AND setting = %s",
160 $ilDB->quote($a_type,
"text"),
161 $ilDB->quote($a_user,
"integer"),
162 $ilDB->quote((
int) $a_block_id,
"integer"),
163 $ilDB->quote($a_setting,
"text")));
164 $ilDB->manipulate(sprintf(
"INSERT INTO il_block_setting (type, user_id, setting, block_id, value) VALUES (%s,%s,%s,%s,%s)",
165 $ilDB->quote($a_type,
"text"),
166 $ilDB->quote($a_user,
"integer"),
167 $ilDB->quote($a_setting,
"text"),
168 $ilDB->quote((
int) $a_block_id,
"integer"),
169 $ilDB->quote($a_value,
"text")));
180 if ($detail ===
false)
203 public static function _lookupNr($a_type, $a_user = 0, $a_block_id = 0)
214 public static function _writeNumber($a_type, $a_value, $a_user = 0, $a_block_id = 0)
223 public static function _lookupSide($a_type, $a_user = 0, $a_block_id = 0)
234 public static function _writeSide($a_type, $a_value, $a_user = 0, $a_block_id = 0)
249 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE user_id = ".
250 $ilDB->quote($a_user,
"integer"));
264 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE block_id = ".
265 $ilDB->quote($a_block_id,
"integer").
266 " AND type = ".$ilDB->quote($a_block_type,
"text"));