57 $this->calendar_id = $a_calendar_id;
74 $query =
"DELETE FROM cal_shared WHERE cal_id = ".$ilDB->quote($a_cal_id ,
'integer').
" ";
91 $query =
"DELETE FROM cal_shared WHERE obj_id = ".$ilDB->quote($a_user_id ,
'integer').
" ";
109 global
$ilDB,$rbacreview;
111 $query =
'SELECT * FROM cal_shared '.
112 "WHERE cal_id = ".$ilDB->quote($a_calendar_id ,
'integer').
" ";
116 $obj_ids[
$row->obj_id] =
$row->obj_type;
118 $assigned_roles = $rbacreview->assignedRoles($a_usr_id);
119 foreach($obj_ids as $id =>
$type)
129 case self::TYPE_ROLE:
130 if(in_array($id,$assigned_roles))
150 global
$ilDB,$ilUser,$rbacreview;
154 $a_usr_id = $ilUser->getId();
157 $query =
"SELECT * FROM cal_shared ".
158 "WHERE obj_type = ".$ilDB->quote(self::TYPE_USR ,
'integer').
" ".
159 "AND obj_id = ".$ilDB->quote($a_usr_id ,
'integer').
" ".
160 "ORDER BY create_date";
162 $calendars = array();
165 $calendars[] =
$row->cal_id;
172 $assigned_roles = $rbacreview->assignedRoles($ilUser->getId());
174 $query =
"SELECT * FROM cal_shared ".
175 "WHERE obj_type = ".$ilDB->quote(self::TYPE_ROLE ,
'integer').
" ".
176 "AND ".$ilDB->in(
'obj_id',$assigned_roles,
false ,
'integer');
181 if(in_array(
$row->cal_id,$calendars))
221 return $this->shared ? $this->shared : array();
232 return $this->shared_users ? $this->shared_users : array();
243 return $this->shared_roles ? $this->shared_roles : array();
255 return isset($this->shared[$a_obj_id]);
266 public function share($a_obj_id,$a_type)
274 $query =
"INSERT INTO cal_shared (cal_id,obj_id,obj_type,create_date) ".
277 $this->db->quote($a_obj_id ,
'integer').
", ".
278 $this->db->quote($a_type ,
'integer').
", ".
302 $query =
"DELETE FROM cal_shared WHERE cal_id = ".$this->db->quote($this->
getCalendarId() ,
'integer').
" ".
303 "AND obj_id = ".$this->db->quote($a_obj_id ,
'integer').
" ";
306 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
324 $this->shared = $this->shared_users = $this->shared_roles = array();
326 $query =
"SELECT * FROM cal_shared WHERE cal_id = ".$this->db->quote($this->
getCalendarId() ,
'integer');
330 switch(
$row->obj_type)
333 $this->shared_users[
$row->obj_id][
'obj_id'] =
$row->obj_id;
334 $this->shared_users[
$row->obj_id][
'obj_type'] =
$row->obj_type;
335 $this->shared_users[
$row->obj_id][
'create_date'] =
$row->create_date;
339 case self::TYPE_ROLE:
340 $this->shared_roles[
$row->obj_id][
'obj_id'] =
$row->obj_id;
341 $this->shared_roles[
$row->obj_id][
'obj_type'] =
$row->obj_type;
342 $this->shared_roles[
$row->obj_id][
'create_date'] =
$row->create_date;
347 $this->shared[
$row->obj_id][
'obj_id'] =
$row->obj_id;
348 $this->shared[
$row->obj_id][
'obj_type'] =
$row->obj_type;
349 $this->shared[
$row->obj_id][
'create_date'] =
$row->create_date;