ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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:22
+ 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(), ilAppointmentPresentationConsultationHoursGUI\collectPropertiesAndActions(), ilCalendarAppointmentGUI\distributeNotifications(), ilCalendarAppointmentGUI\edit(), ilCalendarAppointmentGUI\editResponsibleUsers(), ilPortfolioPageGUI\executeCommand(), ilCalendarScheduleFilterHidden\filterCategories(), ilAppointmentPresentationGUI\getCatInfo(), ilCalendarSchedule\getChangedEvents(), ilCalendarSchedule\getEvents(), ilCalendarAppointmentPanelGUI\getHTML(), ilCalendarAgendaListGUI\getHTML(), ilCalendarRemoteAccessHandler\handleRequest(), ilPDCalendarBlockGUI\initCategories(), ilCalendarBlockGUI\initCategories(), ilCalendarAppointmentGUI\initForm(), ilCalendarCategoryGUI\initFormCategory(), ilCalendarManageTableGUI\parse(), 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:22
+ 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\initForm().

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:22
+ 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 908 of file class.ilCalendarCategories.php.

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

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

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

361  : array
362  {
363  if ($a_include_subitem_calendars) {
364  return array_merge($this->categories, $this->subitem_categories);
365  }
366 
367  return $this->categories ?: array();
368  }

◆ getCategoriesInfo()

ilCalendarCategories::getCategoriesInfo ( )

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

356  : array
357  {
358  return $this->categories_info ?: array();
359  }

◆ getCategoryInfo()

ilCalendarCategories::getCategoryInfo ( int  $a_cat_id)

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

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

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

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

410  : array
411  {
412  $not = array();
413  foreach ($this->categories_info as $info) {
414  if ($info['type'] == ilCalendarCategory::TYPE_OBJ and $info['editable']) {
415  if (ilObject::_lookupType($info['obj_id']) == 'crs' or ilObject::_lookupType($info['obj_id']) == 'grp') {
416  $not[] = (int) $info['cat_id'];
417  }
418  }
419  }
420  return $not;
421  }
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 370 of file class.ilCalendarCategories.php.

370  : array
371  {
372  if (!isset($this->categories_info[$a_cat_id]['subitem_ids'])) {
373  return array($a_cat_id);
374  }
375  return array_merge((array) $this->categories_info[$a_cat_id]['subitem_ids'], array($a_cat_id));
376  }

◆ 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  // Store in cache
330  ilCalendarCache::getInstance()->storeEntry(
331  $this->user_id . ':' . $a_mode . ':categories:' . $a_source_ref_id,
332  $this->sleep(),
333  $this->user_id,
334  $a_mode,
335  'categories'
336  );
337  }
338  }
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 426 of file class.ilCalendarCategories.php.

426  : bool
427  {
428  return isset($this->categories_info[$a_cat_id]['editable']) && $this->categories_info[$a_cat_id]['editable'];
429  }

◆ isVisible()

ilCalendarCategories::isVisible (   $a_cat_id)

check if category is visible

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

434  : bool
435  {
436  return in_array($a_cat_id, $this->categories) || in_array($a_cat_id, $this->subitem_categories);
437  }

◆ lookupPrivateCategories()

static ilCalendarCategories::lookupPrivateCategories ( int  $a_user_id)
static

Lookup private categories of user.

Returns
array[]

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

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

Referenced by ilUserExporter\getXmlExportTailDependencies().

980  : array
981  {
982  global $DIC;
983 
984  $ilDB = $DIC['ilDB'];
985 
986  // First read private calendars of user
987  $set = $ilDB->query("SELECT * FROM cal_categories " .
988  "WHERE type = " . $ilDB->quote(ilCalendarCategory::TYPE_USR, 'integer') . " " .
989  "AND obj_id = " . $ilDB->quote($a_user_id, 'integer'));
990  $cats = array();
991 
992  while ($rec = $ilDB->fetchAssoc($set)) {
993  $rec['cat_id'] = (int) $rec['cat_id'];
994  $rec['obj_id'] = (int) $rec['obj_id'];
995  $rec['type'] = (int) $rec['type'];
996  $rec['loc_type'] = (int) $rec['loc_type'];
997  $cats[] = $rec;
998  }
999  return $cats;
1000  }
global $DIC
Definition: shib_login.php:22
+ 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 967 of file class.ilCalendarCategories.php.

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

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

967  : array
968  {
969  $repository = new IliasDBEmployeeTalkSeriesRepository($this->user, $this->db);
970  $talks = $repository->findByOwnerAndEmployee();
971  return array_map(function (ilObjEmployeeTalkSeries $item) {
972  return $item->getId();
973  }, $talks);
974  }
+ 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:22
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 378 of file class.ilCalendarCategories.php.

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

378  : array
379  {
380  $has_personal_calendar = false;
381  $cats = [];
382  foreach ($this->categories_info as $info) {
383  if ($info['obj_type'] == 'sess' || $info['obj_type'] == 'exc') {
384  continue;
385  }
386 
387  if (($info['remote'] ?? 0) == ilCalendarCategory::LTYPE_REMOTE) {
388  continue;
389  }
390 
391  if ($info['type'] == ilCalendarCategory::TYPE_USR and $info['editable']) {
392  $has_personal_calendar = true;
393  }
394 
395  if ($info['editable']) {
396  $cats[$info['cat_id']] = $info['title'];
397  }
398  }
399  // If there
400  if (!$has_personal_calendar) {
401  $cats[0] = $this->lng->txt('cal_default_calendar');
402  }
403  return $cats;
404  }
+ 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 726 of file class.ilCalendarCategories.php.

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

Referenced by readReposCalendars().

726  : void
727  {
728  $obj_id = ilObject::_lookupObjId($a_container_ref_id);
729  $participants = ilCourseParticipants::_getInstanceByObjId($obj_id);
730  $users = array_unique(array_merge($participants->getTutors(), $participants->getAdmins()));
731  $users = ilBookingEntry::lookupBookableUsersForObject([$obj_id], $users);
732  $old_ch = $this->getCHUserId();
733  foreach ($users as $user) {
734  $this->setCHUserId($user);
735  $this->readConsultationHoursCalendar($a_container_ref_id);
736  }
737  $this->setCHUserId($old_ch);
738  }
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 822 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().

822  : void
823  {
824  if (!$user_id) {
826  }
827 
828  $query = "SELECT * FROM cal_categories " .
829  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_BOOK, 'integer') . ' ' .
830  "AND obj_id = " . $this->db->quote($user_id, 'integer');
831  $res = $this->db->query($query);
832  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
833  $this->categories[] = (int) $row->cat_id;
834  $this->categories_info[(int) $row->cat_id]['source_ref_id'] = 0;
835  $this->categories_info[(int) $row->cat_id]['obj_type'] = '';
836  $this->categories_info[(int) $row->cat_id]['obj_id'] = (int) $row->obj_id;
837  $this->categories_info[(int) $row->cat_id]['cat_id'] = (int) $row->cat_id;
838  $this->categories_info[(int) $row->cat_id]['title'] = $row->title;
839  $this->categories_info[(int) $row->cat_id]['color'] = $row->color;
840  $this->categories_info[(int) $row->cat_id]['type'] = (int) $row->type;
841  $this->categories_info[(int) $row->cat_id]['editable'] = false;
842  $this->categories_info[(int) $row->cat_id]['settings'] = false;
843  $this->categories_info[(int) $row->cat_id]['accepted'] = false;
844  $this->categories_info[(int) $row->cat_id]['remote'] = false;
845  }
846  }
$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 743 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().

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

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

Referenced by initialize().

442  : void
443  {
444  $this->readPublicCalendars();
445  $this->readPrivateCalendars();
447  $this->readBookingCalendar();
448 
449  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, ['crs']));
450  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, ['grp']));
451  $this->readSelectedCategories(
453  0,
454  false
455  );
456 
457  $this->addSubitemCalendars();
458  }
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 658 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().

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

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

527  : void
528  {
529  if (!$a_container_only) {
530  $this->readPublicCalendars();
531  $this->readPrivateCalendars();
532  //$this->readConsultationHoursCalendar($this->root_ref_id);
533  $this->readAllConsultationHoursCalendarOfContainer($this->root_ref_id);
534  }
535 
536  #$query = "SELECT ref_id,obd.obj_id obj_id FROM tree t1 ".
537  # "JOIN object_reference obr ON t1.child = obr.ref_id ".
538  # "JOIN object_data obd ON obd.obj_id = obr.obj_id ".
539  # "WHERE t1.lft >= (SELECT lft FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
540  # "AND t1.lft <= (SELECT rgt FROM tree WHERE child = ".$this->db->quote($this->root_ref_id,'integer')." ) ".
541  # "AND ".$ilDB->in('type',array('crs','grp','sess'),false,'text')." ".
542  # "AND tree = 1";
543 
544  // alternative 1: do not aggregate items of current course
545  if (false) { //
546  $subtree_query = $GLOBALS['DIC']['tree']->getSubTreeQuery(
547  $this->root_ref_id,
548  array('object_reference.ref_id', 'object_data.obj_id'),
549  array('crs', 'grp', 'sess', 'exc')
550  );
551 
552  $res = $this->db->query($subtree_query);
553  $obj_ids = array();
554  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
555  if ($this->tree->isDeleted((int) $row->ref_id)) {
556  continue;
557  }
558 
559  $obj_type = ilObject::_lookupType((int) $row->obj_id);
560  if ($obj_type == 'crs' or $obj_type == 'grp') {
561  //Added for calendar revision --> https://goo.gl/CXGTRF
562  //In 5.2-trunk, the booking pools did not appear in the marginal calendar.
563  $this->readBookingCalendar();
564  // Check for global/local activation
565  if (!ilCalendarSettings::_getInstance()->lookupCalendarActivated((int) $row->obj_id)) {
566  continue;
567  }
568  }
569  if ($this->access->checkAccess('read', '', (int) $row->ref_id)) {
570  $obj_ids[] = (int) $row->obj_id;
571  }
572  }
573  $this->readSelectedCategories($obj_ids, $this->root_ref_id);
574  } else { // alternative 2: aggregate items of current course (discussion with timon 3.8.3017: this is the current preference)
575  $this->readSelectedCategories(array($this->root_obj_id), $this->root_ref_id);
576  }
577 
578  if (!$a_container_only) {
579  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, ['crs']));
580  $this->readSelectedCategories(ilParticipants::_getMembershipByType($this->user_id, ['grp']));
581  $this->readSelectedCategories(
583  0,
584  false
585  );
586  }
587 
588  $this->addSubitemCalendars();
589  }
$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 463 of file class.ilCalendarCategories.php.

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

Referenced by initialize(), and readSingleCalendar().

463  : void
464  {
465  $cat = new ilCalendarCategory($a_cal_id);
466  if ($cat->getType() == ilCalendarCategory::TYPE_OBJ) {
467  $this->readSelectedCategories(array($cat->getObjId()));
468  $this->addSubitemCalendars();
469  } else {
470  $this->categories[] = $a_cal_id;
471  }
472  }
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 848 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().

848  : void
849  {
850  if (!count($a_obj_ids)) {
851  return;
852  }
853 
854  $query = "SELECT * FROM cal_categories " .
855  "WHERE type = " . $this->db->quote(ilCalendarCategory::TYPE_OBJ, 'integer') . " " .
856  "AND " . $this->db->in('obj_id', $a_obj_ids, false, 'integer') . " " .
857  "ORDER BY title ";
858 
859  $res = $this->db->query($query);
860  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
861  // check activation/deactivation
862  $obj_type = ilObject::_lookupType((int) $row->obj_id);
863  if ($obj_type == 'crs' or $obj_type == 'grp') {
864  if (!ilCalendarSettings::_getInstance()->lookupCalendarActivated((int) $row->obj_id)) {
865  continue;
866  }
867  }
868 
869  $editable = false;
870  $exists = false;
871  $settings = false;
872  foreach (ilObject::_getAllReferences((int) $row->obj_id) as $ref_id) {
873  if ($this->access->checkAccess('edit_event', '', $ref_id)) {
874  $settings = true;
875  }
876  if ($this->access->checkAccess('edit_event', '', $ref_id)) {
877  $exists = true;
878  $editable = true;
879  break;
880  } elseif ($this->access->checkAccess('read', '', $ref_id)) {
881  $exists = true;
882  }
883  }
884  if (!$exists && $check_permissions) {
885  continue;
886  }
887  $this->categories_info[(int) $row->cat_id]['editable'] = $editable;
888  $this->categories_info[(int) $row->cat_id]['accepted'] = false;
889  $this->categories_info[(int) $row->cat_id]['settings'] = $settings;
890 
891  $this->categories[] = (int) $row->cat_id;
892  $this->categories_info[(int) $row->cat_id]['obj_type'] = ilObject::_lookupType((int) $row->obj_id);
893  $this->categories_info[(int) $row->cat_id]['obj_id'] = (int) $row->obj_id;
894  $this->categories_info[(int) $row->cat_id]['cat_id'] = (int) $row->cat_id;
895  $this->categories_info[(int) $row->cat_id]['color'] = $row->color;
896  #$this->categories_info[$row->cat_id]['title'] = ilObject::_lookupTitle($row->obj_id);
897  $this->categories_info[(int) $row->cat_id]['title'] = $row->title;
898  $this->categories_info[(int) $row->cat_id]['type'] = (int) $row->type;
899  $this->categories_info[(int) $row->cat_id]['remote'] = false;
900  $this->categories_info[(int) $row->cat_id]['source_ref_id'] = $a_source_ref_id;
901  }
902  }
$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 474 of file class.ilCalendarCategories.php.

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

Referenced by initialize().

474  : void
475  {
476  $this->readPublicCalendars();
477  $this->readPrivateCalendars();
479  $this->readBookingCalendar();
480 
481  $obj_ids = array();
482 
483  $courses = array();
484  $groups = array();
485  $sessions = array();
486  $exercises = array();
487  foreach ($this->fav_rep->getFavouritesOfUser(
488  $this->user->getId(),
489  array('crs', 'grp', 'sess', 'exc')
490  ) as $item) {
491  if ($this->access->checkAccess('read', '', $item['ref_id'])) {
492  switch ($item['type']) {
493  case 'crs':
494  $courses[] = $item['obj_id'];
495  break;
496 
497  case 'sess':
498  $sessions[] = $item['obj_id'];
499  break;
500 
501  case 'grp':
502  $groups[] = $item['obj_id'];
503  break;
504 
505  case 'exc':
506  $exercises[] = $item['obj_id'];
507  break;
508  }
509  }
510  }
511  $this->readSelectedCategories($courses);
512  $this->readSelectedCategories($sessions);
513  $this->readSelectedCategories($groups);
514  $this->readSelectedCategories($exercises);
515  $this->readSelectedCategories(
517  0,
518  false
519  );
520 
521  $this->addSubitemCalendars();
522  }
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 591 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().

591  : void
592  {
593  $cat = new ilCalendarCategory($a_cat_id);
594  switch ($cat->getType()) {
596  $this->readSelectedCalendar($a_cat_id);
597  break;
598 
600  $this->readPublicCalendars(array($a_cat_id));
601  break;
602 
604  $this->readPrivateCalendars(array($a_cat_id));
605  break;
606 
608  $this->readConsultationHoursCalendar($this->root_ref_id, $a_cat_id);
609  break;
610 
612  $this->readBookingCalendar();
613  break;
614  }
615  }
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.

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  }
+ 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: