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",
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)) {
65 return $ilSetting->get(
'block_default_setting_' .
$a_type .
'_' . $a_setting,
false);
67 self::$setting[
$key] =
false;
115 $ilDB = $DIC->database();
118 if (!self::$pd_preloaded) {
119 $blocks = array(
"pdbookm",
"pdcal",
"pdfeedb",
"pditems",
120 "pdmail",
"pdnews",
"pdnotes",
"pdsysmess",
"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",
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)",
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) {
250 $ilDB = $DIC->database();
253 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE user_id = " .
254 $ilDB->quote($a_user,
"integer"));
266 $ilDB = $DIC->database();
268 if ($a_block_id > 0) {
269 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE block_id = " .
270 $ilDB->quote($a_block_id,
"integer") .
271 " AND type = " .
$ilDB->quote($a_block_type,
"text"));
286 $db = $DIC->database();
289 "SELECT * FROM il_block_setting " .
290 " WHERE block_id = %s AND type = %s AND user_id = %s",
291 array(
"integer",
"text",
"integer"),
292 array($block_id, $block_type, 0)
294 while ($rec = $db->fetchAssoc($set)) {
295 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 _lookupNr($a_type, $a_user=0, $a_block_id=0)
Lookup number.
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.