3 declare(strict_types=1);
45 $ilDB = $DIC->database();
48 $key = $a_type .
":" . $a_setting .
":" . $a_user .
":" . $a_block_id;
49 if (isset(self::$setting[
$key])) {
50 return (
string) self::$setting[
$key];
53 $set =
$ilDB->query(sprintf(
54 "SELECT value FROM il_block_setting WHERE type = %s " .
55 "AND user_id = %s AND setting = %s AND block_id = %s",
56 $ilDB->quote($a_type,
"text"),
57 $ilDB->quote($a_user,
"integer"),
58 $ilDB->quote($a_setting,
"text"),
59 $ilDB->quote($a_block_id,
"integer")
61 if ($rec =
$ilDB->fetchAssoc($set)) {
62 self::$setting[
$key] = $rec[
"value"];
64 } elseif (
$ilSetting->get(
'block_default_setting_' . $a_type .
'_' . $a_setting, null)) {
65 self::$setting[
$key] =
$ilSetting->get(
'block_default_setting_' . $a_type .
'_' . $a_setting, null);
66 return $ilSetting->get(
'block_default_setting_' . $a_type .
'_' . $a_setting, null);
68 self::$setting[
$key] =
false;
80 $ilDB = $DIC->database();
83 if (!self::$pd_preloaded) {
84 $blocks = array(
"pdbookm",
"pdcal",
"pdfeedb",
"pditems",
85 "pdmail",
"pdnews",
"pdnotes",
"pdtag");
86 $settings = array(
"detail",
"nr",
"side");
89 foreach ($blocks as
$b) {
91 $key = $b .
":" . $s .
":" . $user_id .
":0";
93 self::$setting[
$key] = 2;
95 self::$setting[
$key] =
false;
101 $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") .
106 while ($rec =
$ilDB->fetchAssoc($set)) {
107 $key = $rec[
"type"] .
":" . $rec[
"setting"] .
":" . $user_id .
":0";
108 self::$setting[
$key] = $rec[
"value"];
111 self::$pd_preloaded =
true;
127 $ilDB = $DIC->database();
129 $ilDB->manipulate(sprintf(
130 "DELETE FROM il_block_setting WHERE type = %s AND user_id = %s AND block_id = %s AND setting = %s",
131 $ilDB->quote($a_type,
"text"),
132 $ilDB->quote($a_user,
"integer"),
133 $ilDB->quote($a_block_id,
"integer"),
134 $ilDB->quote($a_setting,
"text")
136 $ilDB->manipulate(sprintf(
137 "INSERT INTO il_block_setting (type, user_id, setting, block_id, value) VALUES (%s,%s,%s,%s,%s)",
138 $ilDB->quote($a_type,
"text"),
139 $ilDB->quote($a_user,
"integer"),
140 $ilDB->quote($a_setting,
"text"),
141 $ilDB->quote($a_block_id,
"integer"),
142 $ilDB->quote($a_value,
"text")
154 $detail = self::_lookup($a_type,
"detail", $a_user, $a_block_id);
156 if (is_null($detail)) {
160 return (
int) $detail;
206 $ilDB = $DIC->database();
209 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE user_id = " .
210 $ilDB->quote($a_user,
"integer"));
220 $ilDB = $DIC->database();
222 if ($a_block_id > 0) {
223 $ilDB->manipulate(
"DELETE FROM il_block_setting WHERE block_id = " .
224 $ilDB->quote($a_block_id,
"integer") .
225 " AND type = " .
$ilDB->quote($a_block_type,
"text"));
236 $db = $DIC->database();
239 "SELECT * FROM il_block_setting " .
240 " WHERE block_id = %s AND type = %s AND user_id = %s",
241 array(
"integer",
"text",
"integer"),
242 array($block_id, $block_type, 0)
244 while ($rec = $db->fetchAssoc($set)) {
245 self::_write($block_type, (
string) $rec[
"setting"], (
string) $rec[
"value"], 0, $new_block_id);
static bool $pd_preloaded
static _deleteSettingsOfUser(int $a_user)
static _lookupDetailLevel(string $a_type, int $a_user=0, int $a_block_id=0)
Lookup detail level.
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
static _writeNumber(string $a_type, string $a_value, int $a_user=0, int $a_block_id=0)
static _writeDetailLevel(string $a_type, string $a_value, int $a_user=0, int $a_block_id=0)
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
static _deleteSettingsOfBlock(int $a_block_id, string $a_block_type)
static cloneSettingsOfBlock(string $block_type, int $block_id, int $new_block_id)
static _writeSide(string $a_type, string $a_value, int $a_user=0, int $a_block_id=0)
static preloadPDBlockSettings()
Preload pd info.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupSide(string $a_type, int $a_user=0, int $a_block_id=0)
Lookup side.