ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBlockSetting Class Reference

Block Setting class. More...

+ Collaboration diagram for ilBlockSetting:

Public Member Functions

 preloadPDBlockSettings ()
 Preload pd info.

Static Public Member Functions

static _lookup ($a_type, $a_setting, $a_user=0, $a_block_id=0)
 Lookup setting from database.
static _setDefaultSetting ($a_type, $a_setting, $a_value)
 Sets a default setting for a block.
static _unsetDefaultSetting ($a_type, $a_setting)
 Unsets a default setting for a block.
static _write ($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
 Write setting to database.
static _lookupDetailLevel ($a_type, $a_user=0, $a_block_id=0)
 Lookup detail level.
static _writeDetailLevel ($a_type, $a_value, $a_user=0, $a_block_id=0)
 Write detail level to database.
static _lookupNr ($a_type, $a_user=0, $a_block_id=0)
 Lookup number.
static _writeNumber ($a_type, $a_value, $a_user=0, $a_block_id=0)
 Write number to database.
static _lookupSide ($a_type, $a_user=0, $a_block_id=0)
 Lookup side.
static _writeSide ($a_type, $a_value, $a_user=0, $a_block_id=0)
 Write side to database.
static _deleteSettingsOfUser ($a_user)
 Delete block settings of user.
static _deleteSettingsOfBlock ($a_block_id, $a_block_type)
 Delete block settings of block.

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

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

Delete block settings of block.

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

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

{
global $ilDB;
if ($a_block_id > 0)
{
$ilDB->manipulate("DELETE FROM il_block_setting WHERE block_id = ".
$ilDB->quote($a_block_id, "integer").
" AND type = ".$ilDB->quote($a_block_type, "text"));
}
}

+ Here is the caller graph for this function:

static ilBlockSetting::_deleteSettingsOfUser (   $a_user)
static

Delete block settings of user.

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

Referenced by ilObjUser\delete().

{
global $ilDB;
if ($a_user > 0)
{
$ilDB->manipulate("DELETE FROM il_block_setting WHERE user_id = ".
$ilDB->quote($a_user, "integer"));
}
}

+ Here is the caller graph for this function:

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 $ilSetting.

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

{
global $ilDB, $ilSetting;
$key = $a_type.":".$a_setting.":".$a_user.":".$a_block_id;
if (isset(self::$setting[$key]))
{
return self::$setting[$key];
}
$set = $ilDB->query(sprintf("SELECT value FROM il_block_setting WHERE type = %s ".
"AND user_id = %s AND setting = %s AND block_id = %s",
$ilDB->quote($a_type, "text"),
$ilDB->quote($a_user, "integer"),
$ilDB->quote($a_setting, "text"),
$ilDB->quote($a_block_id, "integer")));
if ($rec = $ilDB->fetchAssoc($set))
{
self::$setting[$key] = $rec["value"];
return $rec["value"];
}
else if ($ilSetting->get('block_default_setting_'.$a_type.'_'.$a_setting, false))
{
self::$setting[$key] = $ilSetting->get('block_default_setting_'.$a_type.'_'.$a_setting, false);
return $ilSetting->get('block_default_setting_'.$a_type.'_'.$a_setting, false);
}
else
{
self::$setting[$key] = false;
return false;
}
}

+ Here is the caller graph for this function:

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 _lookup().

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

{
$detail = ilBlockSetting::_lookup($a_type, "detail", $a_user, $a_block_id);
if ($detail === false) // return a level of 2 (standard value)
{ // if record does not exist
return 2;
}
else
{
return $detail;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 _lookup().

Referenced by ilColumnGUI\determineBlocks().

{
$nr = ilBlockSetting::_lookup($a_type, "nr", $a_user, $a_block_id);
return $nr;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 _lookup().

Referenced by ilColumnGUI\determineBlocks().

{
$side = ilBlockSetting::_lookup($a_type, "side", $a_user, $a_block_id);
return $side;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 $ilSetting.

{
global $ilSetting;
$ilSetting->set('block_default_setting_'.$a_type.'_'.$a_setting, $a_value);
}
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 $ilSetting.

{
global $ilSetting;
$ilSetting->delete('block_default_setting_'.$a_type.'_'.$a_setting);
}
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.

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

{
global $ilDB;
$ilDB->manipulate(sprintf("DELETE FROM il_block_setting WHERE type = %s AND user_id = %s AND block_id = %s AND setting = %s",
$ilDB->quote($a_type, "text"),
$ilDB->quote($a_user, "integer"),
$ilDB->quote((int) $a_block_id, "integer"),
$ilDB->quote($a_setting, "text")));
$ilDB->manipulate(sprintf("INSERT INTO il_block_setting (type, user_id, setting, block_id, value) VALUES (%s,%s,%s,%s,%s)",
$ilDB->quote($a_type, "text"),
$ilDB->quote($a_user, "integer"),
$ilDB->quote($a_setting, "text"),
$ilDB->quote((int) $a_block_id, "integer"),
$ilDB->quote($a_value, "text")));
}

+ Here is the caller graph for this function:

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 _write().

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

{
ilBlockSetting::_write($a_type, "detail", $a_value, $a_user, $a_block_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 _write().

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

+ Here is the call graph for this function:

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 _write().

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

+ Here is the call graph for this function:

ilBlockSetting::preloadPDBlockSettings ( )

Preload pd info.

Parameters
@return

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

References $ilUser.

{
global $ilDB, $ilUser;
if (!self::$pd_preloaded)
{
$blocks = array("pdbookm", "pdcal", "pdfeedb", "pditems",
"pdmail", "pdnews", "pdnotes", "pdsysmess", "pdtag", "pdusers");
$settings = array("detail", "nr", "side");
$user_id = $ilUser->getId();
foreach ($blocks as $b)
{
foreach ($settings as $s)
{
$key = $b.":".$s.":".$user_id.":0";
if ($s == "detail")
{
self::$setting[$key] = 2;
}
else
{
self::$setting[$key] = false;
}
}
}
$set = $ilDB->query($q = "SELECT type, setting, value FROM il_block_setting WHERE ".
" user_id = ".$ilDB->quote($user_id, "integer").
" AND ".$ilDB->in("type", $blocks, false, "text").
" AND ".$ilDB->in("setting", $settings, false, "text")
);
while ($rec = $ilDB->fetchAssoc($set))
{
$key = $rec["type"].":".$rec["setting"].":".$user_id.":0";
self::$setting[$key] = $rec["value"];
}
self::$pd_preloaded = true;
}
}

Field Documentation

ilBlockSetting::$pd_preloaded = false
static

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

ilBlockSetting::$setting = array()
static

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


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