40 public static function _lookup($a_type, $a_setting, $a_user = 0, $a_block_id = 0)
44 $ilDB = $DIC->database();
47 $key = $a_type .
":" . $a_setting .
":" . $a_user .
":" . $a_block_id;
48 if (isset(self::$setting[$key])) {
49 return self::$setting[$key];
52 $set =
$ilDB->query(sprintf(
53 "SELECT value FROM il_block_setting WHERE type = %s " .
54 "AND user_id = %s AND setting = %s AND block_id = %s",
55 $ilDB->quote($a_type,
"text"),
56 $ilDB->quote($a_user,
"integer"),
57 $ilDB->quote($a_setting,
"text"),
58 $ilDB->quote($a_block_id,
"integer")
60 if ($rec =
$ilDB->fetchAssoc($set)) {
61 self::$setting[$key] = $rec[
"value"];
63 } elseif (
$ilSetting->get(
'block_default_setting_' . $a_type .
'_' . $a_setting,
false)) {
64 self::$setting[$key] =
$ilSetting->get(
'block_default_setting_' . $a_type .
'_' . $a_setting,
false);
65 return $ilSetting->get(
'block_default_setting_' . $a_type .
'_' . $a_setting,
false);
67 self::$setting[$key] =
false;
86 $ilSetting->set(
'block_default_setting_' . $a_type .
'_' . $a_setting, $a_value);
102 $ilSetting->delete(
'block_default_setting_' . $a_type .
'_' . $a_setting);
115 $ilDB = $DIC->database();
118 if (!self::$pd_preloaded) {
119 $blocks = array(
"pdbookm",
"pdcal",
"pdfeedb",
"pditems",
120 "pdmail",
"pdnews",
"pdnotes",
"pdtag");
121 $settings = array(
"detail",
"nr",
"side");
124 foreach ($blocks as
$b) {
125 foreach ($settings as $s) {
126 $key = $b .
":" . $s .
":" . $user_id .
":0";
127 if ($s ==
"detail") {
128 self::$setting[$key] = 2;
130 self::$setting[$key] =
false;
136 $q =
"SELECT type, setting, value FROM il_block_setting WHERE " .
137 " user_id = " .
$ilDB->quote($user_id,
"integer") .
138 " AND " .
$ilDB->in(
"type", $blocks,
false,
"text") .
139 " AND " .
$ilDB->in(
"setting", $settings,
false,
"text")
141 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;
154 public static function _write($a_type, $a_setting, $a_value, $a_user = 0, $a_block_id = 0)
158 $ilDB = $DIC->database();
160 $ilDB->manipulate(sprintf(
161 "DELETE FROM il_block_setting WHERE type = %s AND user_id = %s AND block_id = %s AND setting = %s",
162 $ilDB->quote($a_type,
"text"),
163 $ilDB->quote($a_user,
"integer"),
164 $ilDB->quote((
int) $a_block_id,
"integer"),
165 $ilDB->quote($a_setting,
"text")
167 $ilDB->manipulate(sprintf(
168 "INSERT INTO il_block_setting (type, user_id, setting, block_id, value) VALUES (%s,%s,%s,%s,%s)",
169 $ilDB->quote($a_type,
"text"),
170 $ilDB->quote($a_user,
"integer"),
171 $ilDB->quote($a_setting,
"text"),
172 $ilDB->quote((
int) $a_block_id,
"integer"),
173 $ilDB->quote($a_value,
"text")
185 if ($detail ===
false) {
206 public static function _writeNumber($a_type, $a_value, $a_user = 0, $a_block_id = 0)
215 public static function _lookupSide($a_type, $a_user = 0, $a_block_id = 0)
226 public static function _writeSide($a_type, $a_value, $a_user = 0, $a_block_id = 0)
239 $ilDB = $DIC->database();
242 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE user_id = " .
243 $ilDB->quote($a_user,
"integer"));
255 $ilDB = $DIC->database();
257 if ($a_block_id > 0) {
258 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE block_id = " .
259 $ilDB->quote($a_block_id,
"integer") .
260 " AND type = " .
$ilDB->quote($a_block_type,
"text"));
275 $db = $DIC->database();
278 "SELECT * FROM il_block_setting " .
279 " WHERE block_id = %s AND type = %s AND user_id = %s",
280 array(
"integer",
"text",
"integer"),
281 array($block_id, $block_type, 0)
283 while ($rec = $db->fetchAssoc($set)) {
284 self::_write($block_type, $rec[
"setting"], $rec[
"value"], 0, $new_block_id);
static _setDefaultSetting($a_type, $a_setting, $a_value)
Sets a default setting for a block.
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
static _writeDetailLevel($a_type, $a_value, $a_user=0, $a_block_id=0)
Write detail level to database.
static _deleteSettingsOfUser($a_user)
Delete block settings of user.
static _writeSide($a_type, $a_value, $a_user=0, $a_block_id=0)
Write side to database.
static _lookupDetailLevel($a_type, $a_user=0, $a_block_id=0)
Lookup detail level.
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
static _deleteSettingsOfBlock($a_block_id, $a_block_type)
Delete block settings of block.
static cloneSettingsOfBlock(string $block_type, int $block_id, int $new_block_id)
Clone block settings.
static _lookupSide($a_type, $a_user=0, $a_block_id=0)
Lookup side.
static preloadPDBlockSettings()
Preload pd info.
static _unsetDefaultSetting($a_type, $a_setting)
Unsets a default setting for a block.
static _writeNumber($a_type, $a_value, $a_user=0, $a_block_id=0)
Write number to database.