ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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 258 of file class.ilBlockSetting.php.

References $ilDB.

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

259  {
260  global $ilDB;
261 
262  if ($a_block_id > 0)
263  {
264  $ilDB->manipulate("DELETE FROM il_block_setting WHERE block_id = ".
265  $ilDB->quote($a_block_id, "integer").
266  " AND type = ".$ilDB->quote($a_block_type, "text"));
267  }
268  }
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 243 of file class.ilBlockSetting.php.

References $ilDB.

Referenced by ilObjUser\delete().

244  {
245  global $ilDB;
246 
247  if ($a_user > 0)
248  {
249  $ilDB->manipulate("DELETE FROM il_block_setting WHERE user_id = ".
250  $ilDB->quote($a_user, "integer"));
251  }
252  }
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, $ilDB, and $ilSetting.

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

41  {
42  global $ilDB, $ilSetting;
43 
44  $key = $a_type.":".$a_setting.":".$a_user.":".$a_block_id;
45  if (isset(self::$setting[$key]))
46  {
47  return self::$setting[$key];
48  }
49 
50  $set = $ilDB->query(sprintf("SELECT value FROM il_block_setting WHERE type = %s ".
51  "AND user_id = %s AND setting = %s AND block_id = %s",
52  $ilDB->quote($a_type, "text"),
53  $ilDB->quote($a_user, "integer"),
54  $ilDB->quote($a_setting, "text"),
55  $ilDB->quote($a_block_id, "integer")));
56  if ($rec = $ilDB->fetchAssoc($set))
57  {
58  self::$setting[$key] = $rec["value"];
59  return $rec["value"];
60  }
61  else if ($ilSetting->get('block_default_setting_'.$a_type.'_'.$a_setting, false))
62  {
63  self::$setting[$key] = $ilSetting->get('block_default_setting_'.$a_type.'_'.$a_setting, false);
64  return $ilSetting->get('block_default_setting_'.$a_type.'_'.$a_setting, false);
65  }
66  else
67  {
68  self::$setting[$key] = false;
69  return false;
70  }
71  }
$a_type
Definition: workflow.php:93
global $ilSetting
Definition: privfeed.php:17
global $ilDB
+ 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 176 of file class.ilBlockSetting.php.

References $a_type, and _lookup().

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

177  {
178  $detail = ilBlockSetting::_lookup($a_type, "detail", $a_user, $a_block_id);
179 
180  if ($detail === false) // return a level of 2 (standard value)
181  { // if record does not exist
182  return 2;
183  }
184  else
185  {
186  return $detail;
187  }
188  }
$a_type
Definition: workflow.php:93
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 203 of file class.ilBlockSetting.php.

References $a_type, and _lookup().

Referenced by ilColumnGUI\determineBlocks().

204  {
205  $nr = ilBlockSetting::_lookup($a_type, "nr", $a_user, $a_block_id);
206 
207  return $nr;
208  }
$a_type
Definition: workflow.php:93
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 223 of file class.ilBlockSetting.php.

References $a_type, and _lookup().

Referenced by ilColumnGUI\determineBlocks().

224  {
225  $side = ilBlockSetting::_lookup($a_type, "side", $a_user, $a_block_id);
226 
227  return $side;
228  }
$a_type
Definition: workflow.php:93
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 82 of file class.ilBlockSetting.php.

References $a_type, and $ilSetting.

83  {
84  global $ilSetting;
85  $ilSetting->set('block_default_setting_'.$a_type.'_'.$a_setting, $a_value);
86  }
$a_type
Definition: workflow.php:93
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 96 of file class.ilBlockSetting.php.

References $a_type, and $ilSetting.

97  {
98  global $ilSetting;
99  $ilSetting->delete('block_default_setting_'.$a_type.'_'.$a_setting);
100  }
$a_type
Definition: workflow.php:93
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 155 of file class.ilBlockSetting.php.

References $a_type, and $ilDB.

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

156  {
157  global $ilDB;
158 
159  $ilDB->manipulate(sprintf("DELETE FROM il_block_setting WHERE type = %s AND user_id = %s AND block_id = %s AND setting = %s",
160  $ilDB->quote($a_type, "text"),
161  $ilDB->quote($a_user, "integer"),
162  $ilDB->quote((int) $a_block_id, "integer"),
163  $ilDB->quote($a_setting, "text")));
164  $ilDB->manipulate(sprintf("INSERT INTO il_block_setting (type, user_id, setting, block_id, value) VALUES (%s,%s,%s,%s,%s)",
165  $ilDB->quote($a_type, "text"),
166  $ilDB->quote($a_user, "integer"),
167  $ilDB->quote($a_setting, "text"),
168  $ilDB->quote((int) $a_block_id, "integer"),
169  $ilDB->quote($a_value, "text")));
170  }
$a_type
Definition: workflow.php:93
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 194 of file class.ilBlockSetting.php.

References $a_type, and _write().

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

195  {
196  ilBlockSetting::_write($a_type, "detail", $a_value, $a_user, $a_block_id);
197  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
$a_type
Definition: workflow.php:93
+ 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 214 of file class.ilBlockSetting.php.

References $a_type, and _write().

Referenced by ilColumnGUI\exceededLimit().

215  {
216  ilBlockSetting::_write($a_type, "nr", $a_value, $a_user, $a_block_id);
217  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
$a_type
Definition: workflow.php:93
+ 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 234 of file class.ilBlockSetting.php.

References $a_type, and _write().

Referenced by ilColumnGUI\exceededLimit().

235  {
236  ilBlockSetting::_write($a_type, "side", $a_value, $a_user, $a_block_id);
237  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
$a_type
Definition: workflow.php:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preloadPDBlockSettings()

static ilBlockSetting::preloadPDBlockSettings ( )
static

Preload pd info.

Parameters

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

References $ilDB, $ilUser, and array.

Referenced by ilPersonalDesktopGUI\getStandardTemplates().

109  {
110  global $ilDB, $ilUser;
111 
112  if (!self::$pd_preloaded)
113  {
114  $blocks = array("pdbookm", "pdcal", "pdfeedb", "pditems",
115  "pdmail", "pdnews", "pdnotes", "pdsysmess", "pdtag", "pdusers");
116  $settings = array("detail", "nr", "side");
117  $user_id = $ilUser->getId();
118 
119  foreach ($blocks as $b)
120  {
121  foreach ($settings as $s)
122  {
123  $key = $b.":".$s.":".$user_id.":0";
124  if ($s == "detail")
125  {
126  self::$setting[$key] = 2;
127  }
128  else
129  {
130  self::$setting[$key] = false;
131  }
132  }
133  }
134 
135  $set = $ilDB->query($q = "SELECT type, setting, value FROM il_block_setting WHERE ".
136  " user_id = ".$ilDB->quote($user_id, "integer").
137  " AND ".$ilDB->in("type", $blocks, false, "text").
138  " AND ".$ilDB->in("setting", $settings, false, "text")
139  );
140  while ($rec = $ilDB->fetchAssoc($set))
141  {
142  $key = $rec["type"].":".$rec["setting"].":".$user_id.":0";
143  self::$setting[$key] = $rec["value"];
144  }
145 
146  self::$pd_preloaded = true;
147  }
148 
149  }
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
+ 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: