ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 _lookupNr ($a_type, $a_user=0, $a_block_id=0)
 Lookup number. 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 262 of file class.ilBlockSetting.php.

References $DIC, and $ilDB.

Referenced by ilObject\countReferences(), and ilObjExternalFeed\delete().

263  {
264  global $DIC;
265 
266  $ilDB = $DIC->database();
267 
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"));
272  }
273  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _deleteSettingsOfUser()

static ilBlockSetting::_deleteSettingsOfUser (   $a_user)
static

Delete block settings of user.

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

References $DIC, and $ilDB.

Referenced by ilObjUser\delete().

247  {
248  global $DIC;
249 
250  $ilDB = $DIC->database();
251 
252  if ($a_user > 0) {
253  $ilDB->manipulate("DELETE FROM il_block_setting WHERE user_id = " .
254  $ilDB->quote($a_user, "integer"));
255  }
256  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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.

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

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

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 $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
global $ilSetting
Definition: privfeed.php:17
global $ilDB
$key
Definition: croninfo.php:18
+ 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.

References $a_type, and _lookup().

Referenced by ilBlockGUI\handleDetailLevel(), and ilColumnGUI\showBlocks().

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  }
$a_type
Definition: workflow.php:92
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupNr()

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

Lookup number.

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

References $a_type, and _lookup().

Referenced by ilColumnGUI\determineBlocks().

207  {
208  $nr = ilBlockSetting::_lookup($a_type, "nr", $a_user, $a_block_id);
209 
210  return $nr;
211  }
$a_type
Definition: workflow.php:92
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
+ 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 226 of file class.ilBlockSetting.php.

References $a_type, and _lookup().

Referenced by ilColumnGUI\determineBlocks().

227  {
228  $side = ilBlockSetting::_lookup($a_type, "side", $a_user, $a_block_id);
229 
230  return $side;
231  }
$a_type
Definition: workflow.php:92
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
+ 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.

ilSetting $ilSetting

Parameters
string$a_type
string$a_setting
mixed$a_value

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

References $a_type, $DIC, and $ilSetting.

82  {
83  global $DIC;
84 
85  $ilSetting = $DIC->settings();
86  $ilSetting->set('block_default_setting_' . $a_type . '_' . $a_setting, $a_value);
87  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
global $ilSetting
Definition: privfeed.php:17

◆ _unsetDefaultSetting()

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

Unsets a default setting for a block.

ilSetting $ilSetting

Parameters
string$a_type
string$a_setting

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

References $a_type, $DIC, and $ilSetting.

98  {
99  global $DIC;
100 
101  $ilSetting = $DIC->settings();
102  $ilSetting->delete('block_default_setting_' . $a_type . '_' . $a_setting);
103  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
global $ilSetting
Definition: privfeed.php:17

◆ _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.

References $a_type, $DIC, and $ilDB.

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

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  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
global $ilDB
+ 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.

References $a_type, and _write().

Referenced by ilColumnGUI\activateBlock(), and ilBlockGUI\handleDetailLevel().

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.
$a_type
Definition: workflow.php:92
+ 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 217 of file class.ilBlockSetting.php.

References $a_type, and _write().

Referenced by ilColumnGUI\exceededLimit().

218  {
219  ilBlockSetting::_write($a_type, "nr", $a_value, $a_user, $a_block_id);
220  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:
+ Here is the caller 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 237 of file class.ilBlockSetting.php.

References $a_type, and _write().

Referenced by ilColumnGUI\exceededLimit().

238  {
239  ilBlockSetting::_write($a_type, "side", $a_value, $a_user, $a_block_id);
240  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:
+ Here is the caller 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 282 of file class.ilBlockSetting.php.

References $DIC.

Referenced by ilContainer\_exportContainerSettings().

283  {
284  global $DIC;
285 
286  $db = $DIC->database();
287 
288  $set = $db->queryF(
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)
293  );
294  while ($rec = $db->fetchAssoc($set)) {
295  self::_write($block_type, $rec["setting"], $rec["value"], 0, $new_block_id);
296  }
297  }
global $DIC
Definition: saml.php:7
+ Here is the caller graph for this function:

◆ preloadPDBlockSettings()

static ilBlockSetting::preloadPDBlockSettings ( )
static

Preload pd info.

Parameters

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

References $DIC, $ilDB, $ilUser, $key, and $s.

Referenced by ilPersonalDesktopGUI\getStandardTemplates().

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", "pdsysmess", "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  }
global $DIC
Definition: saml.php:7
$s
Definition: pwgen.php:45
$ilUser
Definition: imgupload.php:18
global $ilDB
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

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: