ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilBlockSetting Class Reference

Block Setting class. More...

+ Collaboration diagram for ilBlockSetting:

Static Public Member Functions

static _lookup ($a_type, $a_setting, $a_user=0, $a_block_id=0)
 Lookup setting from database. More...
 
static _setDefaultSetting ($a_type, $a_setting, $a_value)
 Sets a default setting for a block. More...
 
static _unsetDefaultSetting ($a_type, $a_setting)
 Unsets a default setting for a block. More...
 
static preloadPDBlockSettings ()
 Preload pd info. More...
 
static _write ($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
 Write setting to database. More...
 
static _lookupDetailLevel ($a_type, $a_user=0, $a_block_id=0)
 Lookup detail level. More...
 
static _writeDetailLevel ($a_type, $a_value, $a_user=0, $a_block_id=0)
 Write detail level to database. More...
 
static _writeNumber ($a_type, $a_value, $a_user=0, $a_block_id=0)
 Write number to database. More...
 
static _lookupSide ($a_type, $a_user=0, $a_block_id=0)
 Lookup side. More...
 
static _writeSide ($a_type, $a_value, $a_user=0, $a_block_id=0)
 Write side to database. More...
 
static _deleteSettingsOfUser ($a_user)
 Delete block settings of user. More...
 
static _deleteSettingsOfBlock ($a_block_id, $a_block_type)
 Delete block settings of block. More...
 
static cloneSettingsOfBlock (string $block_type, int $block_id, int $new_block_id)
 Clone block settings. More...
 

Static Public Attributes

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

Detailed Description

Block Setting class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ _deleteSettingsOfBlock()

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

Delete block settings of block.

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

252 {
253 global $DIC;
254
255 $ilDB = $DIC->database();
256
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"));
261 }
262 }
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, and $ilDB.

Referenced by ilObjExternalFeed\delete().

+ Here is the caller graph for this function:

◆ _deleteSettingsOfUser()

static ilBlockSetting::_deleteSettingsOfUser (   $a_user)
static

Delete block settings of user.

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

236 {
237 global $DIC;
238
239 $ilDB = $DIC->database();
240
241 if ($a_user > 0) {
242 $ilDB->manipulate("DELETE FROM il_block_setting WHERE user_id = " .
243 $ilDB->quote($a_user, "integer"));
244 }
245 }

References $DIC, and $ilDB.

Referenced by ilObjUser\delete().

+ Here is the caller graph for this function:

◆ _lookup()

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

Lookup setting from database.

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

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

References $a_type, $DIC, $ilDB, and $ilSetting.

Referenced by ilObjectFeedWriter\__construct(), ilNewsItem\_getDefaultVisibilityForRefId(), _lookupDetailLevel(), _lookupSide(), ilNewsItem\_lookupUserPDPeriod(), ilNewsForContextBlockGUI\addToSettingsForm(), ilNewsForContextTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilObjMediaCastGUI\getFeedIconsHTML(), ilNewsForContextBlockGUI\getHTML(), ilNewsItem\getNewsForRefId(), ilNewsForContextBlockGUI\handleView(), ilContainerNewsSettingsGUI\initForm(), ilObjMediaCastGUI\initSettingsForm(), ilNewsForContextBlockGUI\initSettingsForm(), ilNewsItem\queryNewsForContext(), ilNewsItem\queryNewsForMultipleContexts(), ilMediaCastDataSet\readData(), ilNewsDataSet\readData(), and ilNewsForContextBlockGUI\showNews().

+ Here is the caller graph for this function:

◆ _lookupDetailLevel()

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

Lookup detail level.

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

182 {
183 $detail = ilBlockSetting::_lookup($a_type, "detail", $a_user, $a_block_id);
184
185 if ($detail === false) { // return a level of 2 (standard value)
186 // if record does not exist
187 return 2;
188 } else {
189 return $detail;
190 }
191 }
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.

References $a_type, and _lookup().

Referenced by ilColumnGUI\showBlocks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupSide()

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

Lookup side.

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

216 {
217 $side = ilBlockSetting::_lookup($a_type, "side", $a_user, $a_block_id);
218
219 return $side;
220 }

References $a_type, and _lookup().

Referenced by ilColumnGUI\determineBlocks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _setDefaultSetting()

static ilBlockSetting::_setDefaultSetting (   $a_type,
  $a_setting,
  $a_value 
)
static

Sets a default setting for a block.

@global ilSetting $ilSetting

Parameters
string$a_type
string$a_setting
mixed$a_value

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

82 {
83 global $DIC;
84
85 $ilSetting = $DIC->settings();
86 $ilSetting->set('block_default_setting_' . $a_type . '_' . $a_setting, $a_value);
87 }

References $a_type, $DIC, and $ilSetting.

◆ _unsetDefaultSetting()

static ilBlockSetting::_unsetDefaultSetting (   $a_type,
  $a_setting 
)
static

Unsets a default setting for a block.

@global ilSetting $ilSetting

Parameters
string$a_type
string$a_setting

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

98 {
99 global $DIC;
100
101 $ilSetting = $DIC->settings();
102 $ilSetting->delete('block_default_setting_' . $a_type . '_' . $a_setting);
103 }

References $a_type, $DIC, and $ilSetting.

◆ _write()

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

Write setting to database.

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

155 {
156 global $DIC;
157
158 $ilDB = $DIC->database();
159
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")
166 ));
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")
174 ));
175 }

References $a_type, $DIC, and $ilDB.

Referenced by _writeDetailLevel(), _writeNumber(), _writeSide(), cloneSettingsOfBlock(), ilObjFile\createProperties(), ilObjForum\createSettings(), ilNewsForContextBlockGUI\hideNotifications(), ilMediaCastDataSet\importRecord(), ilNewsDataSet\importRecord(), ilNewsForContextBlockGUI\saveSettings(), ilPDNewsBlockGUI\saveSettings(), ilObjMediaCastGUI\saveSettingsObject(), ilNewsForContextBlockGUI\showNotifications(), and ilNewsForContextBlockGUI\writeSettings().

+ Here is the caller graph for this function:

◆ _writeDetailLevel()

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

Write detail level to database.

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

198 {
199 ilBlockSetting::_write($a_type, "detail", $a_value, $a_user, $a_block_id);
200 }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.

References $a_type, and _write().

Referenced by ilColumnGUI\activateBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _writeNumber()

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

Write number to database.

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

207 {
208 ilBlockSetting::_write($a_type, "nr", $a_value, $a_user, $a_block_id);
209 }

References $a_type, and _write().

+ Here is the call graph for this function:

◆ _writeSide()

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

Write side to database.

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

227 {
228 ilBlockSetting::_write($a_type, "side", $a_value, $a_user, $a_block_id);
229 }

References $a_type, and _write().

+ Here is the call graph for this function:

◆ cloneSettingsOfBlock()

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

Clone block settings.

Parameters
string$block_type
int$block_id
int$new_block_id

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

272 {
273 global $DIC;
274
275 $db = $DIC->database();
276
277 $set = $db->queryF(
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)
282 );
283 while ($rec = $db->fetchAssoc($set)) {
284 self::_write($block_type, $rec["setting"], $rec["value"], 0, $new_block_id);
285 }
286 }

References $DIC, and _write().

+ Here is the call graph for this function:

◆ preloadPDBlockSettings()

static ilBlockSetting::preloadPDBlockSettings ( )
static

Preload pd info.

Parameters

return

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

112 {
113 global $DIC;
114
115 $ilDB = $DIC->database();
116 $ilUser = $DIC->user();
117
118 if (!self::$pd_preloaded) {
119 $blocks = array("pdbookm", "pdcal", "pdfeedb", "pditems",
120 "pdmail", "pdnews", "pdnotes", "pdtag");
121 $settings = array("detail", "nr", "side");
122 $user_id = $ilUser->getId();
123
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;
129 } else {
130 self::$setting[$key] = false;
131 }
132 }
133 }
134
135 $set = $ilDB->query(
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")
140 );
141 while ($rec = $ilDB->fetchAssoc($set)) {
142 $key = $rec["type"] . ":" . $rec["setting"] . ":" . $user_id . ":0";
143 self::$setting[$key] = $rec["value"];
144 }
145
146 self::$pd_preloaded = true;
147 }
148 }
$ilUser
Definition: imgupload.php:18

References Vendor\Package\$b, $DIC, $ilDB, and $ilUser.

Field Documentation

◆ $pd_preloaded

ilBlockSetting::$pd_preloaded = false
static

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

◆ $setting

ilBlockSetting::$setting = array()
static

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


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