ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarCategories Class Reference

class for calendar categories More...

+ Collaboration diagram for ilCalendarCategories:

Public Member Functions

 __construct ($a_usr_id=0)
 Singleton instance. More...
 
 setCHUserId ($a_user_id)
 Set ch user id. More...
 
 getCHUserId ()
 Get ch user id. More...
 
 getMode ()
 
 getTargetRefId ()
 
 setSourceRefId ($a_val)
 Set source ref id. More...
 
 getSourceRefId ()
 Get source ref id. More...
 
 initialize ($a_mode, $a_source_ref_id=0, $a_use_cache=false, $a_cat_id=0)
 initialize visible categories More...
 
 getCategoryInfo ($a_cat_id)
 @access public More...
 
 getCategoriesInfo ()
 get categories More...
 
 getCategories ($a_include_subitem_calendars=false)
 get categories More...
 
 getSubitemCategories ($a_cat_id)
 get subitem categories for a specific category More...
 
 prepareCategoriesOfUserForSelection ()
 prepare categories of users for selection More...
 
 getNotificationCalendars ()
 Get all calendars that allow send of notifications (Editable and course group calendars) More...
 
 isEditable ($a_cat_id)
 check if category is editable More...
 
 isVisible ($a_cat_id)
 check if category is visible More...
 
 readSingleCalendar ($a_cat_id)
 
 readAllConsultationHoursCalendarOfContainer ($a_container_ref_id)
 Read personal consultation hours calendar of all tutors for a container. More...
 
 readConsultationHoursCalendar ($a_target_ref_id=null, $a_cat_id=0)
 Read personal consultation hours calendar. More...
 
 readBookingCalendar ($user_id=null)
 Read booking manager calendar. More...
 

Static Public Member Functions

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

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
 
const MODE_REPOSITORY_CONTAINER_ONLY = 10
 
const MODE_SINGLE_CALENDAR = 11
 

Protected Member Functions

 sleep ()
 Serialize categories. More...
 
 wakeup ($a_ser)
 Load from serialize string. More...
 
 setMode ($a_mode)
 
 setTargetRefId ($a_ref_id)
 
 readPDCalendars ()
 Read categories of user. More...
 
 readSelectedCalendar ($a_cal_id)
 Read info about selected calendar. More...
 
 readSelectedItemCalendars ()
 Read categories of selected items. More...
 
 readReposCalendars ($a_container_only=false)
 Read available repository calendars. More...
 
 readPublicCalendars ($cat_ids=null)
 Read public calendars. More...
 
 readPrivateCalendars ($only_cat_ids=null)
 Read private calendars. More...
 
 readSelectedCategories ($a_obj_ids, $a_source_ref_id=0)
 read selected categories More...
 
 addSubitemCalendars ()
 Add subitem calendars E.g. More...
 

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
 
 $logger = null
 ilLogger More...
 

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 34 of file class.ilCalendarCategories.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarCategories::__construct (   $a_usr_id = 0)

Singleton instance.

@access protected

Parameters
int$a_usr_iduser id
Returns

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

79 {
80 global $DIC;
81
82 $ilUser = $DIC['ilUser'];
83 $ilDB = $DIC['ilDB'];
84
85 $this->logger = $GLOBALS['DIC']->logger()->cal();
86
87 $this->user_id = $a_usr_id;
88 if (!$this->user_id) {
89 $this->user_id = $ilUser->getId();
90 }
91 $this->db = $ilDB;
92 }
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
global $DIC
Definition: saml.php:7
global $ilDB
$ilUser
Definition: imgupload.php:18

References $DIC, $GLOBALS, $ilDB, and $ilUser.

Member Function Documentation

◆ _getInstance()

static ilCalendarCategories::_getInstance (   $a_usr_id = 0)
static

get singleton instance

@access public

Parameters
int$a_usr_iduser id
Returns
ilCalendarCategories

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

103 {
104 if (self::$instance) {
105 return self::$instance;
106 }
107 return self::$instance = new ilCalendarCategories($a_usr_id);
108 }
class for calendar categories

References $instance.

Referenced by ilCalendarChangedAppointmentsTableGUI\__construct(), ilCalendarAppointmentsTableGUI\__construct(), ilCalendarPresentationGUI\__construct(), ilCalendarAppointmentColors\__construct(), ilCalendarScheduleFilterHidden\__construct(), ilCalendarScheduleFilterBookings\__construct(), ilCalendarActions\__construct(), ilCalendarSchedule\__construct(), ilCalendarScheduleFilterBookingPool\__construct(), ilAppointmentPresentationConsultationHoursGUI\collectPropertiesAndActions(), ilCalendarAppointmentGUI\distributeNotifications(), ilCalendarAppointmentGUI\edit(), ilCalendarAppointmentGUI\editResponsibleUsers(), ilPortfolioPageGUI\executeCommand(), ilCalendarScheduleFilterHidden\filterCategories(), ilAppointmentPresentationGUI\getCatInfo(), ilCalendarSchedule\getChangedEvents(), ilCalendarSchedule\getEvents(), ilCalendarAppointmentPanelGUI\getHTML(), ilCalendarAgendaListGUI\getHTML(), ilCalendarRemoteAccessHandler\handleRequest(), ilCalendarBlockGUI\initCategories(), ilPDCalendarBlockGUI\initCategories(), ilCalendarAppointmentGUI\initForm(), ilCalendarCategoryGUI\initFormCategory(), ilCalendarCategoryTableGUI\parse(), ilCalendarManageTableGUI\parse(), ilPortfolioPageGUI\renderConsultationHours(), ilCalendarAppointmentGUI\save(), ilCalendarCategoryGUI\saveSelection(), ilCalendarCategoryGUI\showAssignedAppointments(), ilCalendarAppointmentGUI\showInfoScreen(), and ilCalendarPresentationGUI\synchroniseExternalCalendars().

+ Here is the caller graph for this function:

◆ _isOwner()

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

check if user is owner of a category

@access public

Parameters
intusr_id
intcal_id
Returns
bool

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

146 {
147 global $DIC;
148
149 $ilDB = $DIC['ilDB'];
150
151 $query = "SELECT * FROM cal_categories " .
152 "WHERE cat_id = " . $ilDB->quote($a_cal_id, 'integer') . " " .
153 "AND obj_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
154 "AND type = " . $ilDB->quote(ilCalendarCategory::TYPE_USR, 'integer') . " ";
155 $res = $ilDB->query($query);
156 return $res->numRows() ? true : false;
157 }
$query
foreach($_POST as $key=> $value) $res

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

Referenced by ilCalendarShared\getSharedCalendarsForUser().

+ Here is the caller graph for this function:

◆ _lookupCategoryIdByObjId()

static ilCalendarCategories::_lookupCategoryIdByObjId (   $a_obj_id)
static

lookup category by obj_id

@access public

Parameters
intobj_id
Returns
int cat_id

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

119 {
120 global $DIC;
121
122 $ilDB = $DIC['ilDB'];
123
124 $query = "SELECT cat_id FROM cal_categories " .
125 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
126 "AND type = " . $ilDB->quote(ilCalendarCategory::TYPE_OBJ, 'integer') . " ";
127
128 $res = $ilDB->query($query);
129 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
130 return $row->cat_id;
131 }
132 return 0;
133 }
$row

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and ilCalendarCategory\TYPE_OBJ.

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

+ Here is the caller graph for this function:

◆ addSubitemCalendars()

ilCalendarCategories::addSubitemCalendars ( )
protected

Add subitem calendars E.g.

session calendars in courses, groups

Parameters

return

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

1044 {
1045 global $DIC;
1046
1047 $ilDB = $DIC->database();
1048 $access = $DIC->access();
1049
1050 $course_ids = array();
1051 foreach ($this->categories as $cat_id) {
1052 if ($this->categories_info[$cat_id]['obj_type'] == 'crs' or $this->categories_info[$cat_id]['obj_type'] == 'grp') {
1053 $course_ids[] = $this->categories_info[$cat_id]['obj_id'];
1054 }
1055 }
1056
1057 $query = "SELECT od2.obj_id sess_id, od1.obj_id crs_id,cat_id, or2.ref_id sess_ref_id FROM object_data od1 " .
1058 "JOIN object_reference or1 ON od1.obj_id = or1.obj_id " .
1059 "JOIN tree t ON or1.ref_id = t.parent " .
1060 "JOIN object_reference or2 ON t.child = or2.ref_id " .
1061 "JOIN object_data od2 ON or2.obj_id = od2.obj_id " .
1062 "JOIN cal_categories cc ON od2.obj_id = cc.obj_id " .
1063 "WHERE " . $ilDB->in('od2.type', array('sess','exc'), false, 'text') .
1064 "AND (od1.type = 'crs' OR od1.type = 'grp') " .
1065 "AND " . $ilDB->in('od1.obj_id', $course_ids, false, 'integer') . ' ' .
1066 "AND or2.deleted IS NULL";
1067
1068 $res = $ilDB->query($query);
1069 $cat_ids = array();
1070 $course_sessions = array();
1071 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1072 if (
1073 !$access->checkAccessOfUser($this->user_id, 'read', '', $row->sess_ref_id) ||
1074 !$access->checkAccessOfUser($this->user_id, 'visible', '', $row->sess_ref_id)
1075 ) {
1076 continue;
1077 }
1078 $cat_ids[] = $row->cat_id;
1079 $course_sessions[$row->crs_id][$row->sess_id] = $row->cat_id;
1080 $this->subitem_categories[] = $row->cat_id;
1081 }
1082
1083 foreach ($this->categories as $cat_id) {
1084 if (
1085 ($this->categories_info[$cat_id]['obj_type'] == 'crs' ||
1086 $this->categories_info[$cat_id]['obj_type'] == 'grp') &&
1087 isset($this->categories_info[$cat_id]['obj_id']) &&
1088 isset($course_sessions[$this->categories_info[$cat_id]['obj_id']]) &&
1089 is_array($course_sessions[$this->categories_info[$cat_id]['obj_id']])) {
1090 foreach ($course_sessions[$this->categories_info[$cat_id]['obj_id']] as $sess_id => $sess_cat_id) {
1091 $this->categories_info[$cat_id]['subitem_ids'][$sess_id] = $sess_cat_id;
1092 $this->categories_info[$cat_id]['subitem_obj_ids'][$sess_cat_id] = $sess_id;
1093 }
1094 } else {
1095 $this->categories_info[$cat_id]['subitem_ids'] = array();
1096 $this->categories_info[$cat_id]['subitem_obj_ids'] = array();
1097 }
1098 }
1099 }

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

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

+ Here is the caller graph for this function:

◆ deletePDItemsCache()

static ilCalendarCategories::deletePDItemsCache (   $a_usr_id)
static

Delete cache (add remove desktop item)

Parameters
object$a_usr_id
Returns

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

165 {
166 ilCalendarCache::getInstance()->deleteByAdditionalKeys(
167 $a_usr_id,
168 self::MODE_PERSONAL_DESKTOP_ITEMS,
169 'categories'
170 );
171 }
static getInstance()
get singleton instance

References ilCalendarCache\getInstance().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteRepositoryCache()

static ilCalendarCategories::deleteRepositoryCache (   $a_usr_id)
static

Delete cache.

Parameters
object$a_usr_id
Returns

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

179 {
180 ilCalendarCache::getInstance()->deleteByAdditionalKeys(
181 $a_usr_id,
182 self::MODE_REPOSITORY,
183 'categories'
184 );
185 }

References ilCalendarCache\getInstance().

Referenced by ilCalendarAppEventListener\handleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCategories()

ilCalendarCategories::getCategories (   $a_include_subitem_calendars = false)

get categories

Parameters
$a_include_subitemsinclude subitem calendars @access public
Returns

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

414 {
415 if ($a_include_subitem_calendars) {
416 return array_merge((array) $this->categories, (array) $this->subitem_categories);
417 }
418
419 return $this->categories ? $this->categories : array();
420 }

◆ getCategoriesInfo()

ilCalendarCategories::getCategoriesInfo ( )

get categories

@access public

Parameters

return

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

403 {
404 return $this->categories_info ? $this->categories_info : array();
405 }

◆ getCategoryInfo()

ilCalendarCategories::getCategoryInfo (   $a_cat_id)

@access public

Parameters

return

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

380 {
381 if (isset($this->categories_info[$a_cat_id])) {
382 return $this->categories_info[$a_cat_id];
383 }
384
385 if (in_array($a_cat_id, (array) $this->subitem_categories)) {
386 foreach ($this->categories as $cat_id) {
387 if (in_array($a_cat_id, $this->categories_info[$cat_id]['subitem_ids'])) {
388 return $this->categories_info[$cat_id];
389 }
390 }
391 }
392 }

◆ getCHUserId()

ilCalendarCategories::getCHUserId ( )

Get ch user id.

Returns
type

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

References $ch_user_id.

Referenced by readAllConsultationHoursCalendarOfContainer(), and readConsultationHoursCalendar().

+ Here is the caller graph for this function:

◆ getMode()

ilCalendarCategories::getMode ( )

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

References $mode.

Referenced by initialize().

+ Here is the caller graph for this function:

◆ getNotificationCalendars()

ilCalendarCategories::getNotificationCalendars ( )

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

Returns

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

476 {
477 $not = array();
478 foreach ($this->categories_info as $info) {
479 if ($info['type'] == ilCalendarCategory::TYPE_OBJ and $info['editable'] == true) {
480 if (ilObject::_lookupType($info['obj_id']) == 'crs' or ilObject::_lookupType($info['obj_id']) == 'grp') {
481 $not[] = $info['cat_id'];
482 }
483 }
484 }
485 return $not;
486 }
static _lookupType($a_id, $a_reference=false)
lookup object type
$info
Definition: index.php:5

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

+ Here is the call graph for this function:

◆ getSourceRefId()

ilCalendarCategories::getSourceRefId ( )

Get source ref id.

Returns
int ref id of current context/source

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

References $root_ref_id.

◆ getSubitemCategories()

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 428 of file class.ilCalendarCategories.php.

429 {
430 if (!isset($this->categories_info[$a_cat_id]['subitem_ids'])) {
431 return array($a_cat_id);
432 }
433 return array_merge((array) $this->categories_info[$a_cat_id]['subitem_ids'], array($a_cat_id));
434 }

◆ getTargetRefId()

ilCalendarCategories::getTargetRefId ( )

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

References $target_ref_id.

◆ initialize()

ilCalendarCategories::initialize (   $a_mode,
  $a_source_ref_id = 0,
  $a_use_cache = false,
  $a_cat_id = 0 
)

initialize visible categories

@access public

Parameters
intmode
intref_id of root node
Returns

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

285 {
286 if ($this->getMode() != 0) {
287 include_once("./Services/Calendar/exceptions/class.ilCalCategoriesInitializedMultipleException.php");
288 throw new ilCalCategoriesInitializedMultipleException("ilCalendarCategories is initialized multiple times for user " . $this->user_id . ".");
289 }
290
291 $this->setMode($a_mode);
292
293 // see comments in https://mantis.ilias.de/view.php?id=25254
294 if ($a_use_cache && $this->getMode() != self::MODE_REPOSITORY_CONTAINER_ONLY) {
295 // Read categories from cache
296 if ($cats = ilCalendarCache::getInstance()->getEntry($this->user_id . ':' . $a_mode . ':categories:' . (int) $a_source_ref_id)) {
297 if ($this->getMode() != self::MODE_REPOSITORY &&
298 $this->getMode() != self::MODE_CONSULTATION &&
299 $this->getMode() != self::MODE_PORTFOLIO_CONSULTATION) {
300 $this->wakeup($cats);
301 return;
302 }
303 }
304 }
305
306 switch ($this->getMode()) {
308 include_once('./Services/Calendar/classes/class.ilCalendarUserSettings.php');
310 $this->readPDCalendars();
311 } else {
313 }
314 break;
315
317 $this->readSelectedCalendar($a_source_ref_id);
318 break;
319
321 $this->readPDCalendars();
322 break;
323
326 break;
327
329 $this->root_ref_id = $a_source_ref_id;
330 $this->root_obj_id = ilObject::_lookupObjId($this->root_ref_id);
331 $this->readReposCalendars();
332 break;
333
335 $this->root_ref_id = $a_source_ref_id;
336 $this->root_obj_id = ilObject::_lookupObjId($this->root_ref_id);
337 $this->readReposCalendars(true);
338 break;
339
341 $this->readPDCalendars();
343 break;
344
346 #$this->readPrivateCalendars();
347 $this->setTargetRefId($a_source_ref_id);
348 $this->readConsultationHoursCalendar($a_source_ref_id);
349 break;
350
353 break;
354
356 $this->readSingleCalendar($a_cat_id);
357 break;
358 }
359
360 if ($a_use_cache) {
361 // Store in cache
362 ilCalendarCache::getInstance()->storeEntry(
363 $this->user_id . ':' . $a_mode . ':categories:' . (int) $a_source_ref_id,
364 $this->sleep(),
365 $this->user_id,
366 $a_mode,
367 'categories'
368 );
369 }
370 }
Exception being thrown calendar categories is initiliazed multiple times for the same user.
readPDCalendars()
Read categories of user.
readSelectedItemCalendars()
Read categories of selected items.
readConsultationHoursCalendar($a_target_ref_id=null, $a_cat_id=0)
Read personal consultation hours calendar.
readSelectedCalendar($a_cal_id)
Read info about selected calendar.
wakeup($a_ser)
Load from serialize string.
sleep()
Serialize categories.
readReposCalendars($a_container_only=false)
Read available repository calendars.
static _getInstance()
get instance for logged in user
static _lookupObjId($a_id)

References ilCalendarUserSettings\_getInstance(), ilObject\_lookupObjId(), ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ilCalendarCache\getInstance(), getMode(), MODE_CONSULTATION, MODE_MANAGE, MODE_PERSONAL_DESKTOP_ITEMS, MODE_PERSONAL_DESKTOP_MEMBERSHIP, MODE_PORTFOLIO_CONSULTATION, MODE_REMOTE_ACCESS, MODE_REMOTE_SELECTED, MODE_REPOSITORY, MODE_REPOSITORY_CONTAINER_ONLY, MODE_SINGLE_CALENDAR, readConsultationHoursCalendar(), readPDCalendars(), readReposCalendars(), readSelectedCalendar(), readSelectedItemCalendars(), readSingleCalendar(), setMode(), setTargetRefId(), sleep(), and wakeup().

+ Here is the call graph for this function:

◆ isEditable()

ilCalendarCategories::isEditable (   $a_cat_id)

check if category is editable

@access public

Parameters
int$a_cat_idcategory id
Returns

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

496 {
497 return isset($this->categories_info[$a_cat_id]['editable']) and $this->categories_info[$a_cat_id]['editable'];
498 }

◆ isVisible()

ilCalendarCategories::isVisible (   $a_cat_id)

check if category is visible

@access public

Parameters
int$a_cat_idcategory id
Returns

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

508 {
509 return in_array($a_cat_id, $this->categories) or
510 in_array($a_cat_id, (array) $this->subitem_categories);
511 }

◆ lookupPrivateCategories()

static ilCalendarCategories::lookupPrivateCategories (   $a_user_id)
static

Lookup private categories of user.

Parameters

return

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

1108 {
1109 global $DIC;
1110
1111 $ilDB = $DIC['ilDB'];
1112
1113 // First read private calendars of user
1114 $set = $ilDB->query("SELECT * FROM cal_categories " .
1115 "WHERE type = " . $ilDB->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
1116 "AND obj_id = " . $ilDB->quote($a_user_id, 'integer'));
1117 $cats = array();
1118 while ($rec = $ilDB->fetchAssoc($set)) {
1119 $cats[] = $rec;
1120 }
1121 return $cats;
1122 }

References $DIC, $ilDB, and ilCalendarCategory\TYPE_USR.

Referenced by ilUserExporter\getXmlExportTailDependencies().

+ Here is the caller graph for this function:

◆ prepareCategoriesOfUserForSelection()

ilCalendarCategories::prepareCategoriesOfUserForSelection ( )

prepare categories of users for selection

@access public

Parameters
intuser id
Returns

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

445 {
446 global $DIC;
447
448 $lng = $DIC['lng'];
449
450 $has_personal_calendar = false;
451 foreach ($this->categories_info as $info) {
452 if ($info['obj_type'] == 'sess' || $info['obj_type'] == 'exc') {
453 continue;
454 }
455 if ($info['type'] == ilCalendarCategory::TYPE_USR and $info['editable']) {
456 $has_personal_calendar = true;
457 }
458
459 if ($info['editable']) {
460 $cats[$info['cat_id']] = $info['title'];
461 }
462 }
463 // If there
464 if (!$has_personal_calendar) {
465 $cats[0] = $lng->txt('cal_default_calendar');
466 }
467 return $cats ? $cats : array();
468 }
$lng

References $DIC, $info, $lng, and ilCalendarCategory\TYPE_USR.

◆ readAllConsultationHoursCalendarOfContainer()

ilCalendarCategories::readAllConsultationHoursCalendarOfContainer (   $a_container_ref_id)

Read personal consultation hours calendar of all tutors for a container.

Parameters
int$a_container_ref_idcontainer ref id

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

839 {
840 include_once "Modules/Course/classes/class.ilCourseParticipants.php";
841 $obj_id = ilObject::_lookupObjId($a_container_ref_id);
842 $participants = ilCourseParticipants::_getInstanceByObjId($obj_id);
843 $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
844 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
846 $old_ch = $this->getCHUserId();
847 foreach ($users as $user) {
848 $this->setCHUserId($user);
849 $this->readConsultationHoursCalendar($a_container_ref_id);
850 }
851 $this->setCHUserId($old_ch);
852 }
$users
Definition: authpage.php:44
static lookupBookableUsersForObject($a_obj_id, $a_user_ids)
Consultation hours are offered if 1) consultation hour owner is admin or tutor and no object assignme...
setCHUserId($a_user_id)
Set ch user id.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
$user
Definition: migrateto20.php:57

References $user, $users, ilCourseParticipants\_getInstanceByObjId(), ilObject\_lookupObjId(), getCHUserId(), ilBookingEntry\lookupBookableUsersForObject(), readConsultationHoursCalendar(), and setCHUserId().

Referenced by readReposCalendars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readBookingCalendar()

ilCalendarCategories::readBookingCalendar (   $user_id = null)

Read booking manager calendar.

Parameters
int$user_id
Returns

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

941 {
942 global $DIC;
943
944 $ilDB = $DIC['ilDB'];
945
946 if (!$user_id) {
948 }
949
950 $query = "SELECT * FROM cal_categories " .
951 "WHERE type = " . $ilDB->quote(ilCalendarCategory::TYPE_BOOK, 'integer') . ' ' .
952 "AND obj_id = " . $ilDB->quote($user_id, 'integer');
953 $res = $ilDB->query($query);
954 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
955 $this->categories[] = $row->cat_id;
956 $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
957 $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
958 $this->categories_info[$row->cat_id]['title'] = $row->title;
959 $this->categories_info[$row->cat_id]['color'] = $row->color;
960 $this->categories_info[$row->cat_id]['type'] = $row->type;
961 $this->categories_info[$row->cat_id]['editable'] = false;
962 $this->categories_info[$row->cat_id]['settings'] = false;
963 $this->categories_info[$row->cat_id]['accepted'] = false;
964 $this->categories_info[$row->cat_id]['remote'] = false;
965 }
966 }

References $DIC, $ilDB, $query, $res, $row, $user_id, ilDBConstants\FETCHMODE_OBJECT, and ilCalendarCategory\TYPE_BOOK.

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

+ Here is the caller graph for this function:

◆ readConsultationHoursCalendar()

ilCalendarCategories::readConsultationHoursCalendar (   $a_target_ref_id = null,
  $a_cat_id = 0 
)

Read personal consultation hours calendar.

Parameters
int$user_id
Returns

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

860 {
861 global $DIC;
862
863 $ilDB = $DIC['ilDB'];
864 $lng = $DIC['lng'];
865
866 if (!$this->getCHUserId()) {
867 $this->setCHUserId($this->user_id);
868 }
869
870 if ($a_target_ref_id) {
871 $target_obj_id = ilObject::_lookupObjId($a_target_ref_id);
872
873 $query = 'SELECT DISTINCT(cc.cat_id) FROM booking_entry be ' .
874 'LEFT JOIN booking_obj_assignment bo ON be.booking_id = bo.booking_id ' .
875 'JOIN cal_entries ce ON be.booking_id = ce.context_id ' .
876 'JOIN cal_cat_assignments ca ON ce.cal_id = ca.cal_id ' .
877 'JOIN cal_categories cc ON ca.cat_id = cc.cat_id ' .
878 'WHERE ((bo.target_obj_id IS NULL) OR bo.target_obj_id = ' . $ilDB->quote($target_obj_id, 'integer') . ' ) ';
879
880 // limit only to user if no cat id is given
881 if ($a_cat_id == 0) {
882 $query .= 'AND cc.obj_id = ' . $ilDB->quote($this->getCHUserId(), 'integer');
883 }
884
885
886 $res = $ilDB->query($query);
887 $categories = array();
888 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
889 if ($a_cat_id == 0 || $row->cat_id == $a_cat_id) {
890 $categories[] = $row->cat_id;
891 }
892 }
893
894 if ($categories) {
895 $query = 'SELECT * FROM cal_categories ' .
896 'WHERE ' . $ilDB->in('cat_id', $categories, false, 'integer');
897 $res = $ilDB->query($query);
898 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
899 $this->categories[] = $row->cat_id;
900 $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
901 $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
902 $this->categories_info[$row->cat_id]['title'] = ilObjUser::_lookupFullname($row->obj_id);
903 $this->categories_info[$row->cat_id]['color'] = $row->color;
904 $this->categories_info[$row->cat_id]['type'] = $row->type;
905 $this->categories_info[$row->cat_id]['editable'] = false;
906 $this->categories_info[$row->cat_id]['settings'] = false;
907 $this->categories_info[$row->cat_id]['accepted'] = false;
908 $this->categories_info[$row->cat_id]['remote'] = false;
909 }
910 }
911 } else { // no category given
912 $filter = ($a_cat_id > 0)
913 ? " AND cat_id = " . $ilDB->quote($a_cat_id, "integer")
914 : " AND obj_id = " . $ilDB->quote($this->getCHUserId(), 'integer');
915
916 $query = "SELECT * FROM cal_categories cc " .
917 "WHERE type = " . $ilDB->quote(ilCalendarCategory::TYPE_CH, 'integer') . ' ' . $filter;
918 $res = $ilDB->query($query);
919 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
920 $this->categories[] = $row->cat_id;
921 $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
922 $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
923 $this->categories_info[$row->cat_id]['title'] = $row->title;
924 $this->categories_info[$row->cat_id]['color'] = $row->color;
925 $this->categories_info[$row->cat_id]['type'] = $row->type;
926 $this->categories_info[$row->cat_id]['editable'] = false;
927 $this->categories_info[$row->cat_id]['settings'] = false;
928 $this->categories_info[$row->cat_id]['accepted'] = false;
929 $this->categories_info[$row->cat_id]['remote'] = false;
930 }
931 }
932 return true;
933 }
static _lookupFullname($a_user_id)
Lookup Full Name.

References $categories, $DIC, $ilDB, $lng, $query, $res, $row, ilObjUser\_lookupFullname(), ilObject\_lookupObjId(), ilDBConstants\FETCHMODE_OBJECT, getCHUserId(), setCHUserId(), and ilCalendarCategory\TYPE_CH.

Referenced by initialize(), readAllConsultationHoursCalendarOfContainer(), readPDCalendars(), readSelectedItemCalendars(), and readSingleCalendar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPDCalendars()

ilCalendarCategories::readPDCalendars ( )
protected

Read categories of user.

@access protected

Parameters

return void

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

524 {
525 global $DIC;
526
527 $rbacsystem = $DIC['rbacsystem'];
528
529
530 $this->readPublicCalendars();
531 $this->readPrivateCalendars();
533 $this->readBookingCalendar();
534
535 include_once('./Services/Membership/classes/class.ilParticipants.php');
538
539 $this->addSubitemCalendars();
540 }
addSubitemCalendars()
Add subitem calendars E.g.
readSelectedCategories($a_obj_ids, $a_source_ref_id=0)
read selected categories
readPrivateCalendars($only_cat_ids=null)
Read private calendars.
readBookingCalendar($user_id=null)
Read booking manager calendar.
readPublicCalendars($cat_ids=null)
Read public calendars.
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership

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

Referenced by initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPrivateCalendars()

ilCalendarCategories::readPrivateCalendars (   $only_cat_ids = null)
protected

Read private calendars.

@access protected

Returns

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

762 {
763 global $DIC;
764
765 $ilUser = $DIC['ilUser'];
766 global $DIC;
767
768 $ilDB = $DIC['ilDB'];
769
770 $in = "";
771 if (is_array($only_cat_ids)) {
772 $in = " AND " . $this->db->in('cat_id', $only_cat_ids, false, 'integer') . " ";
773 }
774
775 // First read private calendars of user
776 $query = "SELECT cat_id FROM cal_categories " .
777 "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
778 "AND obj_id = " . $this->db->quote($ilUser->getId(), 'integer') . " " . $in;
779 $res = $this->db->query($query);
780 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
781 $cat_ids[] = $row->cat_id;
782 }
783
784 // Read shared calendars
785 include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
787 if (!$cat_ids = array_merge((array) $cat_ids, $accepted_ids)) {
788 return true;
789 }
790
791 if (is_array($only_cat_ids)) {
792 $cat_ids = array_filter($cat_ids, function ($id) use ($only_cat_ids) {
793 return in_array($id, $only_cat_ids);
794 });
795 }
796
797 // user categories
798 $query = "SELECT * FROM cal_categories " .
799 "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
800 "AND " . $ilDB->in('cat_id', $cat_ids, false, 'integer') . " " .
801 "ORDER BY title ";
802
803 $res = $this->db->query($query);
804 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
805 $this->categories[] = $row->cat_id;
806 $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
807 $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
808 $this->categories_info[$row->cat_id]['title'] = $row->title;
809 $this->categories_info[$row->cat_id]['color'] = $row->color;
810 $this->categories_info[$row->cat_id]['type'] = $row->type;
811
812 include_once './Services/Calendar/classes/class.ilCalendarShared.php';
813 if (in_array($row->cat_id, $accepted_ids)) {
814 $shared = new ilCalendarShared($row->cat_id);
815 if ($shared->isEditableForUser($ilUser->getId())) {
816 $this->categories_info[$row->cat_id]['editable'] = true;
817 } else {
818 $this->categories_info[$row->cat_id]['editable'] = false;
819 }
820 } else {
821 $this->categories_info[$row->cat_id]['editable'] = true;
822 }
823 if ($ilUser->getId() == $row->obj_id) {
824 $this->categories_info[$row->cat_id]['settings'] = true;
825 } else {
826 $this->categories_info[$row->cat_id]['settings'] = false;
827 }
828
829 $this->categories_info[$row->cat_id]['accepted'] = in_array($row->cat_id, $accepted_ids);
830 $this->categories_info[$row->cat_id]['remote'] = ($row->loc_type == ilCalendarCategory::LTYPE_REMOTE);
831 }
832 }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
static getAcceptedCalendars($a_usr_id)
get accepted shared calendars
Handles shared calendars.
if(!array_key_exists('StateId', $_REQUEST)) $id

References $DIC, $id, $ilDB, $ilUser, $in, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, ilCalendarSharedStatus\getAcceptedCalendars(), ilCalendarCategory\LTYPE_REMOTE, and ilCalendarCategory\TYPE_USR.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPublicCalendars()

ilCalendarCategories::readPublicCalendars (   $cat_ids = null)
protected

Read public calendars.

@access protected

Returns

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

722 {
723 global $DIC;
724
725 $rbacsystem = $DIC['rbacsystem'];
726 $ilAccess = $DIC['ilAccess'];
727
728 $in = "";
729 if (is_array($cat_ids)) {
730 $in = " AND " . $this->db->in('cat_id', $cat_ids, false, 'integer') . " ";
731 }
732
733 // global categories
734 $query = "SELECT * FROM cal_categories " .
735 "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_GLOBAL, 'integer') . " " . $in .
736 "ORDER BY title ";
737
738 $res = $this->db->query($query);
739 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
740 $this->categories[] = $row->cat_id;
741 $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
742 $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
743 $this->categories_info[$row->cat_id]['title'] = $row->title;
744 $this->categories_info[$row->cat_id]['color'] = $row->color;
745 $this->categories_info[$row->cat_id]['type'] = $row->type;
746 $this->categories_info[$row->cat_id]['editable'] = $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId());
747 $this->categories_info[$row->cat_id]['settings'] = $rbacsystem->checkAccess('write', ilCalendarSettings::_getInstance()->getCalendarSettingsId());
748 $this->categories_info[$row->cat_id]['accepted'] = false;
749 $this->categories_info[$row->cat_id]['remote'] = ($row->loc_type == ilCalendarCategory::LTYPE_REMOTE);
750 }
751
752 return true;
753 }
static _getInstance()
get singleton instance

References $DIC, $in, $query, $res, $row, ilCalendarSettings\_getInstance(), ilDBConstants\FETCHMODE_OBJECT, ilCalendarCategory\LTYPE_REMOTE, and ilCalendarCategory\TYPE_GLOBAL.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readReposCalendars()

ilCalendarCategories::readReposCalendars (   $a_container_only = false)
protected

Read available repository calendars.

@access protected

Parameters

return

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

619 {
620 global $DIC;
621
622 $ilAccess = $DIC['ilAccess'];
623 $tree = $DIC['tree'];
624 global $DIC;
625
626 $ilDB = $DIC['ilDB'];
627
628 if (!$a_container_only) {
629 $this->readPublicCalendars();
630 $this->readPrivateCalendars();
631 //$this->readConsultationHoursCalendar($this->root_ref_id);
632 $this->readAllConsultationHoursCalendarOfContainer($this->root_ref_id);
633 }
634
635
636
637 #$query = "SELECT ref_id,obd.obj_id obj_id FROM tree t1 ".
638 # "JOIN object_reference obr ON t1.child = obr.ref_id ".
639 # "JOIN object_data obd ON obd.obj_id = obr.obj_id ".
640 # "WHERE t1.lft >= (SELECT lft FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
641 # "AND t1.lft <= (SELECT rgt FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
642 # "AND ".$ilDB->in('type',array('crs','grp','sess'),false,'text')." ".
643 # "AND tree = 1";
644
645 // alternative 1: do not aggregate items of current course
646 if (!true) { //
647 $subtree_query = $GLOBALS['DIC']['tree']->getSubTreeQuery(
648 $this->root_ref_id,
649 array('object_reference.ref_id', 'object_data.obj_id'),
650 array('crs', 'grp', 'sess', 'exc')
651 );
652
653 $res = $ilDB->query($subtree_query);
654 $obj_ids = array();
655 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
656 if ($tree->isDeleted($row->ref_id)) {
657 continue;
658 }
659
660 $obj_type = ilObject::_lookupType($row->obj_id);
661 if ($obj_type == 'crs' or $obj_type == 'grp') {
662 //Added for calendar revision --> https://goo.gl/CXGTRF
663 //In 5.2-trunk, the booking pools did not appear in the marginal calendar.
664 $this->readBookingCalendar();
665 // Check for global/local activation
666 if (!ilCalendarSettings::_getInstance()->lookupCalendarActivated($row->obj_id)) {
667 continue;
668 }
669 }
670 if ($ilAccess->checkAccess('read', '', $row->ref_id)) {
671 $obj_ids[] = $row->obj_id;
672 }
673 }
674 $this->readSelectedCategories($obj_ids, $this->root_ref_id);
675 } else { // alternative 2: aggregate items of current course (discussion with timon 3.8.3017: this is the current preference)
676 $this->readSelectedCategories(array($this->root_obj_id), $this->root_ref_id);
677 }
678
679 $this->addSubitemCalendars();
680
681
682 if (!$a_container_only) {
685 }
686 }
readAllConsultationHoursCalendarOfContainer($a_container_ref_id)
Read personal consultation hours calendar of all tutors for a container.

References $DIC, $GLOBALS, $ilDB, $res, $row, $tree, ilCalendarSettings\_getInstance(), ilParticipants\_getMembershipByType(), ilObject\_lookupType(), addSubitemCalendars(), ilDBConstants\FETCHMODE_OBJECT, readAllConsultationHoursCalendarOfContainer(), readBookingCalendar(), readPrivateCalendars(), readPublicCalendars(), and readSelectedCategories().

Referenced by initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSelectedCalendar()

ilCalendarCategories::readSelectedCalendar (   $a_cal_id)
protected

Read info about selected calendar.

Parameters
type$a_cal_id

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

547 {
548 include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
549 $cat = new ilCalendarCategory($a_cal_id);
550 if ($cat->getType() == ilCalendarCategory::TYPE_OBJ) {
551 $this->readSelectedCategories(array($cat->getObjId()));
552 $this->addSubitemCalendars();
553 } else {
554 $this->categories[] = $a_cal_id;
555 }
556 }
Stores calendar categories.

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

Referenced by initialize(), and readSingleCalendar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSelectedCategories()

ilCalendarCategories::readSelectedCategories (   $a_obj_ids,
  $a_source_ref_id = 0 
)
protected

read selected categories

@access protected

Returns

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

975 {
976 global $DIC;
977
978 $ilAccess = $DIC['ilAccess'];
979 $tree = $DIC['tree'];
980 global $DIC;
981
982 $ilDB = $DIC['ilDB'];
983
984 if (!count($a_obj_ids)) {
985 return true;
986 }
987
988 $query = "SELECT * FROM cal_categories " .
989 "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_OBJ, 'integer') . " " .
990 "AND " . $ilDB->in('obj_id', $a_obj_ids, false, 'integer') . " " .
991 "ORDER BY title ";
992
993 $res = $this->db->query($query);
994 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
995 // check activation/deactivation
996 $obj_type = ilObject::_lookupType($row->obj_id);
997 if ($obj_type == 'crs' or $obj_type == 'grp') {
998 if (!ilCalendarSettings::_getInstance()->lookupCalendarActivated($row->obj_id)) {
999 continue;
1000 }
1001 }
1002
1003 $editable = false;
1004 $exists = false;
1005 $settings = false;
1006 foreach (ilObject::_getAllReferences($row->obj_id) as $ref_id) {
1007 if ($ilAccess->checkAccess('edit_event', '', $ref_id)) {
1008 $settings = true;
1009 }
1010 if ($ilAccess->checkAccess('edit_event', '', $ref_id)) {
1011 $exists = true;
1012 $editable = true;
1013 break;
1014 } elseif ($ilAccess->checkAccess('read', '', $ref_id)) {
1015 $exists = true;
1016 }
1017 }
1018 if (!$exists) {
1019 continue;
1020 }
1021 $this->categories_info[$row->cat_id]['editable'] = $editable;
1022 $this->categories_info[$row->cat_id]['settings'] = $settings;
1023
1024 $this->categories[] = $row->cat_id;
1025 $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
1026 $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
1027 $this->categories_info[$row->cat_id]['color'] = $row->color;
1028 #$this->categories_info[$row->cat_id]['title'] = ilObject::_lookupTitle($row->obj_id);
1029 $this->categories_info[$row->cat_id]['title'] = $row->title;
1030 $this->categories_info[$row->cat_id]['obj_type'] = ilObject::_lookupType($row->obj_id);
1031 $this->categories_info[$row->cat_id]['type'] = $row->type;
1032 $this->categories_info[$row->cat_id]['remote'] = false;
1033 $this->categories_info[$row->cat_id]['source_ref_id'] = $a_source_ref_id;
1034 }
1035 }
static _getAllReferences($a_id)
get all reference ids of object

References $DIC, $ilDB, $query, $res, $row, $tree, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilObject\_lookupType(), ilDBConstants\FETCHMODE_OBJECT, and ilCalendarCategory\TYPE_OBJ.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSelectedItemCalendars()

ilCalendarCategories::readSelectedItemCalendars ( )
protected

Read categories of selected items.

Parameters

return

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

565 {
566 global $DIC;
567
568 $ilUser = $DIC['ilUser'];
569 $ilAccess = $DIC['ilAccess'];
570
571 $this->readPublicCalendars();
572 $this->readPrivateCalendars();
574 $this->readBookingCalendar();
575
576 $obj_ids = array();
577
578 $courses = array();
579 $groups = array();
580 $sessions = array();
581 $exercises = array();
582 foreach (ilObjUser::_lookupDesktopItems($ilUser->getId(), array('crs','grp','sess','exc')) as $item) {
583 if ($ilAccess->checkAccess('read', '', $item['ref_id'])) {
584 switch ($item['type']) {
585 case 'crs':
586 $courses[] = $item['obj_id'];
587 break;
588
589 case 'sess':
590 $sessions[] = $item['obj_id'];
591 break;
592
593 case 'grp':
594 $groups[] = $item['obj_id'];
595 break;
596
597 case 'exc':
598 $exercises[] = $item['obj_id'];
599 break;
600 }
601 }
602 }
603 $this->readSelectedCategories($courses);
604 $this->readSelectedCategories($sessions);
605 $this->readSelectedCategories($groups);
606 $this->readSelectedCategories($exercises);
607
608 $this->addSubitemCalendars();
609 }
static _lookupDesktopItems($user_id, $a_types="")
get all desktop items of user and specified type

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

Referenced by initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSingleCalendar()

ilCalendarCategories::readSingleCalendar (   $a_cat_id)

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

689 {
690 include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
691 $cat = new ilCalendarCategory($a_cat_id);
692 switch ($cat->getType()) {
694 $this->readSelectedCalendar($a_cat_id);
695 break;
696
698 $this->readPublicCalendars(array($a_cat_id));
699 break;
700
702 $this->readPrivateCalendars(array($a_cat_id));
703 break;
704
706 $this->readConsultationHoursCalendar($this->root_ref_id, $a_cat_id);
707 break;
708
710 $this->readBookingCalendar();
711 break;
712 }
713 }

References readBookingCalendar(), readConsultationHoursCalendar(), readPrivateCalendars(), readPublicCalendars(), readSelectedCalendar(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCHUserId()

ilCalendarCategories::setCHUserId (   $a_user_id)

Set ch user id.

Parameters
int$a_user_id

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

222 {
223 $this->ch_user_id = $a_user_id;
224 }

Referenced by readAllConsultationHoursCalendarOfContainer(), and readConsultationHoursCalendar().

+ Here is the caller graph for this function:

◆ setMode()

ilCalendarCategories::setMode (   $a_mode)
protected

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

237 {
238 $this->mode = $a_mode;
239 }

Referenced by initialize().

+ Here is the caller graph for this function:

◆ setSourceRefId()

ilCalendarCategories::setSourceRefId (   $a_val)

Set source ref id.

Parameters
int$a_valref id of current context/source

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

262 {
263 $this->root_ref_id = $a_val;
264 }

◆ setTargetRefId()

ilCalendarCategories::setTargetRefId (   $a_ref_id)
protected

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

247 {
248 $this->target_ref_id = $a_ref_id;
249 }

Referenced by initialize().

+ Here is the caller graph for this function:

◆ sleep()

ilCalendarCategories::sleep ( )
protected

Serialize categories.

Returns

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

193 {
194 return serialize(
195 array(
196 'categories' => $this->categories,
197 'categories_info' => $this->categories_info,
198 'subitem_categories' => $this->subitem_categories
199 )
200 );
201 }

Referenced by initialize().

+ Here is the caller graph for this function:

◆ wakeup()

ilCalendarCategories::wakeup (   $a_ser)
protected

Load from serialize string.

Parameters
stringserialize categories
Returns

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

209 {
210 $info = unserialize($a_ser);
211
212 $this->categories = $info['categories'];
213 $this->categories_info = $info['categories_info'];
214 $this->subitem_categories = $info['subitem_categories'];
215 }

References $info.

Referenced by initialize().

+ Here is the caller graph for this function:

Field Documentation

◆ $categories

ilCalendarCategories::$categories = array()
protected

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

Referenced by readConsultationHoursCalendar().

◆ $categories_info

ilCalendarCategories::$categories_info = array()
protected

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

◆ $ch_user_id

ilCalendarCategories::$ch_user_id = 0
protected

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

Referenced by getCHUserId().

◆ $db

ilCalendarCategories::$db
protected

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

◆ $instance

ilCalendarCategories::$instance = null
staticprotected

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

Referenced by _getInstance().

◆ $logger

ilCalendarCategories::$logger = null
protected

ilLogger

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

◆ $mode

ilCalendarCategories::$mode = 0
protected

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

Referenced by getMode().

◆ $root_obj_id

ilCalendarCategories::$root_obj_id = 0
protected

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

◆ $root_ref_id

ilCalendarCategories::$root_ref_id = 0
protected

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

Referenced by getSourceRefId().

◆ $subitem_categories

ilCalendarCategories::$subitem_categories = array()
protected

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

◆ $target_ref_id

ilCalendarCategories::$target_ref_id = 0
protected

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

Referenced by getTargetRefId().

◆ $user_id

ilCalendarCategories::$user_id
protected

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

Referenced by readBookingCalendar().

◆ MODE_CONSULTATION

const ilCalendarCategories::MODE_CONSULTATION = 7

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

Referenced by ilCalendarSchedule\__construct(), and initialize().

◆ MODE_MANAGE

const ilCalendarCategories::MODE_MANAGE = 6

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

Referenced by initialize().

◆ MODE_PERSONAL_DESKTOP_ITEMS

◆ MODE_PERSONAL_DESKTOP_MEMBERSHIP

◆ MODE_PORTFOLIO_CONSULTATION

◆ MODE_REMOTE_ACCESS

const ilCalendarCategories::MODE_REMOTE_ACCESS = 3

◆ MODE_REMOTE_SELECTED

const ilCalendarCategories::MODE_REMOTE_SELECTED = 9

◆ MODE_REPOSITORY

◆ MODE_REPOSITORY_CONTAINER_ONLY

const ilCalendarCategories::MODE_REPOSITORY_CONTAINER_ONLY = 10

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

Referenced by ilCalendarBlockGUI\initCategories(), and initialize().

◆ MODE_SINGLE_CALENDAR

const ilCalendarCategories::MODE_SINGLE_CALENDAR = 11

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