ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarHidden Class Reference

Stores selection of hidden calendars for a specific user. More...

+ Collaboration diagram for ilCalendarHidden:

Public Member Functions

 filterHidden ($categories, $category_info)
 Filter hidden categories (and hidden subitem categories) from category array.
 isHidden ($a_cat_id)
 Check if category is hidden.
 isAppointmentVisible ($a_cal_id)
 check whether an appoinment is visible or not
 getHidden ()
 get hidden categories
 hideSelected ($a_hidden)
 hide selected
 save ()
 save hidden selection
 delete ($a_cat_id=null)
 delete

Static Public Member Functions

static _getInstanceByUserId ($a_user_id)
 get instance by user id
static _deleteCategories ($a_cat_id)
 delete by category
static _deleteUser ($a_user_id)
 Delete by user.

Protected Member Functions

 read ()
 read user selection

Protected Attributes

 $user_id
 $hidden = array()
 $db

Static Protected Attributes

static $instances = array()

Private Member Functions

 __construct ($a_user_id)
 Singleton constructor.

Detailed Description

Stores selection of hidden calendars for a specific user.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

ilCalendarHidden::__construct (   $a_user_id)
private

Singleton constructor.

private

Parameters
intuser id

Definition at line 48 of file class.ilCalendarHidden.php.

References read().

{
global $ilDB;
$this->db = $ilDB;
$this->user_id = $a_user_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCalendarHidden::_deleteCategories (   $a_cat_id)
static

delete by category

public

Parameters
intcategory id

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

Referenced by ilCalendarCategory\delete().

{
global $ilDB;
$query = "DELETE FROM cal_categories_hidden ".
"WHERE cat_id = ".$ilDB->quote($a_cat_id)." ";
$ilDB->query($query);
}

+ Here is the caller graph for this function:

static ilCalendarHidden::_deleteUser (   $a_user_id)
static

Delete by user.

public

Parameters
intuser_id
Returns

Definition at line 98 of file class.ilCalendarHidden.php.

{
global $ilDB;
$query = "DELETE FROM cal_categories_hidden ".
"WHERE user_id = ".$ilDB->quote($a_user_id)." ";
$ilDB->query($query);
}
static ilCalendarHidden::_getInstanceByUserId (   $a_user_id)
static

get instance by user id

public

Parameters
intuser id
Returns
object

Definition at line 65 of file class.ilCalendarHidden.php.

Referenced by ilCalendarSchedule\__construct(), ilCalendarCategoryTableGUI\parse(), and ilCalendarCategoryGUI\saveSelection().

{
if(isset(self::$instances[$a_user_id]))
{
return self::$instances[$a_user_id];
}
return self::$instances[$a_user_id] = new ilCalendarHidden($a_user_id);
}

+ Here is the caller graph for this function:

ilCalendarHidden::delete (   $a_cat_id = null)

delete

public

Parameters
intcat id (if empty all categories are deleted)
Returns
bool

Definition at line 208 of file class.ilCalendarHidden.php.

{
if($a_cat_id)
{
$query = "DELETE FROM cal_categories_hidden ".
"WHERE user_id = ".$this->db->quote($this->user_id)." ".
"AND cat_id = ".$this->db->quote($a_cat_id)." ";
}
else
{
$query = "DELETE FROM cal_categories_hidden ".
"WHERE user_id = ".$this->db->quote($this->user_id)." ";
}
$this->db->query($query);
return true;
}
ilCalendarHidden::filterHidden (   $categories,
  $category_info 
)

Filter hidden categories (and hidden subitem categories) from category array.

Parameters
object$categories
object$category_info
Returns

Definition at line 113 of file class.ilCalendarHidden.php.

References $hidden, and isHidden().

{
foreach($category_info as $cat_id => $info)
{
if($this->isHidden($cat_id))
{
$hidden = array_merge((array) $hidden,(array) $info['subitem_ids'],array($cat_id));
}
}
return (array) array_diff((array) $categories, (array) $hidden);
}

+ Here is the call graph for this function:

ilCalendarHidden::getHidden ( )

get hidden categories

public

Returns
array array of category ids

Definition at line 162 of file class.ilCalendarHidden.php.

{
return $this->hidden ? $this->hidden : array();
}
ilCalendarHidden::hideSelected (   $a_hidden)

hide selected

public

Parameters
arrayarray of hidden categories
Returns
bool

Definition at line 176 of file class.ilCalendarHidden.php.

{
$this->hidden = $a_hidden;
return true;
}
ilCalendarHidden::isAppointmentVisible (   $a_cal_id)

check whether an appoinment is visible or not

public

Parameters
@return

Definition at line 142 of file class.ilCalendarHidden.php.

References ilCalendarCategoryAssignments\_lookupCategories().

{
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
foreach(ilCalendarCategoryAssignments::_lookupCategories($a_cal_id) as $cat_id)
{
if(in_array($cat_id,$this->hidden))
{
return true;
}
}
return false;
}

+ Here is the call graph for this function:

ilCalendarHidden::isHidden (   $a_cat_id)

Check if category is hidden.

Parameters
object$a_cat_id
Returns

Definition at line 130 of file class.ilCalendarHidden.php.

Referenced by filterHidden().

{
return in_array($a_cat_id, $this->hidden);
}

+ Here is the caller graph for this function:

ilCalendarHidden::read ( )
protected

read user selection

protected

Returns
bool

Definition at line 231 of file class.ilCalendarHidden.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by __construct().

{
$query = "SELECT * FROM cal_categories_hidden ".
"WHERE user_id = ".$this->db->quote($this->user_id)." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->hidden[] = $row->cat_id;
}
return true;
}

+ Here is the caller graph for this function:

ilCalendarHidden::save ( )

save hidden selection

public

Returns
bool

Definition at line 188 of file class.ilCalendarHidden.php.

References $hidden.

{
$this->delete();
foreach($this->hidden as $hidden)
{
$query = "INSERT INTO cal_categories_hidden ".
"SET user_id = ".$this->db->quote($this->user_id).", ".
"cat_id = ".$this->db->quote($hidden)." ";
$this->db->query($query);
}
return true;
}

Field Documentation

ilCalendarHidden::$db
protected

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

ilCalendarHidden::$hidden = array()
protected

Definition at line 38 of file class.ilCalendarHidden.php.

Referenced by filterHidden(), and save().

ilCalendarHidden::$instances = array()
staticprotected

Definition at line 35 of file class.ilCalendarHidden.php.

ilCalendarHidden::$user_id
protected

Definition at line 37 of file class.ilCalendarHidden.php.


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