ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarCategories Class Reference

class for calendar categories More...

+ Collaboration diagram for ilCalendarCategories:

Public Member Functions

 setCHUserId ($a_user_id)
 Set ch user id.
 getCHUserId ()
 Get ch user id.
 getMode ()
 getTargetRefId ()
 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 ($a_target_ref_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
const MODE_PORTFOLIO_CONSULTATION = 8
const MODE_REMOTE_SELECTED = 9

Protected Member Functions

 __construct ($a_usr_id=0)
 Singleton instance.
 sleep ()
 Serialize categories.
 wakeup ($a_ser)
 Load from serialize string.
 setMode ($a_mode)
 setTargetRefId ($a_ref_id)
 readPDCalendars ()
 Read categories of user.
 readSelectedCalendar ($a_cal_id)
 Read info about selected calendar.
 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
 $mode = 0
 $categories = array()
 $categories_info = array()
 $subitem_categories = array()
 $root_ref_id = 0
 $root_obj_id = 0
 $ch_user_id = 0
 $target_ref_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 74 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::_getInstance (   $a_usr_id = 0)
static

get singleton instance

public

Parameters
int$a_usr_iduser id
Returns
ilCalendarCategories

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

References $instance.

Referenced by ilCalendarScheduleFilterBookings\__construct(), ilCalendarAppointmentsTableGUI\__construct(), ilCalendarChangedAppointmentsTableGUI\__construct(), ilCalendarPresentationGUI\__construct(), ilCalendarSchedule\__construct(), ilCalendarAppointmentColors\__construct(), ilCalendarAppointmentGUI\distributeNotifications(), ilCalendarAppointmentGUI\edit(), ilCalendarAppointmentGUI\editResponsibleUsers(), ilCalendarScheduleFilterHidden\filterCategories(), ilCalendarSelectionBlockGUI\getCalendars(), ilCalendarSchedule\getChangedEvents(), ilCalendarSchedule\getEvents(), ilCalendarAppointmentPanelGUI\getHTML(), ilCalendarRemoteAccessHandler\handleRequest(), ilPDCalendarBlockGUI\initCategories(), ilCalendarBlockGUI\initCategories(), ilCalendarAppointmentGUI\initForm(), ilCalendarCategoryGUI\initFormCategory(), ilCalendarCategoryTableGUI\parse(), ilCalendarManageTableGUI\parse(), ilPortfolioPageGUI\renderConsultationHours(), ilCalendarAppointmentGUI\save(), ilCalendarCategoryGUI\saveSelection(), ilCalendarMonthGUI\show(), ilCalendarCategoryGUI\showAssignedAppointments(), ilCalendarAppointmentGUI\showInfoScreen(), and ilCalendarPresentationGUI\synchroniseExternalCalendars().

{
if(self::$instance)
{
}
return self::$instance = new ilCalendarCategories($a_usr_id);
}

+ Here is the caller graph for this function:

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 137 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 111 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 920 of file class.ilCalendarCategories.php.

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

Referenced by readPDCalendars(), readSelectedCalendar(), 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 154 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 168 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 379 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 368 of file class.ilCalendarCategories.php.

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

public

Parameters
@return

Definition at line 341 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::getCHUserId ( )

Get ch user id.

Returns
type

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

References $ch_user_id.

Referenced by readConsultationHoursCalendar().

{
}

+ Here is the caller graph for this function:

ilCalendarCategories::getMode ( )

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

References $mode.

Referenced by initialize().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilCalendarCategories::getNotificationCalendars ( )

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

Returns

Definition at line 446 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 395 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::getTargetRefId ( )

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

References $target_ref_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 255 of file class.ilCalendarCategories.php.

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

{
$this->setMode($a_mode);
if($a_use_cache)
{
// Read categories from cache
if($cats = ilCalendarCache::getInstance()->getEntry($this->user_id.':'.$a_mode.':categories:'.(int) $a_source_ref_id))
{
if($this->getMode() != self::MODE_CONSULTATION &&
$this->getMode() != self::MODE_PORTFOLIO_CONSULTATION)
{
$this->wakeup($cats);
return;
}
}
}
switch($this->getMode())
{
case self::MODE_REMOTE_ACCESS:
include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
{
$this->readPDCalendars();
}
else
{
}
break;
case self::MODE_REMOTE_SELECTED:
$this->readSelectedCalendar($a_source_ref_id);
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->readPrivateCalendars();
$this->setTargetRefId($a_source_ref_id);
$this->readConsultationHoursCalendar($a_source_ref_id);
break;
case self::MODE_PORTFOLIO_CONSULTATION:
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 469 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 481 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 983 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 412 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 819 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 (   $a_target_ref_id = NULL)

Read personal consultation hours calendar.

Parameters
int$user_id
Returns

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

References $categories, $query, $res, $row, ilObject\_lookupObjId(), DB_FETCHMODE_OBJECT, getCHUserId(), setCHUserId(), and ilCalendarCategory\TYPE_CH.

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

{
global $ilDB;
if(!$this->getCHUserId())
{
$this->setCHUserId($this->user_id);
}
if($a_target_ref_id)
{
$target_obj_id = ilObject::_lookupObjId($a_target_ref_id);
$query = 'SELECT DISTINCT(cc.cat_id) FROM booking_entry be '.
'LEFT JOIN booking_obj_assignment bo ON be.booking_id = bo.booking_id '.
'JOIN cal_entries ce ON be.booking_id = ce.context_id '.
'JOIN cal_cat_assignments ca ON ce.cal_id = ca.cal_id '.
'JOIN cal_categories cc ON ca.cat_id = cc.cat_id '.
'WHERE ((bo.target_obj_id IS NULL) OR bo.target_obj_id = '.$ilDB->quote($target_obj_id,'integer').' ) '.
'AND cc.obj_id = '.$ilDB->quote($this->getCHUserId(),'integer');
$res = $ilDB->query($query);
$categories = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$categories[] = $row->cat_id;
}
{
$query = 'SELECT * FROM cal_categories '.
'WHERE '.$ilDB->in('cat_id',$categories,false,'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;
}
}
}
else // no category given
{
$query = "SELECT * FROM cal_categories cc ".
"WHERE type = ".$ilDB->quote(ilCalendarCategory::TYPE_CH,'integer').' '.
"AND obj_id = ".$ilDB->quote($this->getCHUserId(),'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;
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategories::readPDCalendars ( )
protected

Read categories of user.

protected

Parameters
@returnvoid

Definition at line 497 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 676 of file class.ilCalendarCategories.php.

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

Referenced by 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;
include_once './Services/Calendar/classes/class.ilCalendarShared.php';
if(in_array($row->cat_id, $accepted_ids))
{
$shared = new ilCalendarShared($row->cat_id);
if($shared->isEditableForUser($ilUser->getId()))
{
$this->categories_info[$row->cat_id]['editable'] = true;
}
else
{
$this->categories_info[$row->cat_id]['editable'] = false;
}
}
else
{
$this->categories_info[$row->cat_id]['editable'] = true;
}
$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 644 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 589 of file class.ilCalendarCategories.php.

References $GLOBALS, $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";
$subtree_query = $GLOBALS['tree']->getSubTreeQuery(
$this->root_ref_id,
array('object_reference.ref_id','object_data.obj_id'),
array('crs','grp','sess')
);
$res = $ilDB->query($subtree_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::readSelectedCalendar (   $a_cal_id)
protected

Read info about selected calendar.

Parameters
type$a_cal_id

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

References addSubitemCalendars(), readSelectedCategories(), and ilCalendarCategory\TYPE_OBJ.

Referenced by initialize().

{
include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
$cat = new ilCalendarCategory($a_cal_id);
if($cat->getType() == ilCalendarCategory::TYPE_OBJ)
{
$this->readSelectedCategories(array($cat->getObjId()));
}
else
{
$this->categories[] = $a_cal_id;
}
}

+ 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 852 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(), readSelectedCalendar(), 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 539 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::setCHUserId (   $a_user_id)

Set ch user id.

Parameters
int$a_user_id

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

Referenced by readConsultationHoursCalendar().

{
$this->ch_user_id = $a_user_id;
}

+ Here is the caller graph for this function:

ilCalendarCategories::setMode (   $a_mode)
protected

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

Referenced by initialize().

{
$this->mode = $a_mode;
}

+ Here is the caller graph for this function:

ilCalendarCategories::setTargetRefId (   $a_ref_id)
protected

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

Referenced by initialize().

{
$this->target_ref_id = $a_ref_id;
}

+ Here is the caller graph for this function:

ilCalendarCategories::sleep ( )
protected

Serialize categories.

Returns

Definition at line 183 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 199 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 56 of file class.ilCalendarCategories.php.

Referenced by readConsultationHoursCalendar().

ilCalendarCategories::$categories_info = array()
protected

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

ilCalendarCategories::$ch_user_id = 0
protected

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

Referenced by getCHUserId().

ilCalendarCategories::$db
protected

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

ilCalendarCategories::$instance = null
staticprotected

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

Referenced by _getInstance().

ilCalendarCategories::$mode = 0
protected

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

Referenced by getMode().

ilCalendarCategories::$root_obj_id = 0
protected

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

ilCalendarCategories::$root_ref_id = 0
protected

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

ilCalendarCategories::$subitem_categories = array()
protected

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

ilCalendarCategories::$target_ref_id = 0
protected

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

Referenced by getTargetRefId().

ilCalendarCategories::$user_id
protected

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

Referenced by initialize(), and readBookingCalendar().

const ilCalendarCategories::MODE_CONSULTATION = 7
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_REMOTE_SELECTED = 9
const ilCalendarCategories::MODE_REPOSITORY = 2

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