ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCalendarCategories Class Reference

class for calendar categories More...

+ Collaboration diagram for ilCalendarCategories:

Public Member Functions

 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)
 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

 __construct ($a_usr_id=0)
 Singleton instance. More...
 
 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)
protected

Singleton instance.

protected

Parameters
int$a_usr_iduser id
Returns

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

References $GLOBALS, $ilDB, and $ilUser.

79  {
80  global $ilUser,$ilDB;
81 
82  $this->logger = $GLOBALS['DIC']->logger()->cal();
83 
84  $this->user_id = $a_usr_id;
85  if (!$this->user_id) {
86  $this->user_id = $ilUser->getId();
87  }
88  $this->db = $ilDB;
89  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$ilUser
Definition: imgupload.php:18
global $ilDB

Member Function Documentation

◆ _getInstance()

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

get singleton instance

public

Parameters
int$a_usr_iduser id
Returns
ilCalendarCategories

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

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

100  {
101  if (self::$instance) {
102  return self::$instance;
103  }
104  return self::$instance = new ilCalendarCategories($a_usr_id);
105  }
class for calendar categories
+ 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

public

Parameters
intusr_id
intcal_id
Returns
bool

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

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

Referenced by ilCalendarShared\getSharedCalendarsForUser().

141  {
142  global $ilDB;
143 
144  $query = "SELECT * FROM cal_categories " .
145  "WHERE cat_id = " . $ilDB->quote($a_cal_id, 'integer') . " " .
146  "AND obj_id = " . $ilDB->quote($a_usr_id, 'integer') . " " .
147  "AND type = " . $ilDB->quote(ilCalendarCategory::TYPE_USR, 'integer') . " ";
148  $res = $ilDB->query($query);
149  return $res->numRows() ? true : false;
150  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupCategoryIdByObjId()

static ilCalendarCategories::_lookupCategoryIdByObjId (   $a_obj_id)
static

lookup category by obj_id

public

Parameters
intobj_id
Returns
int cat_id

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

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

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

116  {
117  global $ilDB;
118 
119  $query = "SELECT cat_id FROM cal_categories " .
120  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
121  "AND type = " . $ilDB->quote(ilCalendarCategory::TYPE_OBJ, 'integer') . " ";
122 
123  $res = $ilDB->query($query);
124  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
125  return $row->cat_id;
126  }
127  return 0;
128  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ addSubitemCalendars()

ilCalendarCategories::addSubitemCalendars ( )
protected

Add subitem calendars E.g.

session calendars in courses, groups

Parameters

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

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

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

1008  {
1009  global $ilDB;
1010 
1011  $course_ids = array();
1012  foreach ($this->categories as $cat_id) {
1013  if ($this->categories_info[$cat_id]['obj_type'] == 'crs' or $this->categories_info[$cat_id]['obj_type'] == 'grp') {
1014  $course_ids[] = $this->categories_info[$cat_id]['obj_id'];
1015  }
1016  }
1017 
1018  $query = "SELECT od2.obj_id sess_id, od1.obj_id crs_id,cat_id FROM object_data od1 " .
1019  "JOIN object_reference or1 ON od1.obj_id = or1.obj_id " .
1020  "JOIN tree t ON or1.ref_id = t.parent " .
1021  "JOIN object_reference or2 ON t.child = or2.ref_id " .
1022  "JOIN object_data od2 ON or2.obj_id = od2.obj_id " .
1023  "JOIN cal_categories cc ON od2.obj_id = cc.obj_id " .
1024  "WHERE " . $ilDB->in('od2.type', array('sess','exc'), false, 'text') .
1025  "AND (od1.type = 'crs' OR od1.type = 'grp') " .
1026  "AND " . $ilDB->in('od1.obj_id', $course_ids, false, 'integer') . ' ' .
1027  "AND or2.deleted IS NULL";
1028 
1029  $res = $ilDB->query($query);
1030  $cat_ids = array();
1031  $course_sessions = array();
1032  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1033  $cat_ids[] = $row->cat_id;
1034  $course_sessions[$row->crs_id][$row->sess_id] = $row->cat_id;
1035  $this->subitem_categories[] = $row->cat_id;
1036  }
1037 
1038  foreach ($this->categories as $cat_id) {
1039  if (
1040  ($this->categories_info[$cat_id]['obj_type'] == 'crs' ||
1041  $this->categories_info[$cat_id]['obj_type'] == 'grp') &&
1042  isset($this->categories_info[$cat_id]['obj_id']) &&
1043  isset($course_sessions[$this->categories_info[$cat_id]['obj_id']]) &&
1044  is_array($course_sessions[$this->categories_info[$cat_id]['obj_id']])) {
1045  foreach ($course_sessions[$this->categories_info[$cat_id]['obj_id']] as $sess_id => $sess_cat_id) {
1046  $this->categories_info[$cat_id]['subitem_ids'][$sess_id] = $sess_cat_id;
1047  $this->categories_info[$cat_id]['subitem_obj_ids'][$sess_cat_id] = $sess_id;
1048  }
1049  } else {
1050  $this->categories_info[$cat_id]['subitem_ids'] = array();
1051  $this->categories_info[$cat_id]['subitem_obj_ids'] = array();
1052  }
1053  }
1054  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ 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 157 of file class.ilCalendarCategories.php.

References ilCalendarCache\getInstance().

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

158  {
159  ilCalendarCache::getInstance()->deleteByAdditionalKeys(
160  $a_usr_id,
161  self::MODE_PERSONAL_DESKTOP_ITEMS,
162  'categories'
163  );
164  }
static getInstance()
get singleton instance
+ 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 171 of file class.ilCalendarCategories.php.

References ilCalendarCache\getInstance().

Referenced by ilCalendarAppEventListener\handleEvent().

172  {
173  ilCalendarCache::getInstance()->deleteByAdditionalKeys(
174  $a_usr_id,
175  self::MODE_REPOSITORY,
176  'categories'
177  );
178  }
static getInstance()
get singleton instance
+ 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 public
Returns

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

References array.

407  {
408  if ($a_include_subitem_calendars) {
409  return array_merge((array) $this->categories, (array) $this->subitem_categories);
410  }
411 
412  return $this->categories ? $this->categories : array();
413  }
Create styles array
The data for the language used.

◆ getCategoriesInfo()

ilCalendarCategories::getCategoriesInfo ( )

get categories

public

Parameters

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

References array.

396  {
397  return $this->categories_info ? $this->categories_info : array();
398  }
Create styles array
The data for the language used.

◆ getCategoryInfo()

ilCalendarCategories::getCategoryInfo (   $a_cat_id)

public

Parameters

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

References array.

373  {
374  if (isset($this->categories_info[$a_cat_id])) {
375  return $this->categories_info[$a_cat_id];
376  }
377 
378  if (in_array($a_cat_id, (array) $this->subitem_categories)) {
379  foreach ($this->categories as $cat_id) {
380  if (in_array($a_cat_id, $this->categories_info[$cat_id]['subitem_ids'])) {
381  return $this->categories_info[$cat_id];
382  }
383  }
384  }
385  }
Create styles array
The data for the language used.

◆ getCHUserId()

ilCalendarCategories::getCHUserId ( )

Get ch user id.

Returns
type

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

References $ch_user_id.

Referenced by readAllConsultationHoursCalendarOfContainer(), and readConsultationHoursCalendar().

225  {
226  return $this->ch_user_id;
227  }
+ Here is the caller graph for this function:

◆ getMode()

ilCalendarCategories::getMode ( )

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

References $mode.

Referenced by initialize().

235  {
236  return $this->mode;
237  }
+ 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 466 of file class.ilCalendarCategories.php.

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

467  {
468  $not = array();
469  foreach ($this->categories_info as $info) {
470  if ($info['type'] == ilCalendarCategory::TYPE_OBJ and $info['editable'] == true) {
471  if (ilObject::_lookupType($info['obj_id']) == 'crs' or ilObject::_lookupType($info['obj_id']) == 'grp') {
472  $not[] = $info['cat_id'];
473  }
474  }
475  }
476  return $not;
477  }
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
$info
Definition: index.php:5
+ 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 264 of file class.ilCalendarCategories.php.

References $root_ref_id.

265  {
266  return $this->root_ref_id;
267  }

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

References array.

422  {
423  if (!isset($this->categories_info[$a_cat_id]['subitem_ids'])) {
424  return array($a_cat_id);
425  }
426  return array_merge((array) $this->categories_info[$a_cat_id]['subitem_ids'], array($a_cat_id));
427  }
Create styles array
The data for the language used.

◆ getTargetRefId()

ilCalendarCategories::getTargetRefId ( )

Definition at line 244 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

public

Parameters
intmode
intref_id of root node
Returns

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

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

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

◆ isEditable()

ilCalendarCategories::isEditable (   $a_cat_id)

check if category is editable

public

Parameters
int$a_cat_idcategory id
Returns

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

487  {
488  return isset($this->categories_info[$a_cat_id]['editable']) and $this->categories_info[$a_cat_id]['editable'];
489  }

◆ isVisible()

ilCalendarCategories::isVisible (   $a_cat_id)

check if category is visible

public

Parameters
int$a_cat_idcategory id
Returns

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

References array.

499  {
500  return in_array($a_cat_id, $this->categories) or
501  in_array($a_cat_id, (array) $this->subitem_categories);
502  }
Create styles array
The data for the language used.

◆ lookupPrivateCategories()

static ilCalendarCategories::lookupPrivateCategories (   $a_user_id)
static

Lookup private categories of user.

Parameters

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

References $ilDB, array, and ilCalendarCategory\TYPE_USR.

Referenced by ilUserExporter\getXmlExportTailDependencies().

1063  {
1064  global $ilDB;
1065 
1066  // First read private calendars of user
1067  $set = $ilDB->query("SELECT * FROM cal_categories " .
1068  "WHERE type = " . $ilDB->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
1069  "AND obj_id = " . $ilDB->quote($a_user_id, 'integer'));
1070  $cats = array();
1071  while ($rec = $ilDB->fetchAssoc($set)) {
1072  $cats[] = $rec;
1073  }
1074  return $cats;
1075  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ prepareCategoriesOfUserForSelection()

ilCalendarCategories::prepareCategoriesOfUserForSelection ( )

prepare categories of users for selection

public

Parameters
intuser id
Returns

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

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

438  {
439  global $lng;
440 
441  $has_personal_calendar = false;
442  foreach ($this->categories_info as $info) {
443  if ($info['obj_type'] == 'sess' || $info['obj_type'] == 'exc') {
444  continue;
445  }
446  if ($info['type'] == ilCalendarCategory::TYPE_USR and $info['editable']) {
447  $has_personal_calendar = true;
448  }
449 
450  if ($info['editable']) {
451  $cats[$info['cat_id']] = $info['title'];
452  }
453  }
454  // If there
455  if (!$has_personal_calendar) {
456  $cats[0] = $lng->txt('cal_default_calendar');
457  }
458  return $cats ? $cats : array();
459  }
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
$info
Definition: index.php:5

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

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

Referenced by readReposCalendars().

813  {
814  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
815  $obj_id = ilObject::_lookupObjId($a_container_ref_id);
816  $participants = ilCourseParticipants::_getInstanceByObjId($obj_id);
817  $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
818  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
820  $old_ch = $this->getCHUserId();
821  foreach ($users as $user) {
822  $this->setCHUserId($user);
823  $this->readConsultationHoursCalendar($a_container_ref_id);
824  }
825  $this->setCHUserId($old_ch);
826  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
setCHUserId($a_user_id)
Set ch user id.
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...
static _lookupObjId($a_id)
$users
Definition: authpage.php:44
readConsultationHoursCalendar($a_target_ref_id=null, $a_cat_id=0)
Read personal consultation hours calendar.
+ 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 911 of file class.ilCalendarCategories.php.

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

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

912  {
913  global $ilDB;
914 
915  if (!$user_id) {
917  }
918 
919  $query = "SELECT * FROM cal_categories " .
920  "WHERE type = " . $ilDB->quote(ilCalendarCategory::TYPE_BOOK, 'integer') . ' ' .
921  "AND obj_id = " . $ilDB->quote($user_id, 'integer');
922  $res = $ilDB->query($query);
923  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
924  $this->categories[] = $row->cat_id;
925  $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
926  $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
927  $this->categories_info[$row->cat_id]['title'] = $row->title;
928  $this->categories_info[$row->cat_id]['color'] = $row->color;
929  $this->categories_info[$row->cat_id]['type'] = $row->type;
930  $this->categories_info[$row->cat_id]['editable'] = false;
931  $this->categories_info[$row->cat_id]['settings'] = false;
932  $this->categories_info[$row->cat_id]['accepted'] = false;
933  $this->categories_info[$row->cat_id]['remote'] = false;
934  }
935  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ 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 833 of file class.ilCalendarCategories.php.

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

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

834  {
835  global $ilDB, $lng;
836 
837  if (!$this->getCHUserId()) {
838  $this->setCHUserId($this->user_id);
839  }
840 
841  if ($a_target_ref_id) {
842  $target_obj_id = ilObject::_lookupObjId($a_target_ref_id);
843 
844  $query = 'SELECT DISTINCT(cc.cat_id) FROM booking_entry be ' .
845  'LEFT JOIN booking_obj_assignment bo ON be.booking_id = bo.booking_id ' .
846  'JOIN cal_entries ce ON be.booking_id = ce.context_id ' .
847  'JOIN cal_cat_assignments ca ON ce.cal_id = ca.cal_id ' .
848  'JOIN cal_categories cc ON ca.cat_id = cc.cat_id ' .
849  'WHERE ((bo.target_obj_id IS NULL) OR bo.target_obj_id = ' . $ilDB->quote($target_obj_id, 'integer') . ' ) ';
850 
851  // limit only to user if no cat id is given
852  if ($a_cat_id == 0) {
853  $query.= 'AND cc.obj_id = ' . $ilDB->quote($this->getCHUserId(), 'integer');
854  }
855 
856 
857  $res = $ilDB->query($query);
858  $categories = array();
859  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
860  if ($a_cat_id == 0 || $row->cat_id == $a_cat_id) {
861  $categories[] = $row->cat_id;
862  }
863  }
864 
865  if ($categories) {
866  $query = 'SELECT * FROM cal_categories ' .
867  'WHERE ' . $ilDB->in('cat_id', $categories, false, 'integer');
868  $res = $ilDB->query($query);
869  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
870  $this->categories[] = $row->cat_id;
871  $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
872  $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
873  $this->categories_info[$row->cat_id]['title'] = ilObjUser::_lookupFullname($row->obj_id);
874  $this->categories_info[$row->cat_id]['color'] = $row->color;
875  $this->categories_info[$row->cat_id]['type'] = $row->type;
876  $this->categories_info[$row->cat_id]['editable'] = false;
877  $this->categories_info[$row->cat_id]['settings'] = false;
878  $this->categories_info[$row->cat_id]['accepted'] = false;
879  $this->categories_info[$row->cat_id]['remote'] = false;
880  }
881  }
882  } else { // no category given
883  $filter = ($a_cat_id > 0)
884  ? " AND cat_id = " . $ilDB->quote($a_cat_id, "integer")
885  : " AND obj_id = " . $ilDB->quote($this->getCHUserId(), 'integer');
886 
887  $query = "SELECT * FROM cal_categories cc " .
888  "WHERE type = " . $ilDB->quote(ilCalendarCategory::TYPE_CH, 'integer') . ' ' . $filter;
889  $res = $ilDB->query($query);
890  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
891  $this->categories[] = $row->cat_id;
892  $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
893  $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
894  $this->categories_info[$row->cat_id]['title'] = $row->title;
895  $this->categories_info[$row->cat_id]['color'] = $row->color;
896  $this->categories_info[$row->cat_id]['type'] = $row->type;
897  $this->categories_info[$row->cat_id]['editable'] = false;
898  $this->categories_info[$row->cat_id]['settings'] = false;
899  $this->categories_info[$row->cat_id]['accepted'] = false;
900  $this->categories_info[$row->cat_id]['remote'] = false;
901  }
902  }
903  return true;
904  }
static _lookupFullname($a_user_id)
Lookup Full Name.
setCHUserId($a_user_id)
Set ch user id.
foreach($_POST as $key=> $value) $res
static _lookupObjId($a_id)
$query
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPDCalendars()

ilCalendarCategories::readPDCalendars ( )
protected

Read categories of user.

protected

Parameters

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

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

Referenced by initialize().

515  {
516  global $rbacsystem;
517 
518 
519  $this->readPublicCalendars();
520  $this->readPrivateCalendars();
522  $this->readBookingCalendar();
523 
524  include_once('./Services/Membership/classes/class.ilParticipants.php');
525  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, 'crs'));
526  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, 'grp'));
527 
528  $this->addSubitemCalendars();
529  }
addSubitemCalendars()
Add subitem calendars E.g.
readSelectedCategories($a_obj_ids, $a_source_ref_id=0)
read selected categories
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
readBookingCalendar($user_id=null)
Read booking manager calendar.
readPrivateCalendars($only_cat_ids=null)
Read private calendars.
readConsultationHoursCalendar($a_target_ref_id=null, $a_cat_id=0)
Read personal consultation hours calendar.
readPublicCalendars($cat_ids=null)
Read public calendars.
+ 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.

protected

Returns

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

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

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

740  {
741  global $ilUser;
742  global $ilDB;
743 
744  $in = "";
745  if (is_array($only_cat_ids)) {
746  $in = " AND " . $this->db->in('cat_id', $only_cat_ids, false, 'integer') . " ";
747  }
748 
749  // First read private calendars of user
750  $query = "SELECT cat_id FROM cal_categories " .
751  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
752  "AND obj_id = " . $this->db->quote($ilUser->getId(), 'integer') . " " . $in;
753  $res = $this->db->query($query);
754  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
755  $cat_ids[] = $row->cat_id;
756  }
757 
758  // Read shared calendars
759  include_once('./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
760  $accepted_ids = ilCalendarSharedStatus::getAcceptedCalendars($ilUser->getId());
761  if (!$cat_ids = array_merge((array) $cat_ids, $accepted_ids)) {
762  return true;
763  }
764 
765  if (is_array($only_cat_ids)) {
766  $cat_ids = array_filter($cat_ids, function ($id) use ($only_cat_ids) {
767  return in_array($id, $only_cat_ids);
768  });
769  }
770 
771  // user categories
772  $query = "SELECT * FROM cal_categories " .
773  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
774  "AND " . $ilDB->in('cat_id', $cat_ids, false, 'integer') . " " .
775  "ORDER BY title ";
776 
777  $res = $this->db->query($query);
778  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
779  $this->categories[] = $row->cat_id;
780  $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
781  $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
782  $this->categories_info[$row->cat_id]['title'] = $row->title;
783  $this->categories_info[$row->cat_id]['color'] = $row->color;
784  $this->categories_info[$row->cat_id]['type'] = $row->type;
785 
786  include_once './Services/Calendar/classes/class.ilCalendarShared.php';
787  if (in_array($row->cat_id, $accepted_ids)) {
788  $shared = new ilCalendarShared($row->cat_id);
789  if ($shared->isEditableForUser($ilUser->getId())) {
790  $this->categories_info[$row->cat_id]['editable'] = true;
791  } else {
792  $this->categories_info[$row->cat_id]['editable'] = false;
793  }
794  } else {
795  $this->categories_info[$row->cat_id]['editable'] = true;
796  }
797  if ($ilUser->getId() == $row->obj_id) {
798  $this->categories_info[$row->cat_id]['settings'] = true;
799  } else {
800  $this->categories_info[$row->cat_id]['settings'] = false;
801  }
802 
803  $this->categories_info[$row->cat_id]['accepted'] = in_array($row->cat_id, $accepted_ids);
804  $this->categories_info[$row->cat_id]['remote'] = ($row->loc_type == ilCalendarCategory::LTYPE_REMOTE);
805  }
806  }
static getAcceptedCalendars($a_usr_id)
get accepted shared calendars
if(!array_key_exists('StateId', $_REQUEST)) $id
Handles shared calendars.
foreach($_POST as $key=> $value) $res
$ilUser
Definition: imgupload.php:18
$query
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
global $ilDB
+ 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.

protected

Returns

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

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

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

703  {
704  global $rbacsystem,$ilAccess;
705 
706  $in = "";
707  if (is_array($cat_ids)) {
708  $in = " AND " . $this->db->in('cat_id', $cat_ids, false, 'integer') . " ";
709  }
710 
711  // global categories
712  $query = "SELECT * FROM cal_categories " .
713  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_GLOBAL, 'integer') . " " . $in .
714  "ORDER BY title ";
715 
716  $res = $this->db->query($query);
717  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
718  $this->categories[] = $row->cat_id;
719  $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
720  $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
721  $this->categories_info[$row->cat_id]['title'] = $row->title;
722  $this->categories_info[$row->cat_id]['color'] = $row->color;
723  $this->categories_info[$row->cat_id]['type'] = $row->type;
724  $this->categories_info[$row->cat_id]['editable'] = $rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId());
725  $this->categories_info[$row->cat_id]['settings'] = $rbacsystem->checkAccess('write', ilCalendarSettings::_getInstance()->getCalendarSettingsId());
726  $this->categories_info[$row->cat_id]['accepted'] = false;
727  $this->categories_info[$row->cat_id]['remote'] = ($row->loc_type == ilCalendarCategory::LTYPE_REMOTE);
728  }
729 
730  return true;
731  }
static _getInstance()
get singleton instance
foreach($_POST as $key=> $value) $res
$query
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
+ 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.

protected

Parameters

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

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

Referenced by initialize().

605  {
606  global $ilAccess,$tree;
607  global $ilDB;
608 
609  if (!$a_container_only) {
610  $this->readPublicCalendars();
611  $this->readPrivateCalendars();
612  //$this->readConsultationHoursCalendar($this->root_ref_id);
613  $this->readAllConsultationHoursCalendarOfContainer($this->root_ref_id);
614  }
615 
616 
617 
618  #$query = "SELECT ref_id,obd.obj_id obj_id FROM tree t1 ".
619  # "JOIN object_reference obr ON t1.child = obr.ref_id ".
620  # "JOIN object_data obd ON obd.obj_id = obr.obj_id ".
621  # "WHERE t1.lft >= (SELECT lft FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
622  # "AND t1.lft <= (SELECT rgt FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
623  # "AND ".$ilDB->in('type',array('crs','grp','sess'),false,'text')." ".
624  # "AND tree = 1";
625 
626  // alternative 1: do not aggregate items of current course
627  if (!true) { //
628  $subtree_query = $GLOBALS['tree']->getSubTreeQuery(
629  $this->root_ref_id,
630  array('object_reference.ref_id', 'object_data.obj_id'),
631  array('crs', 'grp', 'sess', 'exc')
632  );
633 
634  $res = $ilDB->query($subtree_query);
635  $obj_ids = array();
636  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
637  if ($tree->isDeleted($row->ref_id)) {
638  continue;
639  }
640 
641  $obj_type = ilObject::_lookupType($row->obj_id);
642  if ($obj_type == 'crs' or $obj_type == 'grp') {
643  //Added for calendar revision --> https://goo.gl/CXGTRF
644  //In 5.2-trunk, the booking pools did not appear in the marginal calendar.
645  $this->readBookingCalendar();
646  // Check for global/local activation
647  if (!ilCalendarSettings::_getInstance()->lookupCalendarActivated($row->obj_id)) {
648  continue;
649  }
650  }
651  if ($ilAccess->checkAccess('read', '', $row->ref_id)) {
652  $obj_ids[] = $row->obj_id;
653  }
654  }
655  $this->readSelectedCategories($obj_ids, $this->root_ref_id);
656  } else { // alternative 2: aggregate items of current course (discussion with timon 3.8.3017: this is the current preference)
657  $this->readSelectedCategories(array($this->root_obj_id), $this->root_ref_id);
658  }
659 
660  $this->addSubitemCalendars();
661 
662 
663  if (!$a_container_only) {
664  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, 'crs'));
665  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, 'grp'));
666  }
667  }
readAllConsultationHoursCalendarOfContainer($a_container_ref_id)
Read personal consultation hours calendar of all tutors for a container.
addSubitemCalendars()
Add subitem calendars E.g.
readSelectedCategories($a_obj_ids, $a_source_ref_id=0)
read selected categories
static _getInstance()
get singleton instance
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
readBookingCalendar($user_id=null)
Read booking manager calendar.
readPrivateCalendars($only_cat_ids=null)
Read private calendars.
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
readPublicCalendars($cat_ids=null)
Read public calendars.
+ 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 535 of file class.ilCalendarCategories.php.

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

Referenced by initialize(), and readSingleCalendar().

536  {
537  include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
538  $cat = new ilCalendarCategory($a_cal_id);
539  if ($cat->getType() == ilCalendarCategory::TYPE_OBJ) {
540  $this->readSelectedCategories(array($cat->getObjId()));
541  $this->addSubitemCalendars();
542  } else {
543  $this->categories[] = $a_cal_id;
544  }
545  }
addSubitemCalendars()
Add subitem calendars E.g.
readSelectedCategories($a_obj_ids, $a_source_ref_id=0)
read selected categories
Stores calendar categories.
Create styles array
The data for the language used.
+ 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

protected

Returns

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

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

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

944  {
945  global $ilAccess,$tree;
946  global $ilDB;
947 
948  if (!count($a_obj_ids)) {
949  return true;
950  }
951 
952  $query = "SELECT * FROM cal_categories " .
953  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_OBJ, 'integer') . " " .
954  "AND " . $ilDB->in('obj_id', $a_obj_ids, false, 'integer') . " " .
955  "ORDER BY title ";
956 
957  $res = $this->db->query($query);
958  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
959  // check activation/deactivation
960  $obj_type = ilObject::_lookupType($row->obj_id);
961  if ($obj_type == 'crs' or $obj_type == 'grp') {
962  if (!ilCalendarSettings::_getInstance()->lookupCalendarActivated($row->obj_id)) {
963  continue;
964  }
965  }
966 
967  $editable = false;
968  $exists = false;
969  $settings = false;
970  foreach (ilObject::_getAllReferences($row->obj_id) as $ref_id) {
971  if ($ilAccess->checkAccess('edit_event', '', $ref_id)) {
972  $settings = true;
973  }
974  if ($ilAccess->checkAccess('edit_event', '', $ref_id)) {
975  $exists = true;
976  $editable = true;
977  break;
978  } elseif ($ilAccess->checkAccess('read', '', $ref_id)) {
979  $exists = true;
980  }
981  }
982  if (!$exists) {
983  continue;
984  }
985  $this->categories_info[$row->cat_id]['editable'] = $editable;
986  $this->categories_info[$row->cat_id]['settings'] = $settings;
987 
988  $this->categories[] = $row->cat_id;
989  $this->categories_info[$row->cat_id]['obj_id'] = $row->obj_id;
990  $this->categories_info[$row->cat_id]['cat_id'] = $row->cat_id;
991  $this->categories_info[$row->cat_id]['color'] = $row->color;
992  #$this->categories_info[$row->cat_id]['title'] = ilObject::_lookupTitle($row->obj_id);
993  $this->categories_info[$row->cat_id]['title'] = $row->title;
994  $this->categories_info[$row->cat_id]['obj_type'] = ilObject::_lookupType($row->obj_id);
995  $this->categories_info[$row->cat_id]['type'] = $row->type;
996  $this->categories_info[$row->cat_id]['remote'] = false;
997  $this->categories_info[$row->cat_id]['source_ref_id'] = $a_source_ref_id;
998  }
999  }
static _getInstance()
get singleton instance
static _getAllReferences($a_id)
get all reference ids of object
foreach($_POST as $key=> $value) $res
$query
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ 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

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

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

Referenced by initialize().

554  {
555  global $ilUser,$ilAccess;
556 
557  $this->readPublicCalendars();
558  $this->readPrivateCalendars();
560  $this->readBookingCalendar();
561 
562  $obj_ids = array();
563 
564  $courses = array();
565  $groups = array();
566  $sessions = array();
567  $exercises = array();
568  foreach (ilObjUser::_lookupDesktopItems($ilUser->getId(), array('crs','grp','sess','exc')) as $item) {
569  if ($ilAccess->checkAccess('read', '', $item['ref_id'])) {
570  switch ($item['type']) {
571  case 'crs':
572  $courses[] = $item['obj_id'];
573  break;
574 
575  case 'sess':
576  $sessions[] = $item['obj_id'];
577  break;
578 
579  case 'grp':
580  $groups[] = $item['obj_id'];
581  break;
582 
583  case 'exc':
584  $exercises[] = $item['obj_id'];
585  break;
586  }
587  }
588  }
589  $this->readSelectedCategories($courses);
590  $this->readSelectedCategories($sessions);
591  $this->readSelectedCategories($groups);
592  $this->readSelectedCategories($exercises);
593 
594  $this->addSubitemCalendars();
595  }
addSubitemCalendars()
Add subitem calendars E.g.
readSelectedCategories($a_obj_ids, $a_source_ref_id=0)
read selected categories
readBookingCalendar($user_id=null)
Read booking manager calendar.
readPrivateCalendars($only_cat_ids=null)
Read private calendars.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
static _lookupDesktopItems($user_id, $a_types="")
get all desktop items of user and specified type
readConsultationHoursCalendar($a_target_ref_id=null, $a_cat_id=0)
Read personal consultation hours calendar.
readPublicCalendars($cat_ids=null)
Read public calendars.
+ 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 669 of file class.ilCalendarCategories.php.

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

Referenced by initialize().

670  {
671  include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
672  $cat = new ilCalendarCategory($a_cat_id);
673  switch ($cat->getType()) {
675  $this->readSelectedCalendar($a_cat_id);
676  break;
677 
679  $this->readPublicCalendars(array($a_cat_id));
680  break;
681 
683  $this->readPrivateCalendars(array($a_cat_id));
684  break;
685 
687  $this->readConsultationHoursCalendar($this->root_ref_id, $a_cat_id);
688  break;
689 
691  $this->readBookingCalendar();
692  break;
693  }
694  }
readBookingCalendar($user_id=null)
Read booking manager calendar.
Stores calendar categories.
readPrivateCalendars($only_cat_ids=null)
Read private calendars.
readSelectedCalendar($a_cal_id)
Read info about selected calendar.
Create styles array
The data for the language used.
readConsultationHoursCalendar($a_target_ref_id=null, $a_cat_id=0)
Read personal consultation hours calendar.
readPublicCalendars($cat_ids=null)
Read public calendars.
+ 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 214 of file class.ilCalendarCategories.php.

Referenced by readAllConsultationHoursCalendarOfContainer(), and readConsultationHoursCalendar().

215  {
216  $this->ch_user_id = $a_user_id;
217  }
+ Here is the caller graph for this function:

◆ setMode()

ilCalendarCategories::setMode (   $a_mode)
protected

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

Referenced by initialize().

230  {
231  $this->mode = $a_mode;
232  }
+ 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 254 of file class.ilCalendarCategories.php.

255  {
256  $this->root_ref_id = $a_val;
257  }

◆ setTargetRefId()

ilCalendarCategories::setTargetRefId (   $a_ref_id)
protected

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

Referenced by initialize().

240  {
241  $this->target_ref_id = $a_ref_id;
242  }
+ Here is the caller graph for this function:

◆ sleep()

ilCalendarCategories::sleep ( )
protected

Serialize categories.

Returns

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

References array.

Referenced by initialize().

186  {
187  return serialize(
188  array(
189  'categories' => $this->categories,
190  'categories_info' => $this->categories_info,
191  'subitem_categories'=> $this->subitem_categories
192  )
193  );
194  }
Create styles array
The data for the language used.
+ 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 201 of file class.ilCalendarCategories.php.

References $info.

Referenced by initialize().

202  {
203  $info = unserialize($a_ser);
204 
205  $this->categories = $info['categories'];
206  $this->categories_info = $info['categories_info'];
207  $this->subitem_categories = $info['subitem_categories'];
208  }
$info
Definition: index.php:5
+ 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.

◆ $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().

◆ MODE_MANAGE

const ilCalendarCategories::MODE_MANAGE = 6

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

◆ MODE_PERSONAL_DESKTOP_ITEMS

const ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS = 5

◆ 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

const ilCalendarCategories::MODE_REPOSITORY = 2

◆ MODE_REPOSITORY_CONTAINER_ONLY

const ilCalendarCategories::MODE_REPOSITORY_CONTAINER_ONLY = 10

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

Referenced by ilCalendarBlockGUI\initCategories().

◆ MODE_SINGLE_CALENDAR

const ilCalendarCategories::MODE_SINGLE_CALENDAR = 11

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