ILIAS  Release_4_2_x_branch Revision 61807
 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 32 of file class.ilCalendarHidden.php.

Constructor & Destructor Documentation

ilCalendarHidden::__construct (   $a_user_id)
private

Singleton constructor.

private

Parameters
intuser id

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

References $ilDB, and 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 80 of file class.ilCalendarHidden.php.

References $ilDB, $query, and $res.

Referenced by ilCalendarCategory\delete().

{
global $ilDB;
$query = "DELETE FROM cal_categories_hidden ".
"WHERE cat_id = ".$ilDB->quote($a_cat_id ,'integer')." ";
$res = $ilDB->manipulate($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 97 of file class.ilCalendarHidden.php.

References $ilDB, $query, and $res.

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

get instance by user id

public

Parameters
intuser id
Returns
object

Definition at line 64 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 212 of file class.ilCalendarHidden.php.

References $ilDB, $query, and $res.

{
global $ilDB;
if($a_cat_id)
{
$query = "DELETE FROM cal_categories_hidden ".
"WHERE user_id = ".$this->db->quote($this->user_id ,'integer')." ".
"AND cat_id = ".$this->db->quote($a_cat_id ,'integer')." ";
}
else
{
$query = "DELETE FROM cal_categories_hidden ".
"WHERE user_id = ".$this->db->quote($this->user_id ,'integer')." ";
}
$res = $ilDB->manipulate($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 112 of file class.ilCalendarHidden.php.

References $hidden, and isHidden().

{
$hidden = array();
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_diff((array) $categories, $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 237 of file class.ilCalendarHidden.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM cal_categories_hidden ".
"WHERE user_id = ".$this->db->quote($this->user_id ,'integer')." ";
$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, $ilDB, $query, and $res.

{
global $ilDB;
$this->delete();
foreach($this->hidden as $hidden)
{
$query = "INSERT INTO cal_categories_hidden (user_id,cat_id) ".
"VALUES ( ".
$this->db->quote($this->user_id ,'integer').", ".
$this->db->quote($hidden ,'integer')." ".
")";
$res = $ilDB->manipulate($query);
}
return true;
}

Field Documentation

ilCalendarHidden::$db
protected

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

ilCalendarHidden::$hidden = array()
protected

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

Referenced by filterHidden(), and save().

ilCalendarHidden::$instances = array()
staticprotected

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

ilCalendarHidden::$user_id
protected

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


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