ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarSharedStatus Class Reference

Stores status (accepted/declined) of shared calendars. More...

+ Collaboration diagram for ilCalendarSharedStatus:

Public Member Functions

 __construct ($a_usr_id)
 Constructor.
 isAccepted ($a_cal_id)
 is accepted
 isDeclined ($a_cal_id)
 is declined
 getAcceptedCalendars ($a_usr_id)
 get accepted shared calendars
 accept ($a_calendar_id)
 accept calendar
 decline ($a_calendar_id)
 decline calendar

Static Public Member Functions

static hasStatus ($a_usr_id, $a_calendar_id)
 check if a status is set for an calendar
static deleteUser ($a_usr_id)
 Delete by user.
static deleteCalendar ($a_calendar_id)
 Delete calendar.
static deleteStatus ($a_id, $a_calendar_id)
 delete status

Data Fields

const STATUS_ACCEPTED = 1
const STATUS_DECLINED = 2
const STATUS_DELETED = 3

Protected Member Functions

 read ()
 read

Protected Attributes

 $db = null

Private Attributes

 $usr_id = 0
 $calendars = array()

Detailed Description

Stores status (accepted/declined) of shared calendars.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 32 of file class.ilCalendarSharedStatus.php.

Constructor & Destructor Documentation

ilCalendarSharedStatus::__construct (   $a_usr_id)

Constructor.

public

Parameters
@return

Definition at line 52 of file class.ilCalendarSharedStatus.php.

References read().

{
global $ilDB;
$this->usr_id = $a_usr_id;
$this->db = $ilDB;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilCalendarSharedStatus::accept (   $a_calendar_id)

accept calendar

public

Parameters
intcalendar id
Returns

Definition at line 214 of file class.ilCalendarSharedStatus.php.

References deleteStatus(), and STATUS_ACCEPTED.

{
self::deleteStatus($this->usr_id,$a_calendar_id);
$query = "INSERT INTO cal_shared_status ".
"SET cal_id = ".$this->db->quote($a_calendar_id).", ".
"usr_id = ".$this->db->quote($this->usr_id).", ".
"status = ".$this->db->quote(self::STATUS_ACCEPTED)." ";
$this->db->query($query);
$this->calendars[$a_calendar_id] = self::STATUS_ACCEPTED;
return true;
}

+ Here is the call graph for this function:

ilCalendarSharedStatus::decline (   $a_calendar_id)

decline calendar

public

Parameters
intcalendar id
Returns

Definition at line 236 of file class.ilCalendarSharedStatus.php.

References deleteStatus(), and STATUS_DECLINED.

{
self::deleteStatus($this->usr_id,$a_calendar_id);
$query = "INSERT INTO cal_shared_status ".
"SET cal_id = ".$this->db->quote($a_calendar_id).", ".
"usr_id = ".$this->db->quote($this->usr_id).", ".
"status = ".$this->db->quote(self::STATUS_DECLINED)." ";
$this->db->query($query);
$this->calendars[$a_calendar_id] = self::STATUS_DECLINED;
return true;
}

+ Here is the call graph for this function:

static ilCalendarSharedStatus::deleteCalendar (   $a_calendar_id)
static

Delete calendar.

public

Parameters
intcalendar id
Returns
bool

Definition at line 154 of file class.ilCalendarSharedStatus.php.

{
global $ilDB;
$query = "DELETE FROM cal_shared_status ".
"WHERE cal_id = ".$ilDB->quote($a_calendar_id)." ";
$ilDB->query($query);
return true;
}
static ilCalendarSharedStatus::deleteStatus (   $a_id,
  $a_calendar_id 
)
static

delete status

public

Parameters
intusr_id or role_id
intcalendar_id
Returns

Definition at line 173 of file class.ilCalendarSharedStatus.php.

References ilObject\_lookupType(), and ilUtil\quoteArray().

Referenced by accept(), decline(), and ilCalendarShared\stopSharing().

{
global $ilDB,$rbacreview;
if(ilObject::_lookupType($a_id) == 'usr')
{
$query = "DELETE FROM cal_shared_status ".
"WHERE cal_id = ".$ilDB->quote($a_calendar_id)." ".
"AND usr_id = ".$ilDB->quote($a_id)." ";
$ilDB->query($query);
}
elseif(ilObject::_lookupType($a_id) == 'role')
{
$assigned_users = $rbacreview->assignedUsers($a_id);
if(!count($assigned_users))
{
return true;
}
$query = "DELETE FROM cal_shared_status ".
"WHERE cal_id = ".$ilDB->quote($a_calendar_id)." ".
"AND usr_id IN (".implode(',',ilUtil::quoteArray($assigned_users)).") ";
$ilDB->query($query);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCalendarSharedStatus::deleteUser (   $a_usr_id)
static

Delete by user.

public

Parameters
intusr_id
Returns
bool

Definition at line 136 of file class.ilCalendarSharedStatus.php.

{
global $ilUser;
$query = "DELETE FROM cal_shared_status ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id)." ";
$ilDB->query($query);
return true;
}
ilCalendarSharedStatus::getAcceptedCalendars (   $a_usr_id)

get accepted shared calendars

public

Parameters
intusr_id
Returns
array int array of calendar ids

Definition at line 93 of file class.ilCalendarSharedStatus.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilCalendarCategories\readPrivateCalendars().

{
global $ilDB;
$query = "SELECT cal_id FROM cal_shared_status ".
"WHERE status = ".$ilDB->quote(self::STATUS_ACCEPTED)." ".
"AND usr_id = ".$ilDB->quote($a_usr_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$cal_ids[] = $row->cal_id;
}
return $cal_ids ? $cal_ids : array();
}

+ Here is the caller graph for this function:

static ilCalendarSharedStatus::hasStatus (   $a_usr_id,
  $a_calendar_id 
)
static

check if a status is set for an calendar

public

Parameters
intusr_id
intcalendar id
Returns
bool

Definition at line 117 of file class.ilCalendarSharedStatus.php.

References $res.

{
global $ilDB;
$query = "SELECT * FROM cal_shared_status ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id)." ".
"AND cal_id = ".$ilDB->quote($a_calendar_id)." ";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}
ilCalendarSharedStatus::isAccepted (   $a_cal_id)

is accepted

public

Parameters
intcal_id
Returns

Definition at line 69 of file class.ilCalendarSharedStatus.php.

References STATUS_ACCEPTED.

{
return isset($this->calendars[$a_cal_id]) and $this->calendars[$a_cal_id] == self::STATUS_ACCEPTED;
}
ilCalendarSharedStatus::isDeclined (   $a_cal_id)

is declined

public

Parameters
intcal_id
Returns

Definition at line 81 of file class.ilCalendarSharedStatus.php.

References STATUS_DECLINED.

{
return isset($this->calendars[$a_cal_id]) and $this->calendars[$a_cal_id] == self::STATUS_DECLINED;
}
ilCalendarSharedStatus::read ( )
protected

read

protected

Returns

Definition at line 258 of file class.ilCalendarSharedStatus.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by __construct().

{
$query = "SELECT * FROM cal_shared_status ".
"WHERE usr_id = ".$this->db->quote($this->usr_id)." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->calendars[$row->cal_id] = $row->status;
}
}

+ Here is the caller graph for this function:

Field Documentation

ilCalendarSharedStatus::$calendars = array()
private

Definition at line 42 of file class.ilCalendarSharedStatus.php.

ilCalendarSharedStatus::$db = null
protected

Definition at line 38 of file class.ilCalendarSharedStatus.php.

ilCalendarSharedStatus::$usr_id = 0
private

Definition at line 40 of file class.ilCalendarSharedStatus.php.

const ilCalendarSharedStatus::STATUS_ACCEPTED = 1

Definition at line 34 of file class.ilCalendarSharedStatus.php.

Referenced by accept(), and isAccepted().

const ilCalendarSharedStatus::STATUS_DECLINED = 2

Definition at line 35 of file class.ilCalendarSharedStatus.php.

Referenced by decline(), and isDeclined().

const ilCalendarSharedStatus::STATUS_DELETED = 3

Definition at line 36 of file class.ilCalendarSharedStatus.php.


The documentation for this class was generated from the following file: