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))
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 $GLOBALS[
'ilLog']->write(__METHOD__.
': Calendar info:' . print_r($info,
true));
267 $GLOBALS[
'ilLog']->write(__METHOD__.
': Current user:' . $a_user_id);
268 if(!$info[
'writable'])
273 switch($info[
'obj_type'])
276 if($info[
'obj_id'] == $a_user_id)
278 $GLOBALS[
'ilLog']->write(__METHOD__.
': Shared calendar is writable.');
283 case self::TYPE_ROLE:
284 if(
$GLOBALS[
'rbacreview']->isAssigned($a_user_id,$info[
'obj_id']))
286 $GLOBALS[
'ilLog']->write(__METHOD__.
': Shared calendar is writable.');
292 $GLOBALS[
'ilLog']->write(__METHOD__.
': Shared calendar is not writable.');
312 $query =
"INSERT INTO cal_shared (cal_id,obj_id,obj_type,create_date,writable) ".
315 $this->db->quote($a_obj_id ,
'integer').
", ".
316 $this->db->quote(
$a_type ,
'integer').
", ".
318 $this->db->quote((
int) $a_writable,
'integer').
' '.
342 $query =
"DELETE FROM cal_shared WHERE cal_id = ".$this->db->quote($this->
getCalendarId() ,
'integer').
" ".
343 "AND obj_id = ".$this->db->quote($a_obj_id ,
'integer').
" ";
346 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
364 $this->shared = $this->shared_users = $this->shared_roles =
array();
366 $query =
"SELECT * FROM cal_shared WHERE cal_id = ".$this->db->quote($this->
getCalendarId() ,
'integer');
370 switch(
$row->obj_type)
373 $this->shared_users[
$row->obj_id][
'obj_id'] =
$row->obj_id;
374 $this->shared_users[
$row->obj_id][
'obj_type'] =
$row->obj_type;
375 $this->shared_users[
$row->obj_id][
'create_date'] =
$row->create_date;
376 $this->shared_users[
$row->obj_id][
'writable'] =
$row->writable;
380 case self::TYPE_ROLE:
381 $this->shared_roles[
$row->obj_id][
'obj_id'] =
$row->obj_id;
382 $this->shared_roles[
$row->obj_id][
'obj_type'] =
$row->obj_type;
383 $this->shared_roles[
$row->obj_id][
'create_date'] =
$row->create_date;
384 $this->shared_role[
$row->obj_id][
'writable'] =
$row->writable;
389 $this->shared[
$row->obj_id][
'obj_id'] =
$row->obj_id;
390 $this->shared[
$row->obj_id][
'obj_type'] =
$row->obj_type;
391 $this->shared[
$row->obj_id][
'create_date'] =
$row->create_date;
392 $this->shared[
$row->obj_id][
'writable'] =
$row->writable;
isEditableForUser($a_user_id)
Check if calendar is editable for user.
static _isOwner($a_usr_id, $a_cal_id)
check if user is owner of a category
static deleteByCalendar($a_cal_id)
Delete all entries for a specific calendar id.
static getSharedCalendarsForUser($a_usr_id=0)
get shared calendars of user
share($a_obj_id, $a_type, $a_writable=false)
share calendar
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
__construct($a_calendar_id)
constructor
Handles shared calendars.
getCalendarId()
get calendar id
Create styles array
The data for the language used.
stopSharing($a_obj_id)
stop sharing
static deleteByUser($a_user_id)
Delete all entries for a specific user.
static deleteStatus($a_id, $a_calendar_id)
delete status
isShared($a_obj_id)
Check if calendar is already shared with specific user or role.
static isSharedWithUser($a_usr_id, $a_calendar_id)
is shared with user
read()
read shared calendars