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') . 
" ";
 
  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) {
 
  135                    if (in_array($id, $assigned_roles)) {
 
  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;
 
  173            $shared[$row->cal_id][
'cal_id'] = $row->cal_id;
 
  174            $shared[$row->cal_id][
'create_date'] = $row->create_date;
 
  175            $shared[$row->cal_id][
'obj_type'] = $row->obj_type;
 
  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)) {
 
  193            $shared[$row->cal_id][
'cal_id'] = $row->cal_id;
 
  194            $shared[$row->cal_id][
'create_date'] = $row->create_date;
 
  195            $shared[$row->cal_id][
'obj_type'] = $row->obj_type;
 
  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) {
 
  279                    if (
$GLOBALS[
'DIC'][
'rbacreview']->isAssigned($a_user_id, $info[
'obj_id'])) {
 
  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') . 
' ' .
 
  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');
 
  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;
 
  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;
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
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
foreach($_POST as $key=> $value) $res