ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.ilAppointmentBaseFileHandler.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
6
13{
14 protected array $appointment;
15
16 protected ilLogger $logger;
19 protected ilObjUser $user;
20
21 public function __construct(array $a_appointment)
22 {
23 global $DIC;
24
25 $this->access = $DIC->access();
26 $this->rbacsystem = $DIC->rbac()->system();
27 $this->user = $DIC->user();
28 $this->logger = $DIC->logger()->cal();
29 $this->appointment = $a_appointment;
30 }
31
32 public function getCatId(int $a_entry_id): int
33 {
35 }
36
40 public function getCatInfo(): array
41 {
42 $cat_id = $this->getCatId($this->appointment['event']->getEntryId());
43
45 $cat_info = array();
46 $cat_info["type"] = $cat->getType();
47 $cat_info["obj_id"] = $cat->getObjId();
48 $cat_info["title"] = $cat->getTitle();
49 $cat_info["cat_id"] = $cat_id;
50 $cat_info["editable"] = false;
51
52 switch ($cat_info["type"]) {
54 if ($cat_info["obj_id"] == $this->user->getId()) {
55 $cat_info["editable"] = true;
56 }
57 break;
58
60 $obj_type = ilObject::_lookupType($cat_info["obj_id"]);
61 if ($obj_type == 'crs' or $obj_type == 'grp') {
62 if (ilCalendarSettings::_getInstance()->lookupCalendarActivated($cat_info["obj_id"])) {
63 foreach (ilObject::_getAllReferences($cat_info["obj_id"]) as $ref_id) {
64 if ($this->access->checkAccess('edit_event', '', $ref_id)) {
65 $cat_info["editable"] = true;
66 }
67 }
68 }
69 }
70 break;
71
73 if ($this->rbacsystem->checkAccess(
74 'edit_event',
75 ilCalendarSettings::_getInstance()->getCalendarSettingsId()
76 )) {
77 $cat_info["editable"] = true;
78 }
79 break;
80 }
81 return $cat_info;
82 }
83}
Base file handler class for appointment classes.
static getInstanceByCategoryId(int $a_cat_id)
Component logger with individual log levels by component id.
User class.
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67