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

class for calendar categories More...

+ Collaboration diagram for ilCalendarCategories:

Public Member Functions

 initialize ($a_mode, $a_source_ref_id=0, $a_use_cache=false)
 initialize visible categories
 getCategoryInfo ($a_cat_id)
 public
 getCategoriesInfo ()
 get categories
 getCategories ($a_include_subitem_calendars=false)
 get categories
 getSubitemCategories ($a_cat_id)
 get subitem categories for a specific category
 prepareCategoriesOfUserForSelection ()
 prepare categories of users for selection
 getNotificationCalendars ()
 Get all calendars that allow send of notifications (Editable and course group calendars)
 isEditable ($a_cat_id)
 check if category is editable
 isVisible ($a_cat_id)
 check if category is visible
 readConsultationHoursCalendar ($user_id=NULL)
 Read personal consultation hours calendar.
 readBookingCalendar ($user_id=NULL)
 Read booking manager calendar.

Static Public Member Functions

static _getInstance ($a_usr_id=0)
 get singleton instance
static _lookupCategoryIdByObjId ($a_obj_id)
 lookup category by obj_id
static _isOwner ($a_usr_id, $a_cal_id)
 check if user is owner of a category
static deletePDItemsCache ($a_usr_id)
 Delete cache (add remove desktop item)
static deleteRepositoryCache ($a_usr_id)
 Delete cache.
static lookupPrivateCategories ($a_user_id)
 Lookup private categories of user.

Data Fields

const MODE_REPOSITORY = 2
const MODE_REMOTE_ACCESS = 3
const MODE_PERSONAL_DESKTOP_MEMBERSHIP = 4
const MODE_PERSONAL_DESKTOP_ITEMS = 5
const MODE_MANAGE = 6
const MODE_CONSULTATION = 7

Protected Member Functions

 __construct ($a_usr_id=0)
 Singleton instance.
 sleep ()
 Serialize categories.
 wakeup ($a_ser)
 Load from serialize string.
 readPDCalendars ()
 Read categories of user.
 readSelectedItemCalendars ()
 Read categories of selected items.
 readReposCalendars ()
 Read available repository calendars.
 readPublicCalendars ()
 Read public calendars.
 readPrivateCalendars ()
 Read private calendars.
 readSelectedCategories ($a_obj_ids)
 read selected categories
 addSubitemCalendars ()
 Add subitem calendars E.g.

Protected Attributes

 $db
 $user_id
 $categories = array()
 $categories_info = array()
 $subitem_categories = array()
 $root_ref_id = 0
 $root_obj_id = 0

Static Protected Attributes

static $instance = null

Detailed Description

class for calendar categories

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

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

Constructor & Destructor Documentation

ilCalendarCategories::__construct (   $a_usr_id = 0)
protected

Singleton instance.

protected

Parameters
int$a_usr_iduser id
Returns

Definition at line 67 of file class.ilCalendarCategories.php.

References $ilUser.

{
global $ilUser,$ilDB;
$this->user_id = $a_usr_id;
if(!$this->user_id)
{
$this->user_id = $ilUser->getId();
}
$this->db = $ilDB;
}

Member Function Documentation

static ilCalendarCategories::_isOwner (   $a_usr_id,
  $a_cal_id 
)
static

check if user is owner of a category

public

Parameters
intusr_id
intcal_id
Returns
bool

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

References $query, $res, and ilCalendarCategory\TYPE_USR.

Referenced by ilCalendarShared\getSharedCalendarsForUser().

{
global $ilDB;
$query = "SELECT * FROM cal_categories ".
"WHERE cat_id = ".$ilDB->quote($a_cal_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND type = ".$ilDB->quote(ilCalendarCategory::TYPE_USR ,'integer')." ";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

static ilCalendarCategories::_lookupCategoryIdByObjId (   $a_obj_id)
static

lookup category by obj_id

public

Parameters
intobj_id
Returns
int cat_id

Definition at line 104 of file class.ilCalendarCategories.php.

References $query, $res, $row, DB_FETCHMODE_OBJECT, and ilCalendarCategory\TYPE_OBJ.

Referenced by ilCalendarAppEventListener\createAppointments(), ilCalendarAppEventListener\deleteCategory(), ilDataLoader\generateCalendarEntries(), and ilCalendarAppointmentGUI\initForm().

{
global $ilDB;
$query = "SELECT cat_id FROM cal_categories ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
"AND type = ".$ilDB->quote(ilCalendarCategory::TYPE_OBJ,'integer')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->cat_id;
}
return 0;
}

+ Here is the caller graph for this function:

ilCalendarCategories::addSubitemCalendars ( )
protected

Add subitem calendars E.g.

session calendars in courses, groups

Parameters
@return

Definition at line 774 of file class.ilCalendarCategories.php.

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

Referenced by readPDCalendars(), and readSelectedItemCalendars().

{
global $ilDB;
$course_ids = array();
foreach($this->categories as $cat_id)
{
if($this->categories_info[$cat_id]['obj_type'] == 'crs' or $this->categories_info[$cat_id]['obj_type'] == 'grp')
{
$course_ids[] = $this->categories_info[$cat_id]['obj_id'];
}
}
$query = "SELECT od2.obj_id sess_id, od1.obj_id crs_id,cat_id FROM object_data od1 ".
"JOIN object_reference or1 ON od1.obj_id = or1.obj_id ".
"JOIN tree t ON or1.ref_id = t.parent ".
"JOIN object_reference or2 ON t.child = or2.ref_id ".
"JOIN object_data od2 ON or2.obj_id = od2.obj_id ".
"JOIN cal_categories cc ON od2.obj_id = cc.obj_id ".
"WHERE od2.type = 'sess' ".
"AND (od1.type = 'crs' OR od1.type = 'grp') ".
"AND ".$ilDB->in('od1.obj_id',$course_ids,false,'integer').' '.
"AND or2.deleted IS NULL";
$res = $ilDB->query($query);
$cat_ids = array();
$course_sessions = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$cat_ids[] = $row->cat_id;
$course_sessions[$row->crs_id][$row->sess_id] = $row->cat_id;
$this->subitem_categories[] = $row->cat_id;
}
foreach($this->categories as $cat_id)
{
if(
($this->categories_info[$cat_id]['obj_type'] == 'crs' ||
$this->categories_info[$cat_id]['obj_type'] == 'grp' ) &&
isset($this->categories_info[$cat_id]['obj_id']) &&
isset($course_sessions[$this->categories_info[$cat_id]['obj_id']]) &&
is_array($course_sessions[$this->categories_info[$cat_id]['obj_id']]))
{
foreach($course_sessions[$this->categories_info[$cat_id]['obj_id']] as $sess_id => $sess_cat_id)
{
$this->categories_info[$cat_id]['subitem_ids'][$sess_id] = $sess_cat_id;
$this->categories_info[$cat_id]['subitem_obj_ids'][$sess_cat_id] = $sess_id;
}
}
else
{
$this->categories_info[$cat_id]['subitem_ids'] = array();
$this->categories_info[$cat_id]['subitem_obj_ids'] = array();
}
}
}

+ Here is the caller graph for this function:

static ilCalendarCategories::deletePDItemsCache (   $a_usr_id)
static

Delete cache (add remove desktop item)

Parameters
object$a_usr_id
Returns

Definition at line 147 of file class.ilCalendarCategories.php.

References ilCalendarCache\getInstance().

Referenced by ilObjUser\_addDesktopItem(), ilObjUser\_dropDesktopItem(), and ilCalendarAppEventListener\handleEvent().

{
ilCalendarCache::getInstance()->deleteByAdditionalKeys(
$a_usr_id,
self::MODE_PERSONAL_DESKTOP_ITEMS,
'categories'
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCalendarCategories::deleteRepositoryCache (   $a_usr_id)
static

Delete cache.

Parameters
object$a_usr_id
Returns

Definition at line 161 of file class.ilCalendarCategories.php.

References ilCalendarCache\getInstance().

Referenced by ilCalendarAppEventListener\handleEvent().

{
ilCalendarCache::getInstance()->deleteByAdditionalKeys(
$a_usr_id,
self::MODE_REPOSITORY,
'categories'
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategories::getCategories (   $a_include_subitem_calendars = false)

get categories

Parameters
$a_include_subitemsinclude subitem calendars public
Returns

Definition at line 319 of file class.ilCalendarCategories.php.

{
if($a_include_subitem_calendars)
{
return array_merge((array) $this->categories, (array) $this->subitem_categories);
}
return $this->categories ? $this->categories : array();
}
ilCalendarCategories::getCategoriesInfo ( )

get categories

public

Parameters
@return

Definition at line 308 of file class.ilCalendarCategories.php.

{
return $this->categories_info ? $this->categories_info : array();
}
ilCalendarCategories::getCategoryInfo (   $a_cat_id)

public

Parameters
@return

Definition at line 281 of file class.ilCalendarCategories.php.

{
if(isset($this->categories_info[$a_cat_id]))
{
return $this->categories_info[$a_cat_id];
}
if(in_array($a_cat_id,(array) $this->subitem_categories))
{
foreach($this->categories as $cat_id)
{
if(in_array($a_cat_id,$this->categories_info[$cat_id]['subitem_ids']))
{
return $this->categories_info[$cat_id];
}
}
}
}
ilCalendarCategories::getNotificationCalendars ( )

Get all calendars that allow send of notifications (Editable and course group calendars)

Returns

Definition at line 386 of file class.ilCalendarCategories.php.

References ilObject\_lookupType(), and ilCalendarCategory\TYPE_OBJ.

{
$not = array();
foreach($this->categories_info as $info)
{
if($info['type'] == ilCalendarCategory::TYPE_OBJ and $info['editable'] == true)
{
if(ilObject::_lookupType($info['obj_id']) == 'crs' or ilObject::_lookupType($info['obj_id']) == 'grp')
{
$not[] = $info['cat_id'];
}
}
}
return $not;
}

+ Here is the call graph for this function:

ilCalendarCategories::getSubitemCategories (   $a_cat_id)

get subitem categories for a specific category

Parameters
int$a_category_idId of category in question
Returns
array Array of category ids

Definition at line 335 of file class.ilCalendarCategories.php.

{
if(!isset($this->categories_info[$a_cat_id]['subitem_ids']))
{
return array($a_cat_id);
}
return array_merge((array) $this->categories_info[$a_cat_id]['subitem_ids'],array($a_cat_id));
}
ilCalendarCategories::initialize (   $a_mode,
  $a_source_ref_id = 0,
  $a_use_cache = false 
)

initialize visible categories

public

Parameters
intmode
intref_id of root node
Returns

Definition at line 209 of file class.ilCalendarCategories.php.

References $user_id, ilCalendarUserSettings\_getInstance(), ilObject\_lookupObjId(), ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ilCalendarCache\getInstance(), readConsultationHoursCalendar(), readPDCalendars(), readPrivateCalendars(), readReposCalendars(), readSelectedItemCalendars(), and wakeup().

{
if($a_use_cache)
{
// Read categories from cache
if($cats = ilCalendarCache::getInstance()->getEntry($this->user_id.':'.$a_mode.':categories:'.(int) $a_source_ref_id))
{
$this->wakeup($cats);
return;
}
}
switch($a_mode)
{
case self::MODE_REMOTE_ACCESS:
include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
{
$this->readPDCalendars();
}
else
{
}
break;
case self::MODE_PERSONAL_DESKTOP_MEMBERSHIP:
$this->readPDCalendars();
break;
case self::MODE_PERSONAL_DESKTOP_ITEMS:
break;
case self::MODE_REPOSITORY:
$this->root_ref_id = $a_source_ref_id;
$this->root_obj_id = ilObject::_lookupObjId($this->root_ref_id);
break;
case self::MODE_MANAGE:
$this->readPDCalendars();
break;
case self::MODE_CONSULTATION:
$this->readConsultationHoursCalendar($a_source_ref_id);
break;
}
if($a_use_cache)
{
// Store in cache
$this->user_id.':'.$a_mode.':categories:'.(int) $a_source_ref_id,
$this->sleep(),
$a_mode,
'categories'
);
}
}

+ Here is the call graph for this function:

ilCalendarCategories::isEditable (   $a_cat_id)

check if category is editable

public

Parameters
int$a_cat_idcategory id
Returns

Definition at line 409 of file class.ilCalendarCategories.php.

{
return isset($this->categories_info[$a_cat_id]['editable']) and $this->categories_info[$a_cat_id]['editable'];
}
ilCalendarCategories::isVisible (   $a_cat_id)

check if category is visible

public

Parameters
int$a_cat_idcategory id
Returns

Definition at line 421 of file class.ilCalendarCategories.php.

{
return in_array($a_cat_id,$this->categories) or
in_array($a_cat_id,(array) $this->subitem_categories);
}
static ilCalendarCategories::lookupPrivateCategories (   $a_user_id)
static

Lookup private categories of user.

Parameters
@return

Definition at line 837 of file class.ilCalendarCategories.php.

References ilCalendarCategory\TYPE_USR.

Referenced by ilUserExporter\getXmlExportTailDependencies().

{
global $ilDB;
// First read private calendars of user
$set = $ilDB->query("SELECT * FROM cal_categories ".
"WHERE type = ".$ilDB->quote(ilCalendarCategory::TYPE_USR ,'integer')." ".
"AND obj_id = ".$ilDB->quote($a_user_id,'integer'));
$cats = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$cats[] = $rec;
}
return $cats;
}

+ Here is the caller graph for this function:

ilCalendarCategories::prepareCategoriesOfUserForSelection ( )

prepare categories of users for selection

public

Parameters
intuser id
Returns

Definition at line 352 of file class.ilCalendarCategories.php.

References $lng, and ilCalendarCategory\TYPE_USR.

{
global $lng;
$has_personal_calendar = false;
foreach($this->categories_info as $info)
{
if($info['obj_type'] == 'sess')
{
continue;
}
if($info['type'] == ilCalendarCategory::TYPE_USR and $info['editable'])
{
$has_personal_calendar = true;
}
if($info['editable'])
{
$cats[$info['cat_id']] = $info['title'];
}
}
// If there
if(!$has_personal_calendar)
{
$cats[0] = $lng->txt('cal_default_calendar');
}
return $cats ? $cats : array();
}
ilCalendarCategories::readBookingCalendar (   $user_id = NULL)

Read booking manager calendar.

Parameters
int$user_id
Returns

Definition at line 673 of file class.ilCalendarCategories.php.

References $query, $res, $row, $user_id, DB_FETCHMODE_OBJECT, and ilCalendarCategory\TYPE_BOOK.

Referenced by readPDCalendars(), and readSelectedItemCalendars().

{
global $ilDB;
if(!$user_id)
{
}
$query = "SELECT * FROM cal_categories ".
"WHERE type = ".$ilDB->quote(ilCalendarCategory::TYPE_BOOK,'integer').' '.
"AND obj_id = ".$ilDB->quote($user_id,'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->categories[] = $row->cat_id;
$this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
$this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
$this->categories_info[$row->cat_id]['title'] = $row->title;
$this->categories_info[$row->cat_id]['color'] = $row->color;
$this->categories_info[$row->cat_id]['type'] = $row->type;
$this->categories_info[$row->cat_id]['editable'] = false;
$this->categories_info[$row->cat_id]['accepted'] = false;
$this->categories_info[$row->cat_id]['remote'] = false;
}
}

+ Here is the caller graph for this function:

ilCalendarCategories::readConsultationHoursCalendar (   $user_id = NULL)

Read personal consultation hours calendar.

Parameters
int$user_id
Returns

Definition at line 641 of file class.ilCalendarCategories.php.

References $query, $res, $row, $user_id, DB_FETCHMODE_OBJECT, and ilCalendarCategory\TYPE_CH.

Referenced by initialize(), readPDCalendars(), readReposCalendars(), and readSelectedItemCalendars().

{
global $ilDB;
if(!$user_id)
{
}
$query = "SELECT * FROM cal_categories ".
"WHERE type = ".$ilDB->quote(ilCalendarCategory::TYPE_CH,'integer').' '.
"AND obj_id = ".$ilDB->quote($user_id,'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->categories[] = $row->cat_id;
$this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
$this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
$this->categories_info[$row->cat_id]['title'] = $row->title;
$this->categories_info[$row->cat_id]['color'] = $row->color;
$this->categories_info[$row->cat_id]['type'] = $row->type;
$this->categories_info[$row->cat_id]['editable'] = false;
$this->categories_info[$row->cat_id]['accepted'] = false;
$this->categories_info[$row->cat_id]['remote'] = false;
}
}

+ Here is the caller graph for this function:

ilCalendarCategories::readPDCalendars ( )
protected

Read categories of user.

protected

Parameters
@returnvoid

Definition at line 437 of file class.ilCalendarCategories.php.

References ilParticipants\_getMembershipByType(), addSubitemCalendars(), readBookingCalendar(), readConsultationHoursCalendar(), readPrivateCalendars(), readPublicCalendars(), and readSelectedCategories().

Referenced by initialize().

{
global $rbacsystem;
include_once('./Services/Membership/classes/class.ilParticipants.php');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategories::readPrivateCalendars ( )
protected

Read private calendars.

protected

Returns

Definition at line 591 of file class.ilCalendarCategories.php.

References $ilUser, $query, $res, $row, DB_FETCHMODE_OBJECT, ilCalendarSharedStatus\getAcceptedCalendars(), ilCalendarCategory\LTYPE_REMOTE, and ilCalendarCategory\TYPE_USR.

Referenced by initialize(), readPDCalendars(), readReposCalendars(), and readSelectedItemCalendars().

{
global $ilUser;
global $ilDB;
// First read private calendars of user
$query = "SELECT cat_id FROM cal_categories ".
"WHERE type = ".$this->db->quote(ilCalendarCategory::TYPE_USR ,'integer')." ".
"AND obj_id = ".$this->db->quote($ilUser->getId(),'integer')." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$cat_ids[] = $row->cat_id;
}
// Read shared calendars
include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
$accepted_ids = ilCalendarSharedStatus::getAcceptedCalendars($ilUser->getId());
if(!$cat_ids = array_merge((array) $cat_ids, $accepted_ids))
{
return true;
}
// user categories
$query = "SELECT * FROM cal_categories ".
"WHERE type = ".$this->db->quote(ilCalendarCategory::TYPE_USR ,'integer')." ".
"AND ".$ilDB->in('cat_id',$cat_ids,false,'integer')." ".
"ORDER BY title ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->categories[] = $row->cat_id;
$this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
$this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
$this->categories_info[$row->cat_id]['title'] = $row->title;
$this->categories_info[$row->cat_id]['color'] = $row->color;
$this->categories_info[$row->cat_id]['type'] = $row->type;
$this->categories_info[$row->cat_id]['editable'] = $row->obj_id == $ilUser->getId();
$this->categories_info[$row->cat_id]['accepted'] = in_array($row->cat_id, $accepted_ids);
$this->categories_info[$row->cat_id]['remote'] = ($row->loc_type == ilCalendarCategory::LTYPE_REMOTE);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategories::readPublicCalendars ( )
protected

Read public calendars.

protected

Returns

Definition at line 559 of file class.ilCalendarCategories.php.

References $query, $res, $row, ilCalendarSettings\_getInstance(), DB_FETCHMODE_OBJECT, ilCalendarCategory\LTYPE_REMOTE, and ilCalendarCategory\TYPE_GLOBAL.

Referenced by readPDCalendars(), readReposCalendars(), and readSelectedItemCalendars().

{
global $rbacsystem,$ilAccess;
// global categories
$query = "SELECT * FROM cal_categories ".
"WHERE type = ".$this->db->quote(ilCalendarCategory::TYPE_GLOBAL ,'integer')." ".
"ORDER BY title ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->categories[] = $row->cat_id;
$this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
$this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
$this->categories_info[$row->cat_id]['title'] = $row->title;
$this->categories_info[$row->cat_id]['color'] = $row->color;
$this->categories_info[$row->cat_id]['type'] = $row->type;
$this->categories_info[$row->cat_id]['editable'] = $rbacsystem->checkAccess('edit_event',ilCalendarSettings::_getInstance()->getCalendarSettingsId());
$this->categories_info[$row->cat_id]['accepted'] = false;
$this->categories_info[$row->cat_id]['remote'] = ($row->loc_type == ilCalendarCategory::LTYPE_REMOTE);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategories::readReposCalendars ( )
protected

Read available repository calendars.

protected

Parameters
@return

Definition at line 510 of file class.ilCalendarCategories.php.

References $query, $res, $row, ilCalendarSettings\_getInstance(), ilObject\_lookupType(), DB_FETCHMODE_OBJECT, readConsultationHoursCalendar(), readPrivateCalendars(), readPublicCalendars(), and readSelectedCategories().

Referenced by initialize().

{
global $ilAccess,$tree;
global $ilDB;
$query = "SELECT ref_id,obd.obj_id obj_id FROM tree t1 ".
"JOIN object_reference obr ON t1.child = obr.ref_id ".
"JOIN object_data obd ON obd.obj_id = obr.obj_id ".
"WHERE t1.lft >= (SELECT lft FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
"AND t1.lft <= (SELECT rgt FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
"AND ".$ilDB->in('type',array('crs','grp','sess'),false,'text')." ".
"AND tree = 1";
$res = $ilDB->query($query);
$obj_ids = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($tree->isDeleted($row->ref_id))
{
continue;
}
$obj_type = ilObject::_lookupType($row->obj_id);
if($obj_type == 'crs' or $obj_type == 'grp')
{
// Check for global/local activation
if(!ilCalendarSettings::_getInstance()->lookupCalendarActivated($row->obj_id))
{
continue;
}
}
if($ilAccess->checkAccess('read','',$row->ref_id))
{
$obj_ids[] = $row->obj_id;
}
}
$this->readSelectedCategories($obj_ids);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategories::readSelectedCategories (   $a_obj_ids)
protected

read selected categories

protected

Returns

Definition at line 706 of file class.ilCalendarCategories.php.

References $query, $ref_id, $res, $row, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilObject\_lookupType(), DB_FETCHMODE_OBJECT, and ilCalendarCategory\TYPE_OBJ.

Referenced by readPDCalendars(), readReposCalendars(), and readSelectedItemCalendars().

{
global $ilAccess,$tree;
global $ilDB;
if(!count($a_obj_ids))
{
return true;
}
$query = "SELECT * FROM cal_categories ".
"WHERE type = ".$this->db->quote(ilCalendarCategory::TYPE_OBJ ,'integer')." ".
"AND ".$ilDB->in('obj_id',$a_obj_ids,false,'integer')." ".
"ORDER BY title ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
// check activation/deactivation
$obj_type = ilObject::_lookupType($row->obj_id);
if($obj_type == 'crs' or $obj_type == 'grp')
{
if(!ilCalendarSettings::_getInstance()->lookupCalendarActivated($row->obj_id))
{
continue;
}
}
$editable = false;
$exists = false;
{
if($ilAccess->checkAccess('edit_event','',$ref_id))
{
$exists = true;
$editable = true;
break;
}
elseif($ilAccess->checkAccess('read','',$ref_id))
{
$exists = true;
}
}
if(!$exists)
{
continue;
}
$this->categories_info[$row->cat_id]['editable'] = $editable;
$this->categories[] = $row->cat_id;
$this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
$this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
$this->categories_info[$row->cat_id]['color'] = $row->color;
#$this->categories_info[$row->cat_id]['title'] = ilObject::_lookupTitle($row->obj_id);
$this->categories_info[$row->cat_id]['title'] = $row->title;
$this->categories_info[$row->cat_id]['obj_type'] = ilObject::_lookupType($row->obj_id);
$this->categories_info[$row->cat_id]['type'] = $row->type;
$this->categories_info[$row->cat_id]['remote'] = false;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategories::readSelectedItemCalendars ( )
protected

Read categories of selected items.

Parameters
@return

Definition at line 460 of file class.ilCalendarCategories.php.

References $ilUser, ilObjUser\_lookupDesktopItems(), addSubitemCalendars(), readBookingCalendar(), readConsultationHoursCalendar(), readPrivateCalendars(), readPublicCalendars(), and readSelectedCategories().

Referenced by initialize().

{
global $ilUser,$ilAccess;
$obj_ids = array();
$courses = array();
$groups = array();
$sessions = array();
foreach(ilObjUser::_lookupDesktopItems($ilUser->getId(),array('crs','grp','sess')) as $item)
{
if($ilAccess->checkAccess('read','',$item['ref_id']))
{
switch($item['type'])
{
case 'crs':
$courses[] = $item['obj_id'];
break;
case 'sess':
$sessions[] = $item['obj_id'];
break;
case 'grp':
$groups[] = $item['obj_id'];
break;
}
}
}
$this->readSelectedCategories($courses);
$this->readSelectedCategories($sessions);
$this->readSelectedCategories($groups);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategories::sleep ( )
protected

Serialize categories.

Returns

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

{
return serialize(
array(
'categories' => $this->categories,
'categories_info' => $this->categories_info,
'subitem_categories'=> $this->subitem_categories
)
);
}
ilCalendarCategories::wakeup (   $a_ser)
protected

Load from serialize string.

Parameters
stringserialize categories
Returns

Definition at line 192 of file class.ilCalendarCategories.php.

Referenced by initialize().

{
$info = unserialize($a_ser);
$this->categories = $info['categories'];
$this->categories_info = $info['categories_info'];
$this->subitem_categories = $info['subitem_categories'];
}

+ Here is the caller graph for this function:

Field Documentation

ilCalendarCategories::$categories = array()
protected

Definition at line 52 of file class.ilCalendarCategories.php.

ilCalendarCategories::$categories_info = array()
protected

Definition at line 53 of file class.ilCalendarCategories.php.

ilCalendarCategories::$db
protected

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

ilCalendarCategories::$instance = null
staticprotected

Definition at line 46 of file class.ilCalendarCategories.php.

Referenced by _getInstance().

ilCalendarCategories::$root_obj_id = 0
protected

Definition at line 57 of file class.ilCalendarCategories.php.

ilCalendarCategories::$root_ref_id = 0
protected

Definition at line 56 of file class.ilCalendarCategories.php.

ilCalendarCategories::$subitem_categories = array()
protected

Definition at line 54 of file class.ilCalendarCategories.php.

ilCalendarCategories::$user_id
protected
const ilCalendarCategories::MODE_CONSULTATION = 7

Definition at line 44 of file class.ilCalendarCategories.php.

Referenced by ilCalendarBlockGUI\initCategories().

const ilCalendarCategories::MODE_MANAGE = 6

Definition at line 43 of file class.ilCalendarCategories.php.

Referenced by ilCalendarManageTableGUI\parse().

const ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP = 4
const ilCalendarCategories::MODE_REMOTE_ACCESS = 3
const ilCalendarCategories::MODE_REPOSITORY = 2

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