ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBlockSetting Class Reference

Block Setting class. More...

+ Collaboration diagram for ilBlockSetting:

Static Public Member Functions

static _lookup (string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
 Lookup setting from database. More...
 
static preloadPDBlockSettings ()
 Preload pd info. More...
 
static _write (string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
 Write setting to database. More...
 
static _lookupDetailLevel (string $a_type, int $a_user=0, int $a_block_id=0)
 Lookup detail level. More...
 
static _writeDetailLevel (string $a_type, string $a_value, int $a_user=0, int $a_block_id=0)
 
static _writeNumber (string $a_type, string $a_value, int $a_user=0, int $a_block_id=0)
 
static _lookupSide (string $a_type, int $a_user=0, int $a_block_id=0)
 Lookup side. More...
 
static _writeSide (string $a_type, string $a_value, int $a_user=0, int $a_block_id=0)
 
static _deleteSettingsOfUser (int $a_user)
 
static _deleteSettingsOfBlock (int $a_block_id, string $a_block_type)
 
static cloneSettingsOfBlock (string $block_type, int $block_id, int $new_block_id)
 

Static Public Attributes

static array $setting = array()
 
static bool $pd_preloaded = false
 

Detailed Description

Block Setting class.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilBlockSetting.php.

Member Function Documentation

◆ _deleteSettingsOfBlock()

static ilBlockSetting::_deleteSettingsOfBlock ( int  $a_block_id,
string  $a_block_type 
)
static

Definition at line 214 of file class.ilBlockSetting.php.

217 : void {
218 global $DIC;
219
220 $ilDB = $DIC->database();
221
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"));
226 }
227 }
global $DIC
Definition: shib_login.php:26

References $ilDB.

Referenced by ilObject\delete().

+ Here is the caller graph for this function:

◆ _deleteSettingsOfUser()

static ilBlockSetting::_deleteSettingsOfUser ( int  $a_user)
static

Definition at line 201 of file class.ilBlockSetting.php.

203 : void {
204 global $DIC;
205
206 $ilDB = $DIC->database();
207
208 if ($a_user > 0) {
209 $ilDB->manipulate("DELETE FROM il_block_setting WHERE user_id = " .
210 $ilDB->quote($a_user, "integer"));
211 }
212 }

References $ilDB.

Referenced by ilObjUser\delete().

+ Here is the caller graph for this function:

◆ _lookup()

static ilBlockSetting::_lookup ( string  $a_type,
string  $a_setting,
int  $a_user = 0,
int  $a_block_id = 0 
)
static

Lookup setting from database.

Definition at line 37 of file class.ilBlockSetting.php.

42 : ?string {
43 global $DIC;
44
45 $ilDB = $DIC->database();
46 $ilSetting = $DIC->settings();
47
48 $key = $a_type . ":" . $a_setting . ":" . $a_user . ":" . $a_block_id;
49 if (isset(self::$setting[$key])) {
50 return (string) self::$setting[$key];
51 }
52
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")
60 ));
61 if ($rec = $ilDB->fetchAssoc($set)) {
62 self::$setting[$key] = $rec["value"];
63 return $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);
67 } else {
68 self::$setting[$key] = false;
69 return null;
70 }
71 }
global $ilSetting
Definition: privfeed.php:31

Referenced by ilObjectFeedWriter\__construct(), ilNewsItem\_getDefaultVisibilityForRefId(), ilNewsItem\_lookupUserPDPeriod(), ilNewsForContextBlockGUI\addToSettingsForm(), ilNewsForContextTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ILIAS\MediaCast\Settings\SettingsGUI\getEditForm(), ilObjMediaCastGUI\getFeedLink(), ilNewsForContextBlockGUI\getHTML(), ilNewsForContextBlockGUI\handleView(), ilContainerNewsSettingsGUI\initForm(), ilNewsForContextBlockGUI\initSettingsForm(), ilMediaCastDataSet\readData(), ilNewsDataSet\readData(), and ilNewsForContextBlockGUI\showNews().

+ Here is the caller graph for this function:

◆ _lookupDetailLevel()

static ilBlockSetting::_lookupDetailLevel ( string  $a_type,
int  $a_user = 0,
int  $a_block_id = 0 
)
static

Lookup detail level.

Definition at line 149 of file class.ilBlockSetting.php.

153 : int {
154 $detail = self::_lookup($a_type, "detail", $a_user, $a_block_id);
155
156 if (is_null($detail)) { // return a level of 2 (standard value) if record does not exist
157 return 2;
158 }
159
160 return (int) $detail;
161 }
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.

◆ _lookupSide()

static ilBlockSetting::_lookupSide ( string  $a_type,
int  $a_user = 0,
int  $a_block_id = 0 
)
static

Lookup side.

Definition at line 184 of file class.ilBlockSetting.php.

188 : ?string {
189 return ilBlockSetting::_lookup($a_type, "side", $a_user, $a_block_id);
190 }

Referenced by ilColumnGUI\determineBlocks().

+ Here is the caller graph for this function:

◆ _write()

static ilBlockSetting::_write ( string  $a_type,
string  $a_setting,
string  $a_value,
int  $a_user = 0,
int  $a_block_id = 0 
)
static

Write setting to database.

Definition at line 118 of file class.ilBlockSetting.php.

124 : void {
125 global $DIC;
126
127 $ilDB = $DIC->database();
128
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")
135 ));
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")
143 ));
144 }

Referenced by createProperties(), ilObjForum\createSettings(), ilNewsForContextBlockGUI\hideNotifications(), ilMediaCastDataSet\importRecord(), ilNewsDataSet\importRecord(), ILIAS\MediaCast\Settings\SettingsGUI\save(), ILIAS\MediaPool\Settings\SettingsGUI\save(), ilNewsForContextBlockGUI\saveSettings(), ilPDNewsBlockGUI\saveSettings(), ilNewsForContextBlockGUI\showNotifications(), and ilNewsForContextBlockGUI\writeSettings().

+ Here is the caller graph for this function:

◆ _writeDetailLevel()

static ilBlockSetting::_writeDetailLevel ( string  $a_type,
string  $a_value,
int  $a_user = 0,
int  $a_block_id = 0 
)
static

Definition at line 163 of file class.ilBlockSetting.php.

168 : void {
169 ilBlockSetting::_write($a_type, "detail", $a_value, $a_user, $a_block_id);
170 }
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.

Referenced by ilColumnGUI\activateBlock().

+ Here is the caller graph for this function:

◆ _writeNumber()

static ilBlockSetting::_writeNumber ( string  $a_type,
string  $a_value,
int  $a_user = 0,
int  $a_block_id = 0 
)
static

Definition at line 172 of file class.ilBlockSetting.php.

177 : void {
178 ilBlockSetting::_write($a_type, "nr", $a_value, $a_user, $a_block_id);
179 }

◆ _writeSide()

static ilBlockSetting::_writeSide ( string  $a_type,
string  $a_value,
int  $a_user = 0,
int  $a_block_id = 0 
)
static

Definition at line 192 of file class.ilBlockSetting.php.

197 : void {
198 ilBlockSetting::_write($a_type, "side", $a_value, $a_user, $a_block_id);
199 }

◆ cloneSettingsOfBlock()

static ilBlockSetting::cloneSettingsOfBlock ( string  $block_type,
int  $block_id,
int  $new_block_id 
)
static

Definition at line 229 of file class.ilBlockSetting.php.

233 : void {
234 global $DIC;
235
236 $db = $DIC->database();
237
238 $set = $db->queryF(
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)
243 );
244 while ($rec = $db->fetchAssoc($set)) {
245 self::_write($block_type, (string) $rec["setting"], (string) $rec["value"], 0, $new_block_id);
246 }
247 }

◆ preloadPDBlockSettings()

static ilBlockSetting::preloadPDBlockSettings ( )
static

Preload pd info.

Definition at line 76 of file class.ilBlockSetting.php.

76 : void
77 {
78 global $DIC;
79
80 $ilDB = $DIC->database();
81 $ilUser = $DIC->user();
82
83 if (!self::$pd_preloaded) {
84 $blocks = array("pdbookm", "pdcal", "pdfeedb", "pditems",
85 "pdmail", "pdnews", "pdnotes", "pdtag");
86 $settings = array("detail", "nr", "side");
87 $user_id = $ilUser->getId();
88
89 foreach ($blocks as $b) {
90 foreach ($settings as $s) {
91 $key = $b . ":" . $s . ":" . $user_id . ":0";
92 if ($s == "detail") {
93 self::$setting[$key] = 2;
94 } else {
95 self::$setting[$key] = false;
96 }
97 }
98 }
99
100 $set = $ilDB->query(
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") .
104 " AND " . $ilDB->in("setting", $settings, false, "text")
105 );
106 while ($rec = $ilDB->fetchAssoc($set)) {
107 $key = $rec["type"] . ":" . $rec["setting"] . ":" . $user_id . ":0";
108 self::$setting[$key] = $rec["value"];
109 }
110
111 self::$pd_preloaded = true;
112 }
113 }
$q
Definition: shib_logout.php:23

References Vendor\Package\$b, $DIC, $ilDB, $q, and $user_id.

Referenced by ilDashboardGUI\show().

+ Here is the caller graph for this function:

Field Documentation

◆ $pd_preloaded

bool ilBlockSetting::$pd_preloaded = false
static

Definition at line 32 of file class.ilBlockSetting.php.

◆ $setting

array ilBlockSetting::$setting = array()
static

Definition at line 31 of file class.ilBlockSetting.php.


The documentation for this class was generated from the following file: