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) {
 
  126                    if (in_array(
$id, $assigned_roles)) {
 
  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]);
 
  253        foreach ((array) $this->shared as 
$info) {
 
  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.');
 
  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;
 
  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;
 
An exception for terminatinating execution or to throw for unit testing.
static _isOwner($a_usr_id, $a_cal_id)
check if user is owner of a category
static deleteStatus($a_id, $a_calendar_id)
delete status
Handles shared calendars.
static isSharedWithUser($a_usr_id, $a_calendar_id)
is shared with user
static getSharedCalendarsForUser($a_usr_id=0)
get shared calendars of user
static deleteByUser($a_user_id)
Delete all entries for a specific user.
isShared($a_obj_id)
Check if calendar is already shared with specific user or role.
isEditableForUser($a_user_id)
Check if calendar is editable for user.
__construct($a_calendar_id)
constructor
read()
read shared calendars
static deleteByCalendar($a_cal_id)
Delete all entries for a specific calendar id.
stopSharing($a_obj_id)
stop sharing
share($a_obj_id, $a_type, $a_writable=false)
share calendar
getCalendarId()
get calendar id
if(!array_key_exists('StateId', $_REQUEST)) $id
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res