59 $this->calendar_id = $a_calendar_id;
78 $query =
"DELETE FROM cal_shared WHERE cal_id = " .
$ilDB->quote($a_cal_id,
'integer') .
" ";
97 $query =
"DELETE FROM cal_shared WHERE obj_id = " .
$ilDB->quote($a_user_id,
'integer') .
" ";
117 $ilDB = $DIC[
'ilDB'];
118 $rbacreview = $DIC[
'rbacreview'];
120 $query =
'SELECT * FROM cal_shared ' .
121 "WHERE cal_id = " .
$ilDB->quote($a_calendar_id,
'integer') .
" ";
124 $obj_ids[
$row->obj_id] =
$row->obj_type;
126 $assigned_roles = $rbacreview->assignedRoles($a_usr_id);
127 foreach ($obj_ids as
$id =>
$type) {
130 if ($a_usr_id ==
$id) {
134 case self::TYPE_ROLE:
135 if (in_array(
$id, $assigned_roles)) {
156 $ilDB = $DIC[
'ilDB'];
158 $rbacreview = $DIC[
'rbacreview'];
164 $query =
"SELECT * FROM cal_shared " .
165 "WHERE obj_type = " .
$ilDB->quote(self::TYPE_USR,
'integer') .
" " .
166 "AND obj_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
167 "ORDER BY create_date";
169 $calendars = array();
171 $calendars[] =
$row->cal_id;
178 $assigned_roles = $rbacreview->assignedRoles(
$ilUser->getId());
180 $query =
"SELECT * FROM cal_shared " .
181 "WHERE obj_type = " .
$ilDB->quote(self::TYPE_ROLE,
'integer') .
" " .
182 "AND " .
$ilDB->in(
'obj_id', $assigned_roles,
false,
'integer');
186 if (in_array(
$row->cal_id, $calendars)) {
223 return $this->shared ? $this->shared : array();
234 return $this->shared_users ? $this->shared_users : array();
245 return $this->shared_roles ? $this->shared_roles : array();
257 return isset($this->shared[$a_obj_id]);
266 foreach ((array) $this->shared as
$info) {
267 if (!$info[
'writable']) {
271 switch ($info[
'obj_type']) {
273 if ($info[
'obj_id'] == $a_user_id) {
278 case self::TYPE_ROLE:
279 if (
$GLOBALS[
'DIC'][
'rbacreview']->isAssigned($a_user_id, $info[
'obj_id'])) {
300 $ilDB = $DIC[
'ilDB'];
305 $query =
"INSERT INTO cal_shared (cal_id,obj_id,obj_type,create_date,writable) " .
308 $this->db->quote($a_obj_id,
'integer') .
", " .
309 $this->db->quote(
$a_type,
'integer') .
", " .
310 $ilDB->now() .
", " .
311 $this->db->quote((
int) $a_writable,
'integer') .
' ' .
331 $ilDB = $DIC[
'ilDB'];
336 $query =
"DELETE FROM cal_shared WHERE cal_id = " . $this->db->quote($this->
getCalendarId(),
'integer') .
" " .
337 "AND obj_id = " . $this->db->quote($a_obj_id,
'integer') .
" ";
340 include_once(
'./Services/Calendar/classes/class.ilCalendarSharedStatus.php');
358 $ilDB = $DIC[
'ilDB'];
360 $this->shared = $this->shared_users = $this->shared_roles = array();
362 $query =
"SELECT * FROM cal_shared WHERE cal_id = " . $this->db->quote($this->
getCalendarId(),
'integer');
365 switch (
$row->obj_type) {
367 $this->shared_users[
$row->obj_id][
'obj_id'] =
$row->obj_id;
368 $this->shared_users[
$row->obj_id][
'obj_type'] =
$row->obj_type;
369 $this->shared_users[
$row->obj_id][
'create_date'] =
$row->create_date;
370 $this->shared_users[
$row->obj_id][
'writable'] =
$row->writable;
374 case self::TYPE_ROLE:
375 $this->shared_roles[
$row->obj_id][
'obj_id'] =
$row->obj_id;
376 $this->shared_roles[
$row->obj_id][
'obj_type'] =
$row->obj_type;
377 $this->shared_roles[
$row->obj_id][
'create_date'] =
$row->create_date;
378 $this->shared_role[
$row->obj_id][
'writable'] =
$row->writable;
383 $this->shared[
$row->obj_id][
'obj_id'] =
$row->obj_id;
384 $this->shared[
$row->obj_id][
'obj_type'] =
$row->obj_type;
385 $this->shared[
$row->obj_id][
'create_date'] =
$row->create_date;
386 $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
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
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
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
read()
read shared calendars