ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
18  protected $logger;
19 
25  public function __construct($a_appointment)
26  {
27  global $DIC;
28 
29  $this->access = $DIC->access();
30  $this->rbacsystem = $DIC->rbac()->system();
31  $this->user = $DIC->user();
32  $this->logger = $DIC->logger()->cal();
33  $this->appointment = $a_appointment;
34  }
35 
36 
41  public static function getInstance($a_appointment)
42  {
43  return new static($a_appointment);
44  }
45 
46  public function getCatId($a_entry_id)
47  {
49  }
50 
51  public function getCatInfo()
52  {
53  $cat_id = $this->getCatId($this->appointment['event']->getEntryId());
54 
56  $cat_info = array();
57  $cat_info["type"] = $cat->getType();
58  $cat_info["obj_id"] = $cat->getObjId();
59  $cat_info["title"] = $cat->getTitle();
60  $cat_info["cat_id"] = $cat_id;
61  $cat_info["editable"] = false;
62 
63  switch ($cat_info["type"]) {
65  if ($cat_info["obj_id"] == $this->user->getId()) {
66  $cat_info["editable"] = true;
67  }
68  break;
69 
71  $obj_type = ilObject::_lookupType($cat_info["obj_id"]);
72  if ($obj_type == 'crs' or $obj_type == 'grp') {
73  if (ilCalendarSettings::_getInstance()->lookupCalendarActivated($cat_info["obj_id"])) {
74  foreach (ilObject::_getAllReferences($cat_info["obj_id"]) as $ref_id) {
75  if ($this->access->checkAccess('edit_event', '', $ref_id)) {
76  $cat_info["editable"] = true;
77  }
78  }
79  }
80  }
81  break;
82 
84  if ($this->rbacsystem->checkAccess('edit_event', ilCalendarSettings::_getInstance()->getCalendarSettingsId())) {
85  $cat_info["editable"] = true;
86  }
87  break;
88  }
89 
90  return $cat_info;
91  }
92 }
static _lookupCategory($a_cal_id)
Lookup category id.
static _getInstance()
get singleton instance
static getInstance($a_appointment)
Get instance.
user()
Definition: user.php:4
static _getAllReferences($a_id)
get all reference ids of object
global $DIC
Definition: goto.php:24
static getInstanceByCategoryId($a_cat_id)
Get instance by category id.
static _lookupType($a_id, $a_reference=false)
lookup object type
Base file handler class for appointment classes.