57 $this->calendar_id = $a_calendar_id;
74 $query =
"DELETE FROM cal_shared WHERE cal_id ".$ilDB->quote($a_cal_id).
" ";
91 $query =
"DELETE FROM cal_shared WHERE obj_id = ".$ilDB->quote($a_usr_id).
" ";
109 global $ilDB,$rbacreview;
111 $query =
'SELECT * FROM cal_shared '.
112 "WHERE cal_id = ".$ilDB->quote($a_calendar_id).
" ";
113 $res = $ilDB->query($query);
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).
" ".
159 "AND obj_id = ".$ilDB->quote($a_usr_id).
" ".
160 "ORDER BY create_date";
161 $res = $ilDB->query($query);
162 $calendars = array();
165 $calendars[] = $row->cal_id;
167 $shared[$row->cal_id][
'cal_id'] = $row->cal_id;
168 $shared[$row->cal_id][
'create_date'] = $row->create_date;
169 $shared[$row->cal_id][
'obj_type'] = $row->obj_type;
172 $assigned_roles = $rbacreview->assignedRoles($ilUser->getId());
174 $query =
"SELECT * FROM cal_shared ".
175 "WHERE obj_type = ".$ilDB->quote(self::TYPE_ROLE).
" ".
178 $res = $ilDB->query($query);
181 if(in_array($row->cal_id,$calendars))
190 $shared[$row->cal_id][
'cal_id'] = $row->cal_id;
191 $shared[$row->cal_id][
'create_date'] = $row->create_date;
192 $shared[$row->cal_id][
'obj_type'] = $row->obj_type;
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)
272 $query =
"INSERT INTO cal_shared ".
273 "SET cal_id = ".$this->db->quote($this->
getCalendarId()).
", ".
274 "obj_id = ".$this->db->quote($a_obj_id).
", ".
275 "obj_type = ".$this->db->quote($a_type).
", ".
276 "create_date = NOW()";
277 $this->db->query($query);
296 $query =
"DELETE FROM cal_shared WHERE cal_id = ".$this->db->quote($this->
getCalendarId()).
" ".
297 "AND obj_id = ".$this->db->quote($a_obj_id).
" ";
298 $this->db->query($query);
300 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
316 $this->shared = $this->shared_users = $this->shared_roles = array();
318 $query =
"SELECT * FROM cal_shared WHERE cal_id = ".$this->db->quote($this->
getCalendarId());
319 $res = $this->db->query($query);
322 switch($row->obj_type)
325 $this->shared_users[$row->obj_id][
'obj_id'] = $row->obj_id;
326 $this->shared_users[$row->obj_id][
'obj_type'] = $row->obj_type;
327 $this->shared_users[$row->obj_id][
'create_date'] = $row->create_date;
331 case self::TYPE_ROLE:
332 $this->shared_roles[$row->obj_id][
'obj_id'] = $row->obj_id;
333 $this->shared_roles[$row->obj_id][
'obj_type'] = $row->obj_type;
334 $this->shared_roles[$row->obj_id][
'create_date'] = $row->create_date;
339 $this->shared[$row->obj_id][
'obj_id'] = $row->obj_id;
340 $this->shared[$row->obj_id][
'obj_type'] = $row->obj_type;
341 $this->shared[$row->obj_id][
'create_date'] = $row->create_date;