ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilCalendarCategories Class Reference

class for calendar categories More...

+ Collaboration diagram for ilCalendarCategories:

Public Member Functions

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

Static Public Member Functions

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

Data Fields

const MODE_UNDEFINED = 0
 
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 (string $a_ser)
 Load from serialize string. More...
 
 setMode (int $a_mode)
 
 setTargetRefId (int $a_ref_id)
 
 readPDCalendars ()
 Read categories of user. More...
 
 readSelectedCalendar (int $a_cal_id)
 Read info about selected calendar. More...
 
 readSelectedItemCalendars ()
 
 readReposCalendars ($a_container_only=false)
 Read available repository calendars. More...
 
 readPublicCalendars ($cat_ids=null)
 Read public calendars. More...
 
 readPrivateCalendars (?array $only_cat_ids=null)
 Read private calendars. More...
 
 readSelectedCategories (array $a_obj_ids, int $a_source_ref_id=0, bool $check_permissions=true)
 
 addSubitemCalendars ()
 Add subitem calendars E.g. More...
 
 lookupRelevantTalkSeriesIds ()
 

Protected Attributes

ilDBInterface $db
 
ilLogger $logger
 
ilFavouritesDBRepository $fav_rep
 
ilObjUser $user
 
ilLanguage $lng
 
ilRbacSystem $rbacsystem
 
ilAccessHandler $access
 
ilTree $tree
 
int $user_id = 0
 
int $mode = self::MODE_UNDEFINED
 
array $categories = array()
 
array $categories_info = array()
 
array $subitem_categories = array()
 
int $root_ref_id = 0
 
int $root_obj_id = 0
 
int $ch_user_id = 0
 
int $target_ref_id = 0
 

Static Protected Attributes

static ilCalendarCategories $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

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarCategories::__construct ( int  $a_usr_id = 0)

Singleton instance.

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

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), and ILIAS\Repository\user().

69  {
70  global $DIC;
71 
72  $this->user = $DIC->user();
73  $this->db = $DIC->database();
74  $this->logger = $DIC->logger()->cal();
75  $this->lng = $DIC->language();
76  $this->rbacsystem = $DIC->rbac()->system();
77  $this->access = $DIC->access();
78  $this->user_id = $a_usr_id;
79  $this->tree = $DIC->repositoryTree();
80  if (!$this->user_id) {
81  $this->user_id = $this->user->getId();
82  }
83  $this->fav_rep = new ilFavouritesDBRepository();
84  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

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

get singleton instance

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

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

90  {
91  if (self::$instance) {
92  return self::$instance;
93  }
94  return self::$instance = new ilCalendarCategories($a_usr_id);
95  }
class for calendar categories
+ Here is the caller graph for this function:

◆ _isOwner()

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

check if user is owner of a category

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

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

Referenced by ilCalendarShared\getSharedCalendarsForUser().

138  : bool
139  {
140  global $DIC;
141 
142  $ilDB = $DIC['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 (bool) $res->numRows();
150  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ _lookupCategoryIdByObjId()

static ilCalendarCategories::_lookupCategoryIdByObjId ( int  $a_obj_id)
static

lookup category by obj_id

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

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

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

119  : int
120  {
121  global $DIC;
122 
123  $ilDB = $DIC->database();
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 (int) $row->cat_id;
131  }
132  return 0;
133  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:26
+ Here is the caller graph for this function:

◆ addSubitemCalendars()

ilCalendarCategories::addSubitemCalendars ( )
protected

Add subitem calendars E.g.

session calendars in courses, groups

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

References $res, ILIAS\Repository\access(), ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

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

912  : void
913  {
914  $course_ids = array();
915  foreach ($this->categories as $cat_id) {
916  if (isset($this->categories_info[$cat_id]['obj_type']) &&
917  in_array($this->categories_info[$cat_id]['obj_type'], ['crs', 'grp', 'tals'])) {
918  $course_ids[] = $this->categories_info[$cat_id]['obj_id'];
919  }
920  }
921 
922  $query = "SELECT od2.obj_id sess_id, od1.obj_id crs_id,cat_id, or2.ref_id sess_ref_id, od2.type FROM object_data od1 " .
923  "JOIN object_reference or1 ON od1.obj_id = or1.obj_id " .
924  "JOIN tree t ON or1.ref_id = t.parent " .
925  "JOIN object_reference or2 ON t.child = or2.ref_id " .
926  "JOIN object_data od2 ON or2.obj_id = od2.obj_id " .
927  "JOIN cal_categories cc ON od2.obj_id = cc.obj_id " .
928  "WHERE " . $this->db->in('od2.type', array('sess', 'exc', 'etal'), false, 'text') .
929  "AND (od1.type = 'crs' OR od1.type = 'grp' OR od1.type = 'tals') " .
930  "AND " . $this->db->in('od1.obj_id', $course_ids, false, 'integer') . ' ' .
931  "AND or2.deleted IS NULL";
932 
933  $res = $this->db->query($query);
934  $cat_ids = array();
935  $course_sessions = array();
936  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
937  if ($row->type !== 'etal') {
938  if (
939  !$this->access->checkAccessOfUser($this->user_id, 'read', '', (int) $row->sess_ref_id) ||
940  !$this->access->checkAccessOfUser($this->user_id, 'visible', '', (int) $row->sess_ref_id)
941  ) {
942  continue;
943  }
944  }
945  $cat_ids[] = (int) $row->cat_id;
946  $course_sessions[(int) $row->crs_id][(int) $row->sess_id] = (int) $row->cat_id;
947  $this->subitem_categories[] = (int) $row->cat_id;
948  }
949 
950  foreach ($this->categories as $cat_id) {
951  if (
952  (isset($this->categories_info[$cat_id]['obj_type']) &&
953  in_array($this->categories_info[$cat_id]['obj_type'], ['crs', 'grp', 'tals'])) &&
954  isset($this->categories_info[$cat_id]['obj_id']) &&
955  isset($course_sessions[$this->categories_info[$cat_id]['obj_id']]) &&
956  is_array($course_sessions[$this->categories_info[$cat_id]['obj_id']])) {
957  foreach ($course_sessions[$this->categories_info[$cat_id]['obj_id']] as $sess_id => $sess_cat_id) {
958  $this->categories_info[$cat_id]['subitem_ids'][$sess_id] = $sess_cat_id;
959  $this->categories_info[$cat_id]['subitem_obj_ids'][$sess_cat_id] = $sess_id;
960  }
961  } else {
962  $this->categories_info[$cat_id]['subitem_ids'] = array();
963  $this->categories_info[$cat_id]['subitem_obj_ids'] = array();
964  }
965  }
966  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deletePDItemsCache()

static ilCalendarCategories::deletePDItemsCache ( int  $a_usr_id)
static

Delete cache (add remove desktop item)

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

References ilCalendarCache\getInstance().

Referenced by ilFavouritesManager\add(), ilCalendarAppEventListener\handleEvent(), and ilFavouritesManager\remove().

155  : void
156  {
157  ilCalendarCache::getInstance()->deleteByAdditionalKeys(
158  $a_usr_id,
159  self::MODE_PERSONAL_DESKTOP_ITEMS,
160  'categories'
161  );
162  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteRepositoryCache()

static ilCalendarCategories::deleteRepositoryCache ( int  $a_usr_id)
static

Delete cache.

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

References ilCalendarCache\getInstance().

Referenced by ilCalendarAppEventListener\handleEvent().

167  : void
168  {
169  ilCalendarCache::getInstance()->deleteByAdditionalKeys(
170  $a_usr_id,
171  self::MODE_REPOSITORY,
172  'categories'
173  );
174  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCategories()

ilCalendarCategories::getCategories ( bool  $a_include_subitem_calendars = false)

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

365  : array
366  {
367  if ($a_include_subitem_calendars) {
368  return array_merge($this->categories, $this->subitem_categories);
369  }
370 
371  return $this->categories ?: array();
372  }

◆ getCategoriesInfo()

ilCalendarCategories::getCategoriesInfo ( )

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

360  : array
361  {
362  return $this->categories_info ?: array();
363  }

◆ getCategoryInfo()

ilCalendarCategories::getCategoryInfo ( int  $a_cat_id)

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

344  : array
345  {
346  if (isset($this->categories_info[$a_cat_id])) {
347  return $this->categories_info[$a_cat_id];
348  }
349 
350  if (in_array($a_cat_id, $this->subitem_categories)) {
351  foreach ($this->categories as $cat_id) {
352  if (in_array($a_cat_id, $this->categories_info[$cat_id]['subitem_ids'])) {
353  return $this->categories_info[$cat_id];
354  }
355  }
356  }
357  return [];
358  }

◆ getCHUserId()

ilCalendarCategories::getCHUserId ( )

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

References $ch_user_id.

Referenced by readAllConsultationHoursCalendarOfContainer(), and readConsultationHoursCalendar().

210  : int
211  {
212  return $this->ch_user_id;
213  }
+ Here is the caller graph for this function:

◆ getMode()

ilCalendarCategories::getMode ( )

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

References $mode.

Referenced by initialize().

220  : int
221  {
222  return $this->mode;
223  }
+ Here is the caller graph for this function:

◆ getNotificationCalendars()

ilCalendarCategories::getNotificationCalendars ( )

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

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

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

414  : array
415  {
416  $not = array();
417  foreach ($this->categories_info as $info) {
418  if ($info['type'] == ilCalendarCategory::TYPE_OBJ and $info['editable']) {
419  if (ilObject::_lookupType($info['obj_id']) == 'crs' or ilObject::_lookupType($info['obj_id']) == 'grp') {
420  $not[] = (int) $info['cat_id'];
421  }
422  }
423  }
424  return $not;
425  }
$info
Definition: entry_point.php:21
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getsourcerefid()

ilCalendarCategories::getsourcerefid ( )

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

References $root_ref_id.

242  : int
243  {
244  return $this->root_ref_id;
245  }

◆ getSubitemCategories()

ilCalendarCategories::getSubitemCategories ( int  $a_cat_id)

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

374  : array
375  {
376  if (!isset($this->categories_info[$a_cat_id]['subitem_ids'])) {
377  return array($a_cat_id);
378  }
379  return array_merge((array) $this->categories_info[$a_cat_id]['subitem_ids'], array($a_cat_id));
380  }

◆ getTargetRefId()

ilCalendarCategories::getTargetRefId ( )

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

References $target_ref_id.

230  : int
231  {
232  return $this->target_ref_id;
233  }

◆ initialize()

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

initialize visible categories

Definition at line 250 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().

Referenced by ilCalendarPresentationGUI\__construct(), and ilCalendarSelectionBlockGUI\getCalendars().

255  : void {
256  if ($this->getMode() != 0) {
257  throw new ilCalCategoriesInitializedMultipleException("ilCalendarCategories is initialized multiple times for user " . $this->user_id . ".");
258  }
259 
260  $this->setMode($a_mode);
261 
262  // see comments in https://mantis.ilias.de/view.php?id=25254
263  if ($a_use_cache && $this->getMode() != self::MODE_REPOSITORY_CONTAINER_ONLY) {
264  // Read categories from cache
265  if ($cats = ilCalendarCache::getInstance()->getEntry($this->user_id . ':' . $a_mode . ':categories:' . $a_source_ref_id)) {
266  if ($this->getMode() != self::MODE_REPOSITORY &&
267  $this->getMode() != self::MODE_CONSULTATION &&
268  $this->getMode() != self::MODE_PORTFOLIO_CONSULTATION) {
269  $this->wakeup($cats);
270  return;
271  }
272  }
273  }
274 
275  switch ($this->getMode()) {
276  case self::MODE_REMOTE_ACCESS:
278  $this->readPDCalendars();
279  } else {
280  $this->readSelectedItemCalendars();
281  }
282  break;
283 
284  case self::MODE_REMOTE_SELECTED:
285  $this->readSelectedCalendar($a_source_ref_id);
286  break;
287 
288  case self::MODE_PERSONAL_DESKTOP_MEMBERSHIP:
289  $this->readPDCalendars();
290  break;
291 
292  case self::MODE_PERSONAL_DESKTOP_ITEMS:
293  $this->readSelectedItemCalendars();
294  break;
295 
296  case self::MODE_REPOSITORY:
297  $this->root_ref_id = $a_source_ref_id;
298  $this->root_obj_id = ilObject::_lookupObjId($this->root_ref_id);
299  $this->readReposCalendars();
300  break;
301 
302  case self::MODE_REPOSITORY_CONTAINER_ONLY:
303  $this->root_ref_id = $a_source_ref_id;
304  $this->root_obj_id = ilObject::_lookupObjId($this->root_ref_id);
305  $this->readReposCalendars(true);
306  break;
307 
308  case self::MODE_MANAGE:
309  $this->readPDCalendars();
310  $this->readSelectedItemCalendars();
311  break;
312 
313  case self::MODE_CONSULTATION:
314  #$this->readPrivateCalendars();
315  $this->setTargetRefId($a_source_ref_id);
316  $this->readConsultationHoursCalendar($a_source_ref_id);
317  break;
318 
319  case self::MODE_PORTFOLIO_CONSULTATION:
321  break;
322 
323  case self::MODE_SINGLE_CALENDAR:
324  $this->readSingleCalendar($a_cat_id);
325  break;
326  }
327 
328  if ($a_use_cache) {
329  if ($this->getMode() != self::MODE_REPOSITORY &&
330  $this->getMode() != self::MODE_CONSULTATION &&
331  $this->getMode() != self::MODE_PORTFOLIO_CONSULTATION) {
332  // Store in cache
333  ilCalendarCache::getInstance()->storeEntry(
334  $this->user_id . ':' . $a_mode . ':categories:' . $a_source_ref_id,
335  $this->sleep(),
336  $this->user_id,
337  $a_mode,
338  'categories'
339  );
340  }
341  }
342  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readReposCalendars($a_container_only=false)
Read available repository calendars.
sleep()
Serialize categories.
static _lookupObjId(int $ref_id)
wakeup(string $a_ser)
Load from serialize string.
readSelectedCalendar(int $a_cal_id)
Read info about selected calendar.
readConsultationHoursCalendar(?int $a_target_ref_id=null, int $a_cat_id=0)
Read personal consultation hours calendar.
readPDCalendars()
Read categories of user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEditable()

ilCalendarCategories::isEditable ( int  $a_cat_id)

check if category is editable

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

430  : bool
431  {
432  return isset($this->categories_info[$a_cat_id]['editable']) && $this->categories_info[$a_cat_id]['editable'];
433  }

◆ isVisible()

ilCalendarCategories::isVisible (   $a_cat_id)

check if category is visible

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

438  : bool
439  {
440  return in_array($a_cat_id, $this->categories) || in_array($a_cat_id, $this->subitem_categories);
441  }

◆ lookupPrivateCategories()

static ilCalendarCategories::lookupPrivateCategories ( int  $a_user_id)
static

Lookup private categories of user.

Returns
array[]

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

References $DIC, $ilDB, ILIAS\Repository\int(), and ilCalendarCategory\TYPE_USR.

Referenced by ilUserExporter\getXmlExportTailDependencies().

984  : array
985  {
986  global $DIC;
987 
988  $ilDB = $DIC['ilDB'];
989 
990  // First read private calendars of user
991  $set = $ilDB->query("SELECT * FROM cal_categories " .
992  "WHERE type = " . $ilDB->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
993  "AND obj_id = " . $ilDB->quote($a_user_id, 'integer'));
994  $cats = array();
995 
996  while ($rec = $ilDB->fetchAssoc($set)) {
997  $rec['cat_id'] = (int) $rec['cat_id'];
998  $rec['obj_id'] = (int) $rec['obj_id'];
999  $rec['type'] = (int) $rec['type'];
1000  $rec['loc_type'] = (int) $rec['loc_type'];
1001  $cats[] = $rec;
1002  }
1003  return $cats;
1004  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupRelevantTalkSeriesIds()

ilCalendarCategories::lookupRelevantTalkSeriesIds ( )
protected
Returns
int[]

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

References ilObject\getId(), and ILIAS\Repository\user().

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

971  : array
972  {
973  $repository = new IliasDBEmployeeTalkSeriesRepository($this->user, $this->db);
974  $talks = $repository->findByOwnerAndEmployee();
975  return array_map(function (ilObjEmployeeTalkSeries $item) {
976  return $item->getId();
977  }, $talks);
978  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupRemoteCalendars()

static ilCalendarCategories::lookupRemoteCalendars ( )
static
Returns
ilCalendarCategory[]

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

References $DIC, $res, ilDBConstants\FETCHMODE_OBJECT, ilCalendarCategory\LTYPE_REMOTE, ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilCalendarCronRemoteReader\run().

100  : array
101  {
102  global $DIC;
103 
104  $db = $DIC->database();
105 
106  $query = 'SELECT cat_id FROM cal_categories ' .
107  'WHERE loc_type = ' . $db->quote(ilCalendarCategory::LTYPE_REMOTE);
108  $res = $db->query($query);
109  $remote = [];
110  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
111  $remote[] = new ilCalendarCategory((int) $row->cat_id);
112  }
113  return $remote;
114  }
$res
Definition: ltiservices.php:66
quote($value, string $type)
Stores calendar categories.
global $DIC
Definition: shib_login.php:26
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareCategoriesOfUserForSelection()

ilCalendarCategories::prepareCategoriesOfUserForSelection ( )

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

References $info, ILIAS\Repository\lng(), ilCalendarCategory\LTYPE_REMOTE, and ilCalendarCategory\TYPE_USR.

382  : array
383  {
384  $has_personal_calendar = false;
385  $cats = [];
386  foreach ($this->categories_info as $info) {
387  if ($info['obj_type'] == 'sess' || $info['obj_type'] == 'exc') {
388  continue;
389  }
390 
391  if (($info['remote'] ?? 0) == ilCalendarCategory::LTYPE_REMOTE) {
392  continue;
393  }
394 
395  if ($info['type'] == ilCalendarCategory::TYPE_USR and $info['editable']) {
396  $has_personal_calendar = true;
397  }
398 
399  if ($info['editable']) {
400  $cats[$info['cat_id']] = $info['title'];
401  }
402  }
403  // If there
404  if (!$has_personal_calendar) {
405  $cats[0] = $this->lng->txt('cal_default_calendar');
406  }
407  return $cats;
408  }
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:

◆ readAllConsultationHoursCalendarOfContainer()

ilCalendarCategories::readAllConsultationHoursCalendarOfContainer ( int  $a_container_ref_id)

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

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

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

Referenced by readReposCalendars().

730  : void
731  {
732  $obj_id = ilObject::_lookupObjId($a_container_ref_id);
733  $participants = ilCourseParticipants::_getInstanceByObjId($obj_id);
734  $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
735  $users = ilBookingEntry::lookupBookableUsersForObject([$obj_id], $users);
736  $old_ch = $this->getCHUserId();
737  foreach ($users as $user) {
738  $this->setCHUserId($user);
739  $this->readConsultationHoursCalendar($a_container_ref_id);
740  }
741  $this->setCHUserId($old_ch);
742  }
setCHUserId(int $a_user_id)
Set ch user id.
static _lookupObjId(int $ref_id)
static _getInstanceByObjId(int $a_obj_id)
static lookupBookableUsersForObject(array $a_obj_id, array $a_user_ids)
Consultation hours are offered if 1) consultation hour owner is admin or tutor and no object assignme...
readConsultationHoursCalendar(?int $a_target_ref_id=null, int $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 ( ?int  $user_id = null)

Read booking manager calendar.

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

References $res, $user_id, ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), and ilCalendarCategory\TYPE_BOOK.

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

826  : void
827  {
828  if (!$user_id) {
830  }
831 
832  $query = "SELECT * FROM cal_categories " .
833  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_BOOK, 'integer') . ' ' .
834  "AND obj_id = " . $this->db->quote($user_id, 'integer');
835  $res = $this->db->query($query);
836  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
837  $this->categories[] = (int) $row->cat_id;
838  $this->categories_info[(int) $row->cat_id]['source_ref_id'] = 0;
839  $this->categories_info[(int) $row->cat_id]['obj_type'] = '';
840  $this->categories_info[(int) $row->cat_id]['obj_id'] = (int) $row->obj_id;
841  $this->categories_info[(int) $row->cat_id]['cat_id'] = (int) $row->cat_id;
842  $this->categories_info[(int) $row->cat_id]['title'] = $row->title;
843  $this->categories_info[(int) $row->cat_id]['color'] = $row->color;
844  $this->categories_info[(int) $row->cat_id]['type'] = (int) $row->type;
845  $this->categories_info[(int) $row->cat_id]['editable'] = false;
846  $this->categories_info[(int) $row->cat_id]['settings'] = false;
847  $this->categories_info[(int) $row->cat_id]['accepted'] = false;
848  $this->categories_info[(int) $row->cat_id]['remote'] = false;
849  }
850  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readConsultationHoursCalendar()

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

Read personal consultation hours calendar.

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

References $res, ilObjUser\_lookupFullname(), ilObject\_lookupObjId(), ilDBConstants\FETCHMODE_OBJECT, getCHUserId(), ILIAS\Repository\int(), setCHUserId(), and ilCalendarCategory\TYPE_CH.

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

747  : void
748  {
749  if (!$this->getCHUserId()) {
750  $this->setCHUserId($this->user_id);
751  }
752 
753  if ($a_target_ref_id) {
754  $target_obj_id = ilObject::_lookupObjId($a_target_ref_id);
755 
756  $query = 'SELECT DISTINCT(cc.cat_id) FROM booking_entry be ' .
757  'LEFT JOIN booking_obj_assignment bo ON be.booking_id = bo.booking_id ' .
758  'JOIN cal_entries ce ON be.booking_id = ce.context_id ' .
759  'JOIN cal_cat_assignments ca ON ce.cal_id = ca.cal_id ' .
760  'JOIN cal_categories cc ON ca.cat_id = cc.cat_id ' .
761  'WHERE ((bo.target_obj_id IS NULL) OR bo.target_obj_id = ' . $this->db->quote(
762  $target_obj_id,
763  'integer'
764  ) . ' ) ';
765 
766  // limit only to user if no cat id is given
767  if ($a_cat_id == 0) {
768  $query .= 'AND cc.obj_id = ' . $this->db->quote($this->getCHUserId(), 'integer');
769  }
770 
771  $res = $this->db->query($query);
772  $categories = array();
773  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
774  if ($a_cat_id == 0 || (int) $row->cat_id == $a_cat_id) {
775  $categories[] = (int) $row->cat_id;
776  }
777  }
778 
779  if ($categories) {
780  $query = 'SELECT * FROM cal_categories ' .
781  'WHERE ' . $this->db->in('cat_id', $categories, false, 'integer');
782  $res = $this->db->query($query);
783  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
784  $this->categories[] = (int) $row->cat_id;
785  $this->categories_info[(int) $row->cat_id]['obj_type'] = '';
786  $this->categories_info[(int) $row->cat_id]['source_ref_id'] = 0;
787  $this->categories_info[(int) $row->cat_id]['obj_id'] = (int) $row->obj_id;
788  $this->categories_info[(int) $row->cat_id]['cat_id'] = (int) $row->cat_id;
789  $this->categories_info[(int) $row->cat_id]['title'] = ilObjUser::_lookupFullname((int) $row->obj_id);
790  $this->categories_info[(int) $row->cat_id]['color'] = $row->color;
791  $this->categories_info[(int) $row->cat_id]['type'] = (int) $row->type;
792  $this->categories_info[(int) $row->cat_id]['editable'] = false;
793  $this->categories_info[(int) $row->cat_id]['settings'] = false;
794  $this->categories_info[(int) $row->cat_id]['accepted'] = false;
795  $this->categories_info[(int) $row->cat_id]['remote'] = false;
796  }
797  }
798  } else { // no category given
799  $filter = ($a_cat_id > 0)
800  ? " AND cat_id = " . $this->db->quote($a_cat_id, "integer")
801  : " AND obj_id = " . $this->db->quote($this->getCHUserId(), 'integer');
802 
803  $query = "SELECT * FROM cal_categories cc " .
804  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_CH, 'integer') . ' ' . $filter;
805  $res = $this->db->query($query);
806  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
807  $this->categories[] = (int) $row->cat_id;
808  $this->categories_info[(int) $row->cat_id]['obj_type'] = '';
809  $this->categories_info[(int) $row->cat_id]['source_ref_id'] = 0;
810  $this->categories_info[(int) $row->cat_id]['obj_id'] = (int) $row->obj_id;
811  $this->categories_info[(int) $row->cat_id]['cat_id'] = (int) $row->cat_id;
812  $this->categories_info[(int) $row->cat_id]['title'] = $row->title;
813  $this->categories_info[(int) $row->cat_id]['color'] = $row->color;
814  $this->categories_info[(int) $row->cat_id]['type'] = (int) $row->type;
815  $this->categories_info[(int) $row->cat_id]['editable'] = false;
816  $this->categories_info[(int) $row->cat_id]['settings'] = false;
817  $this->categories_info[(int) $row->cat_id]['accepted'] = false;
818  $this->categories_info[(int) $row->cat_id]['remote'] = false;
819  }
820  }
821  }
$res
Definition: ltiservices.php:66
setCHUserId(int $a_user_id)
Set ch user id.
static _lookupFullname(int $a_user_id)
static _lookupObjId(int $ref_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPDCalendars()

ilCalendarCategories::readPDCalendars ( )
protected

Read categories of user.

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

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

Referenced by initialize().

446  : void
447  {
448  $this->readPublicCalendars();
449  $this->readPrivateCalendars();
451  $this->readBookingCalendar();
452 
453  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, ['crs']));
454  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, ['grp']));
455  $this->readSelectedCategories(
457  0,
458  false
459  );
460 
461  $this->addSubitemCalendars();
462  }
addSubitemCalendars()
Add subitem calendars E.g.
readBookingCalendar(?int $user_id=null)
Read booking manager calendar.
readSelectedCategories(array $a_obj_ids, int $a_source_ref_id=0, bool $check_permissions=true)
readPrivateCalendars(?array $only_cat_ids=null)
Read private calendars.
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
readPublicCalendars($cat_ids=null)
Read public calendars.
readConsultationHoursCalendar(?int $a_target_ref_id=null, int $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:

◆ readPrivateCalendars()

ilCalendarCategories::readPrivateCalendars ( ?array  $only_cat_ids = null)
protected

Read private calendars.

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

References $id, $res, ilDBConstants\FETCHMODE_OBJECT, ilCalendarSharedStatus\getAcceptedCalendars(), if, ILIAS\Repository\int(), ilCalendarCategory\LTYPE_REMOTE, ilCalendarCategory\TYPE_USR, and ILIAS\Repository\user().

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

662  : void
663  {
664  $cat_ids = [];
665  $in = "";
666  if (is_array($only_cat_ids)) {
667  $in = " AND " . $this->db->in('cat_id', $only_cat_ids, false, 'integer') . " ";
668  }
669 
670  // First read private calendars of user
671  $query = "SELECT cat_id FROM cal_categories " .
672  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
673  "AND obj_id = " . $this->db->quote($this->user->getId(), 'integer') . " " . $in;
674  $res = $this->db->query($query);
675  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
676  $cat_ids[] = (int) $row->cat_id;
677  }
678 
679  // Read shared calendars
680  $accepted_ids = ilCalendarSharedStatus::getAcceptedCalendars($this->user->getId());
681  if (!$cat_ids = array_merge($cat_ids, $accepted_ids)) {
682  return;
683  }
684  if (is_array($only_cat_ids)) {
685  $cat_ids = array_filter($cat_ids, function ($id) use ($only_cat_ids) {
686  return in_array($id, $only_cat_ids);
687  });
688  }
689  // user categories
690  $query = "SELECT * FROM cal_categories " .
691  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
692  "AND " . $this->db->in('cat_id', $cat_ids, false, 'integer') . " " .
693  "ORDER BY title ";
694 
695  $res = $this->db->query($query);
696  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
697  $this->categories[] = (int) $row->cat_id;
698  $this->categories_info[(int) $row->cat_id]['obj_type'] = '';
699  $this->categories_info[(int) $row->cat_id]['source_ref_id'] = 0;
700  $this->categories_info[(int) $row->cat_id]['obj_id'] = (int) $row->obj_id;
701  $this->categories_info[(int) $row->cat_id]['cat_id'] = (int) $row->cat_id;
702  $this->categories_info[(int) $row->cat_id]['title'] = $row->title;
703  $this->categories_info[(int) $row->cat_id]['color'] = $row->color;
704  $this->categories_info[(int) $row->cat_id]['type'] = (int) $row->type;
705 
706  if (in_array((int) $row->cat_id, $accepted_ids)) {
707  $shared = new ilCalendarShared((int) $row->cat_id);
708  if ($shared->isEditableForUser($this->user->getId())) {
709  $this->categories_info[(int) $row->cat_id]['editable'] = true;
710  } else {
711  $this->categories_info[(int) $row->cat_id]['editable'] = false;
712  }
713  } else {
714  $this->categories_info[(int) $row->cat_id]['editable'] = true;
715  }
716  if ($this->user->getId() == (int) $row->obj_id) {
717  $this->categories_info[(int) $row->cat_id]['settings'] = true;
718  } else {
719  $this->categories_info[(int) $row->cat_id]['settings'] = false;
720  }
721 
722  $this->categories_info[(int) $row->cat_id]['accepted'] = in_array((int) $row->cat_id, $accepted_ids);
723  $this->categories_info[(int) $row->cat_id]['remote'] = ((int) $row->loc_type == ilCalendarCategory::LTYPE_REMOTE);
724  }
725  }
$res
Definition: ltiservices.php:66
static getAcceptedCalendars(int $a_usr_id)
if(!file_exists('../ilias.ini.php'))
Handles shared calendars.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ 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.

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

References $res, ilCalendarSettings\_getInstance(), ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), ilCalendarCategory\LTYPE_REMOTE, and ilCalendarCategory\TYPE_GLOBAL.

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

624  : void
625  {
626  $in = "";
627  if (is_array($cat_ids)) {
628  $in = " AND " . $this->db->in('cat_id', $cat_ids, false, 'integer') . " ";
629  }
630 
631  // global categories
632  $query = "SELECT * FROM cal_categories " .
633  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_GLOBAL, 'integer') . " " . $in .
634  "ORDER BY title ";
635 
636  $res = $this->db->query($query);
637  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
638  $this->categories[] = (int) $row->cat_id;
639  $this->categories_info[(int) $row->cat_id]['obj_type'] = '';
640  $this->categories_info[(int) $row->cat_id]['source_ref_id'] = 0;
641  $this->categories_info[(int) $row->cat_id]['obj_id'] = (int) $row->obj_id;
642  $this->categories_info[(int) $row->cat_id]['cat_id'] = (int) $row->cat_id;
643  $this->categories_info[(int) $row->cat_id]['title'] = $row->title;
644  $this->categories_info[(int) $row->cat_id]['color'] = $row->color;
645  $this->categories_info[(int) $row->cat_id]['type'] = (int) $row->type;
646  $this->categories_info[(int) $row->cat_id]['editable'] = $this->rbacsystem->checkAccess(
647  'edit_event',
648  ilCalendarSettings::_getInstance()->getCalendarSettingsId()
649  );
650  $this->categories_info[(int) $row->cat_id]['settings'] = $this->rbacsystem->checkAccess(
651  'write',
652  ilCalendarSettings::_getInstance()->getCalendarSettingsId()
653  );
654  $this->categories_info[(int) $row->cat_id]['accepted'] = false;
655  $this->categories_info[(int) $row->cat_id]['remote'] = (int) $row->loc_type == ilCalendarCategory::LTYPE_REMOTE;
656  }
657  }
$res
Definition: ltiservices.php:66
+ 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.

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

References $GLOBALS, $res, ilCalendarSettings\_getInstance(), ilParticipants\_getMembershipByType(), ilObject\_lookupType(), ILIAS\Repository\access(), addSubitemCalendars(), ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), lookupRelevantTalkSeriesIds(), readAllConsultationHoursCalendarOfContainer(), readBookingCalendar(), readPrivateCalendars(), readPublicCalendars(), and readSelectedCategories().

Referenced by initialize().

531  : void
532  {
533  if (!$a_container_only) {
534  $this->readPublicCalendars();
535  $this->readPrivateCalendars();
536  //$this->readConsultationHoursCalendar($this->root_ref_id);
537  $this->readAllConsultationHoursCalendarOfContainer($this->root_ref_id);
538  }
539 
540  #$query = "SELECT ref_id,obd.obj_id obj_id FROM tree t1 ".
541  # "JOIN object_reference obr ON t1.child = obr.ref_id ".
542  # "JOIN object_data obd ON obd.obj_id = obr.obj_id ".
543  # "WHERE t1.lft >= (SELECT lft FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
544  # "AND t1.lft <= (SELECT rgt FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
545  # "AND ".$ilDB->in('type',array('crs','grp','sess'),false,'text')." ".
546  # "AND tree = 1";
547 
548  // alternative 1: do not aggregate items of current course
549  if (false) { //
550  $subtree_query = $GLOBALS['DIC']['tree']->getSubTreeQuery(
551  $this->root_ref_id,
552  array('object_reference.ref_id', 'object_data.obj_id'),
553  array('crs', 'grp', 'sess', 'exc')
554  );
555 
556  $res = $this->db->query($subtree_query);
557  $obj_ids = array();
558  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
559  if ($this->tree->isDeleted((int) $row->ref_id)) {
560  continue;
561  }
562 
563  $obj_type = ilObject::_lookupType((int) $row->obj_id);
564  if ($obj_type == 'crs' or $obj_type == 'grp') {
565  //Added for calendar revision --> https://goo.gl/CXGTRF
566  //In 5.2-trunk, the booking pools did not appear in the marginal calendar.
567  $this->readBookingCalendar();
568  // Check for global/local activation
569  if (!ilCalendarSettings::_getInstance()->lookupCalendarActivated((int) $row->obj_id)) {
570  continue;
571  }
572  }
573  if ($this->access->checkAccess('read', '', (int) $row->ref_id)) {
574  $obj_ids[] = (int) $row->obj_id;
575  }
576  }
577  $this->readSelectedCategories($obj_ids, $this->root_ref_id);
578  } else { // alternative 2: aggregate items of current course (discussion with timon 3.8.3017: this is the current preference)
579  $this->readSelectedCategories(array($this->root_obj_id), $this->root_ref_id);
580  }
581 
582  if (!$a_container_only) {
583  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, ['crs']));
584  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, ['grp']));
585  $this->readSelectedCategories(
587  0,
588  false
589  );
590  }
591 
592  $this->addSubitemCalendars();
593  }
$res
Definition: ltiservices.php:66
addSubitemCalendars()
Add subitem calendars E.g.
readBookingCalendar(?int $user_id=null)
Read booking manager calendar.
$GLOBALS["DIC"]
Definition: wac.php:53
readSelectedCategories(array $a_obj_ids, int $a_source_ref_id=0, bool $check_permissions=true)
readAllConsultationHoursCalendarOfContainer(int $a_container_ref_id)
Read personal consultation hours calendar of all tutors for a container.
readPrivateCalendars(?array $only_cat_ids=null)
Read private calendars.
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
static _lookupType(int $id, bool $reference=false)
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 ( int  $a_cal_id)
protected

Read info about selected calendar.

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

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

Referenced by initialize(), and readSingleCalendar().

467  : void
468  {
469  $cat = new ilCalendarCategory($a_cal_id);
470  if ($cat->getType() == ilCalendarCategory::TYPE_OBJ) {
471  $this->readSelectedCategories(array($cat->getObjId()));
472  $this->addSubitemCalendars();
473  } else {
474  $this->categories[] = $a_cal_id;
475  }
476  }
addSubitemCalendars()
Add subitem calendars E.g.
Stores calendar categories.
readSelectedCategories(array $a_obj_ids, int $a_source_ref_id=0, bool $check_permissions=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSelectedCategories()

ilCalendarCategories::readSelectedCategories ( array  $a_obj_ids,
int  $a_source_ref_id = 0,
bool  $check_permissions = true 
)
protected

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

References $ref_id, $res, ilObject\_getAllReferences(), ilCalendarSettings\_getInstance(), ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\Repository\access(), ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), and ilCalendarCategory\TYPE_OBJ.

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

852  : void
853  {
854  if (!count($a_obj_ids)) {
855  return;
856  }
857 
858  $query = "SELECT * FROM cal_categories " .
859  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_OBJ, 'integer') . " " .
860  "AND " . $this->db->in('obj_id', $a_obj_ids, false, 'integer') . " " .
861  "ORDER BY title ";
862 
863  $res = $this->db->query($query);
864  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
865  // check activation/deactivation
866  $obj_type = ilObject::_lookupType((int) $row->obj_id);
867  if ($obj_type == 'crs' or $obj_type == 'grp') {
868  if (!ilCalendarSettings::_getInstance()->lookupCalendarActivated((int) $row->obj_id)) {
869  continue;
870  }
871  }
872 
873  $editable = false;
874  $exists = false;
875  $settings = false;
876  foreach (ilObject::_getAllReferences((int) $row->obj_id) as $ref_id) {
877  if ($this->access->checkAccess('edit_event', '', $ref_id)) {
878  $settings = true;
879  }
880  if ($this->access->checkAccess('edit_event', '', $ref_id)) {
881  $exists = true;
882  $editable = true;
883  break;
884  } elseif ($this->access->checkAccess('read', '', $ref_id)) {
885  $exists = true;
886  }
887  }
888  if (!$exists && $check_permissions) {
889  continue;
890  }
891  $this->categories_info[(int) $row->cat_id]['editable'] = $editable;
892  $this->categories_info[(int) $row->cat_id]['accepted'] = false;
893  $this->categories_info[(int) $row->cat_id]['settings'] = $settings;
894 
895  $this->categories[] = (int) $row->cat_id;
896  $this->categories_info[(int) $row->cat_id]['obj_type'] = ilObject::_lookupType((int) $row->obj_id);
897  $this->categories_info[(int) $row->cat_id]['obj_id'] = (int) $row->obj_id;
898  $this->categories_info[(int) $row->cat_id]['cat_id'] = (int) $row->cat_id;
899  $this->categories_info[(int) $row->cat_id]['color'] = $row->color;
900  #$this->categories_info[$row->cat_id]['title'] = ilObject::_lookupTitle($row->obj_id);
901  $this->categories_info[(int) $row->cat_id]['title'] = $row->title;
902  $this->categories_info[(int) $row->cat_id]['type'] = (int) $row->type;
903  $this->categories_info[(int) $row->cat_id]['remote'] = false;
904  $this->categories_info[(int) $row->cat_id]['source_ref_id'] = $a_source_ref_id;
905  }
906  }
$res
Definition: ltiservices.php:66
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:65
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readSelectedItemCalendars()

ilCalendarCategories::readSelectedItemCalendars ( )
protected

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

References ILIAS\Repository\access(), addSubitemCalendars(), lookupRelevantTalkSeriesIds(), readBookingCalendar(), readConsultationHoursCalendar(), readPrivateCalendars(), readPublicCalendars(), and readSelectedCategories().

Referenced by initialize().

478  : void
479  {
480  $this->readPublicCalendars();
481  $this->readPrivateCalendars();
483  $this->readBookingCalendar();
484 
485  $obj_ids = array();
486 
487  $courses = array();
488  $groups = array();
489  $sessions = array();
490  $exercises = array();
491  foreach ($this->fav_rep->getFavouritesOfUser(
492  $this->user->getId(),
493  array('crs', 'grp', 'sess', 'exc')
494  ) as $item) {
495  if ($this->access->checkAccess('read', '', $item['ref_id'])) {
496  switch ($item['type']) {
497  case 'crs':
498  $courses[] = $item['obj_id'];
499  break;
500 
501  case 'sess':
502  $sessions[] = $item['obj_id'];
503  break;
504 
505  case 'grp':
506  $groups[] = $item['obj_id'];
507  break;
508 
509  case 'exc':
510  $exercises[] = $item['obj_id'];
511  break;
512  }
513  }
514  }
515  $this->readSelectedCategories($courses);
516  $this->readSelectedCategories($sessions);
517  $this->readSelectedCategories($groups);
518  $this->readSelectedCategories($exercises);
519  $this->readSelectedCategories(
521  0,
522  false
523  );
524 
525  $this->addSubitemCalendars();
526  }
addSubitemCalendars()
Add subitem calendars E.g.
readBookingCalendar(?int $user_id=null)
Read booking manager calendar.
readSelectedCategories(array $a_obj_ids, int $a_source_ref_id=0, bool $check_permissions=true)
readPrivateCalendars(?array $only_cat_ids=null)
Read private calendars.
readPublicCalendars($cat_ids=null)
Read public calendars.
readConsultationHoursCalendar(?int $a_target_ref_id=null, int $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:

◆ readSingleCalendar()

ilCalendarCategories::readSingleCalendar ( int  $a_cat_id)

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

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

595  : void
596  {
597  $cat = new ilCalendarCategory($a_cat_id);
598  switch ($cat->getType()) {
600  $this->readSelectedCalendar($a_cat_id);
601  break;
602 
604  $this->readPublicCalendars(array($a_cat_id));
605  break;
606 
608  $this->readPrivateCalendars(array($a_cat_id));
609  break;
610 
612  $this->readConsultationHoursCalendar($this->root_ref_id, $a_cat_id);
613  break;
614 
616  $this->readBookingCalendar();
617  break;
618  }
619  }
readBookingCalendar(?int $user_id=null)
Read booking manager calendar.
Stores calendar categories.
readPrivateCalendars(?array $only_cat_ids=null)
Read private calendars.
readPublicCalendars($cat_ids=null)
Read public calendars.
readSelectedCalendar(int $a_cal_id)
Read info about selected calendar.
readConsultationHoursCalendar(?int $a_target_ref_id=null, int $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:

◆ setCHUserId()

ilCalendarCategories::setCHUserId ( int  $a_user_id)

Set ch user id.

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

Referenced by readAllConsultationHoursCalendarOfContainer(), and readConsultationHoursCalendar().

205  : void
206  {
207  $this->ch_user_id = $a_user_id;
208  }
+ Here is the caller graph for this function:

◆ setMode()

ilCalendarCategories::setMode ( int  $a_mode)
protected

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

Referenced by initialize().

215  : void
216  {
217  $this->mode = $a_mode;
218  }
+ Here is the caller graph for this function:

◆ setSourceRefId()

ilCalendarCategories::setSourceRefId ( int  $a_val)

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

235  : void
236  {
237  $this->root_ref_id = $a_val;
238  }

◆ setTargetRefId()

ilCalendarCategories::setTargetRefId ( int  $a_ref_id)
protected

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

Referenced by initialize().

225  : void
226  {
227  $this->target_ref_id = $a_ref_id;
228  }
+ Here is the caller graph for this function:

◆ sleep()

ilCalendarCategories::sleep ( )
finalprotected

Serialize categories.

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

Referenced by initialize().

179  : string
180  {
181  return serialize(
182  array(
183  'categories' => $this->categories,
184  'categories_info' => $this->categories_info,
185  'subitem_categories' => $this->subitem_categories
186  )
187  );
188  }
+ Here is the caller graph for this function:

◆ wakeup()

ilCalendarCategories::wakeup ( string  $a_ser)
protected

Load from serialize string.

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

References $info.

Referenced by initialize().

193  : void
194  {
195  $info = unserialize($a_ser);
196 
197  $this->categories = $info['categories'];
198  $this->categories_info = $info['categories_info'];
199  $this->subitem_categories = $info['subitem_categories'];
200  }
$info
Definition: entry_point.php:21
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilCalendarCategories::$access
protected

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

◆ $categories

array ilCalendarCategories::$categories = array()
protected

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

◆ $categories_info

array ilCalendarCategories::$categories_info = array()
protected

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

◆ $ch_user_id

int ilCalendarCategories::$ch_user_id = 0
protected

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

Referenced by getCHUserId().

◆ $db

ilDBInterface ilCalendarCategories::$db
protected

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

◆ $fav_rep

ilFavouritesDBRepository ilCalendarCategories::$fav_rep
protected

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

◆ $instance

ilCalendarCategories ilCalendarCategories::$instance = null
staticprotected

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

◆ $lng

ilLanguage ilCalendarCategories::$lng
protected

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

◆ $logger

ilLogger ilCalendarCategories::$logger
protected

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

◆ $mode

int ilCalendarCategories::$mode = self::MODE_UNDEFINED
protected

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

Referenced by getMode().

◆ $rbacsystem

ilRbacSystem ilCalendarCategories::$rbacsystem
protected

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

◆ $root_obj_id

int ilCalendarCategories::$root_obj_id = 0
protected

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

◆ $root_ref_id

int ilCalendarCategories::$root_ref_id = 0
protected

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

Referenced by getsourcerefid().

◆ $subitem_categories

array ilCalendarCategories::$subitem_categories = array()
protected

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

◆ $target_ref_id

int ilCalendarCategories::$target_ref_id = 0
protected

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

Referenced by getTargetRefId().

◆ $tree

ilTree ilCalendarCategories::$tree
protected

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

◆ $user

ilObjUser ilCalendarCategories::$user
protected

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

◆ $user_id

int ilCalendarCategories::$user_id = 0
protected

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

Referenced by readBookingCalendar().

◆ MODE_CONSULTATION

const ilCalendarCategories::MODE_CONSULTATION = 7

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

Referenced by ilCalendarSchedule\__construct().

◆ MODE_MANAGE

const ilCalendarCategories::MODE_MANAGE = 6

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

◆ MODE_PERSONAL_DESKTOP_ITEMS

const ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS = 5

◆ MODE_PERSONAL_DESKTOP_MEMBERSHIP

const ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP = 4

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

Referenced by ilCalendarBlockGUI\initCategories().

◆ MODE_SINGLE_CALENDAR

const ilCalendarCategories::MODE_SINGLE_CALENDAR = 11

◆ MODE_UNDEFINED

const ilCalendarCategories::MODE_UNDEFINED = 0

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

Referenced by ilCalendarActions\__construct().


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