ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAppointmentBaseFileHandler.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
13 protected $appointment;
14
20 public function __construct($a_appointment)
21 {
22 global $DIC;
23
24 $this->access = $DIC->access();
25 $this->rbacsystem = $DIC->rbac()->system();
26 $this->user = $DIC->user();
27
28 $this->appointment = $a_appointment;
29 }
30
31
36 public static function getInstance($a_appointment)
37 {
38 return new static($a_appointment);
39 }
40
41 public function getCatId($a_entry_id)
42 {
44 }
45
46 public function getCatInfo()
47 {
48 $cat_id = $this->getCatId($this->appointment['event']->getEntryId());
49
51 $cat_info = array();
52 $cat_info["type"] = $cat->getType();
53 $cat_info["obj_id"] = $cat->getObjId();
54 $cat_info["title"] = $cat->getTitle();
55 $cat_info["cat_id"] = $cat_id;
56 $cat_info["editable"] = false;
57
58 switch ($cat_info["type"]) {
60 if ($cat_info["obj_id"] == $this->user->getId()) {
61 $cat_info["editable"] = true;
62 }
63 break;
64
66 $obj_type = ilObject::_lookupType($cat_info["obj_id"]);
67 if ($obj_type == 'crs' or $obj_type == 'grp') {
68 if (ilCalendarSettings::_getInstance()->lookupCalendarActivated($cat_info["obj_id"])) {
69 foreach (ilObject::_getAllReferences($cat_info["obj_id"]) as $ref_id) {
70 if ($this->access->checkAccess('edit_event', '', $ref_id)) {
71 $cat_info["editable"] = true;
72 }
73 }
74 }
75 }
76 break;
77
79 if ($this->rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId())) {
80 $cat_info["editable"] = true;
81 }
82 break;
83 }
84
85 return $cat_info;
86 }
87}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
Base file handler class for appointment classes.
static getInstance($a_appointment)
Get instance.
static _lookupCategory($a_cal_id)
Lookup category id.
static getInstanceByCategoryId($a_cat_id)
Get instance by category id.
static _getInstance()
get singleton instance
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
global $DIC
Definition: saml.php:7