ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilAppointmentBaseFileHandler.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
28  protected array $appointment;
29 
30  protected ilLogger $logger;
33  protected ilObjUser $user;
34 
35  public function __construct(array $a_appointment)
36  {
37  global $DIC;
38 
39  $this->access = $DIC->access();
40  $this->rbacsystem = $DIC->rbac()->system();
41  $this->user = $DIC->user();
42  $this->logger = $DIC->logger()->cal();
43  $this->appointment = $a_appointment;
44  }
45 
46  public function getCatId(int $a_entry_id): int
47  {
49  }
50 
54  public function getCatInfo(): array
55  {
56  $cat_id = $this->getCatId($this->appointment['event']->getEntryId());
57 
59  $cat_info = array();
60  $cat_info["type"] = $cat->getType();
61  $cat_info["obj_id"] = $cat->getObjId();
62  $cat_info["title"] = $cat->getTitle();
63  $cat_info["cat_id"] = $cat_id;
64  $cat_info["editable"] = false;
65 
66  switch ($cat_info["type"]) {
68  if ($cat_info["obj_id"] == $this->user->getId()) {
69  $cat_info["editable"] = true;
70  }
71  break;
72 
74  $obj_type = ilObject::_lookupType($cat_info["obj_id"]);
75  if ($obj_type == 'crs' or $obj_type == 'grp') {
76  if (ilCalendarSettings::_getInstance()->lookupCalendarActivated($cat_info["obj_id"])) {
77  foreach (ilObject::_getAllReferences($cat_info["obj_id"]) as $ref_id) {
78  if ($this->access->checkAccess('edit_event', '', $ref_id)) {
79  $cat_info["editable"] = true;
80  }
81  }
82  }
83  }
84  break;
85 
87  if ($this->rbacsystem->checkAccess(
88  'edit_event',
89  ilCalendarSettings::_getInstance()->getCalendarSettingsId()
90  )) {
91  $cat_info["editable"] = true;
92  }
93  break;
94  }
95  return $cat_info;
96  }
97 }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:26
static getInstanceByCategoryId(int $a_cat_id)
Base file handler class for appointment classes.
static _lookupType(int $id, bool $reference=false)