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"];
63 self::$setting[$key] =
false;
76 global
$ilDB, $ilUser;
78 if (!self::$pd_preloaded)
80 $blocks = array(
"pdbookm",
"pdcal",
"pdfeedb",
"pditems",
81 "pdmail",
"pdnews",
"pdnotes",
"pdsysmess",
"pdtag",
"pdusers");
82 $settings = array(
"detail",
"nr",
"side");
83 $user_id = $ilUser->getId();
85 foreach ($blocks as $b)
87 foreach ($settings as $s)
89 $key = $b.
":".$s.
":".$user_id.
":0";
92 self::$setting[$key] = 2;
96 self::$setting[$key] =
false;
101 $set = $ilDB->query($q =
"SELECT type, setting, value FROM il_block_setting WHERE ".
102 " user_id = ".$ilDB->quote($user_id,
"integer").
103 " AND ".$ilDB->in(
"type", $blocks,
false,
"text").
104 " AND ".$ilDB->in(
"setting", $settings,
false,
"text")
106 while ($rec = $ilDB->fetchAssoc($set))
108 $key = $rec[
"type"].
":".$rec[
"setting"].
":".$user_id.
":0";
109 self::$setting[$key] = $rec[
"value"];
112 self::$pd_preloaded =
true;
121 public static function _write($a_type, $a_setting, $a_value, $a_user = 0, $a_block_id = 0)
125 $ilDB->manipulate(sprintf(
"DELETE FROM il_block_setting WHERE type = %s AND user_id = %s AND block_id = %s AND setting = %s",
126 $ilDB->quote($a_type,
"text"),
127 $ilDB->quote($a_user,
"integer"),
128 $ilDB->quote((
int) $a_block_id,
"integer"),
129 $ilDB->quote($a_setting,
"text")));
130 $ilDB->manipulate(sprintf(
"INSERT INTO il_block_setting (type, user_id, setting, block_id, value) VALUES (%s,%s,%s,%s,%s)",
131 $ilDB->quote($a_type,
"text"),
132 $ilDB->quote($a_user,
"integer"),
133 $ilDB->quote($a_setting,
"text"),
134 $ilDB->quote((
int) $a_block_id,
"integer"),
135 $ilDB->quote($a_value,
"text")));
146 if ($detail ===
false)
169 public static function _lookupNr($a_type, $a_user = 0, $a_block_id = 0)
180 public static function _writeNumber($a_type, $a_value, $a_user = 0, $a_block_id = 0)
189 public static function _lookupSide($a_type, $a_user = 0, $a_block_id = 0)
200 public static function _writeSide($a_type, $a_value, $a_user = 0, $a_block_id = 0)
215 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE user_id = ".
216 $ilDB->quote($a_user,
"integer"));
230 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE block_id = ".
231 $ilDB->quote($a_block_id,
"integer").
232 " AND type = ".$ilDB->quote($a_block_type,
"text"));