ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBlockSetting Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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.

References $DIC, and $ilDB.

Referenced by ilObject\delete().

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: feed.php:28
+ 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.

References $DIC, and $ilDB.

Referenced by ilObjUser\delete().

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  }
global $DIC
Definition: feed.php:28
+ 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.

References $DIC, $ilDB, $ilSetting, and ILIAS\LTI\ToolProvider\$key.

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

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 $DIC
Definition: feed.php:28
string $key
Consumer key/client ID value.
Definition: System.php:193
global $ilSetting
Definition: privfeed.php:17
+ 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  }

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

References _lookup().

Referenced by ilColumnGUI\determineBlocks().

188  : ?string {
189  return ilBlockSetting::_lookup($a_type, "side", $a_user, $a_block_id);
190  }
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
+ Here is the call graph for this function:
+ 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.

References $DIC, and $ilDB.

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

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  }
global $DIC
Definition: feed.php:28
+ 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.

References _write().

Referenced by ilColumnGUI\activateBlock().

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.
+ Here is the call graph for this function:
+ 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.

References _write().

177  : void {
178  ilBlockSetting::_write($a_type, "nr", $a_value, $a_user, $a_block_id);
179  }
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
+ Here is the call graph for this function:

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

References _write().

197  : void {
198  ilBlockSetting::_write($a_type, "side", $a_value, $a_user, $a_block_id);
199  }
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
+ Here is the call graph for this function:

◆ cloneSettingsOfBlock()

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

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

References $DIC.

Referenced by ilContainer\_exportContainerSettings().

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  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ preloadPDBlockSettings()

static ilBlockSetting::preloadPDBlockSettings ( )
static

Preload pd info.

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

References Vendor\Package\$b, $DIC, $ilDB, $ilUser, ILIAS\LTI\ToolProvider\$key, and ILIAS\LTI\ToolProvider\$settings.

Referenced by ilDashboardGUI\show().

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  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
global $DIC
Definition: feed.php:28
string $key
Consumer key/client ID value.
Definition: System.php:193
$ilUser
Definition: imgupload.php:34
+ 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: