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') .
" ";
115 $obj_ids[
$row->obj_id] =
$row->obj_type;
117 $assigned_roles = $rbacreview->assignedRoles($a_usr_id);
118 foreach ($obj_ids as
$id =>
$type) {
121 if ($a_usr_id ==
$id) {
125 case self::TYPE_ROLE:
126 if (in_array(
$id, $assigned_roles)) {
148 $a_usr_id = $ilUser->getId();
151 $query =
"SELECT * FROM cal_shared " .
152 "WHERE obj_type = " . $ilDB->quote(self::TYPE_USR,
'integer') .
" " .
153 "AND obj_id = " . $ilDB->quote($a_usr_id,
'integer') .
" " .
154 "ORDER BY create_date";
156 $calendars =
array();
158 $calendars[] =
$row->cal_id;
165 $assigned_roles = $rbacreview->assignedRoles($ilUser->getId());
167 $query =
"SELECT * FROM cal_shared " .
168 "WHERE obj_type = " . $ilDB->quote(self::TYPE_ROLE,
'integer') .
" " .
169 "AND " . $ilDB->in(
'obj_id', $assigned_roles,
false,
'integer');
173 if (in_array(
$row->cal_id, $calendars)) {
210 return $this->shared ? $this->shared :
array();
221 return $this->shared_users ? $this->shared_users :
array();
232 return $this->shared_roles ? $this->shared_roles :
array();
244 return isset($this->shared[$a_obj_id]);
254 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Calendar info:' . print_r($info,
true));
255 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Current user:' . $a_user_id);
256 if (!$info[
'writable']) {
260 switch ($info[
'obj_type']) {
262 if ($info[
'obj_id'] == $a_user_id) {
263 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Shared calendar is writable.');
268 case self::TYPE_ROLE:
269 if (
$GLOBALS[
'rbacreview']->isAssigned($a_user_id, $info[
'obj_id'])) {
270 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Shared calendar is writable.');
276 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Shared calendar is not writable.');
295 $query =
"INSERT INTO cal_shared (cal_id,obj_id,obj_type,create_date,writable) " .
298 $this->db->quote($a_obj_id,
'integer') .
", " .
299 $this->db->quote(
$a_type,
'integer') .
", " .
300 $ilDB->now() .
", " .
301 $this->db->quote((
int) $a_writable,
'integer') .
' ' .
324 $query =
"DELETE FROM cal_shared WHERE cal_id = " . $this->db->quote($this->
getCalendarId(),
'integer') .
" " .
325 "AND obj_id = " . $this->db->quote($a_obj_id,
'integer') .
" ";
328 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
346 $this->shared = $this->shared_users = $this->shared_roles =
array();
348 $query =
"SELECT * FROM cal_shared WHERE cal_id = " . $this->db->quote($this->
getCalendarId(),
'integer');
351 switch (
$row->obj_type) {
353 $this->shared_users[
$row->obj_id][
'obj_id'] =
$row->obj_id;
354 $this->shared_users[
$row->obj_id][
'obj_type'] =
$row->obj_type;
355 $this->shared_users[
$row->obj_id][
'create_date'] =
$row->create_date;
356 $this->shared_users[
$row->obj_id][
'writable'] =
$row->writable;
360 case self::TYPE_ROLE:
361 $this->shared_roles[
$row->obj_id][
'obj_id'] =
$row->obj_id;
362 $this->shared_roles[
$row->obj_id][
'obj_type'] =
$row->obj_type;
363 $this->shared_roles[
$row->obj_id][
'create_date'] =
$row->create_date;
364 $this->shared_role[
$row->obj_id][
'writable'] =
$row->writable;
369 $this->shared[
$row->obj_id][
'obj_id'] =
$row->obj_id;
370 $this->shared[
$row->obj_id][
'obj_type'] =
$row->obj_type;
371 $this->shared[
$row->obj_id][
'create_date'] =
$row->create_date;
372 $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.
if(!array_key_exists('StateId', $_REQUEST)) $id
__construct($a_calendar_id)
constructor
Handles shared calendars.
getCalendarId()
get calendar id
foreach($_POST as $key=> $value) $res
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