ILIAS  eassessment Revision 61809
 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 $ilDB, and 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 $ilDB, $query, $res, deleteStatus(), and STATUS_ACCEPTED.

{
global $ilDB;
self::deleteStatus($this->usr_id,$a_calendar_id);
$query = "INSERT INTO cal_shared_status (cal_id,usr_id,status) ".
"VALUES ( ".
$this->db->quote($a_calendar_id ,'integer').", ".
$this->db->quote($this->usr_id ,'integer').", ".
$this->db->quote(self::STATUS_ACCEPTED ,'integer')." ".
")";
$res = $ilDB->manipulate($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 240 of file class.ilCalendarSharedStatus.php.

References $ilDB, $query, $res, deleteStatus(), and STATUS_DECLINED.

{
global $ilDB;
self::deleteStatus($this->usr_id,$a_calendar_id);
$query = "INSERT INTO cal_shared_status (cal_id,usr_id,status) ".
"VALUES ( ".
$this->db->quote($a_calendar_id ,'integer').", ".
$this->db->quote($this->usr_id ,'integer').", ".
$this->db->quote(self::STATUS_DECLINED ,'integer')." ".
")";
$res = $ilDB->manipulate($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.

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "DELETE FROM cal_shared_status ".
"WHERE cal_id = ".$ilDB->quote($a_calendar_id ,'integer')." ";
$res = $ilDB->manipulate($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 $ilDB, $query, $res, and ilObject\_lookupType().

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 ,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_id ,'integer')." ";
$res = $ilDB->manipulate($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 ,'integer')." ".
"AND ".$ilDB->in('usr_id',$assigned_users,false,'integer');
$res = $ilDB->manipulate($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.

References $ilDB, $query, and $res.

{
global $ilUser,$ilDB;
$query = "DELETE FROM cal_shared_status ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ";
$res = $ilDB->manipulate($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 $ilDB, $query, $res, $row, 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 ,'integer')." ".
"AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ";
$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 $ilDB, $query, and $res.

{
global $ilDB;
$query = "SELECT * FROM cal_shared_status ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ".
"AND cal_id = ".$ilDB->quote($a_calendar_id ,'integer')." ";
$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 266 of file class.ilCalendarSharedStatus.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct().

{
global $ilDB;
$query = "SELECT * FROM cal_shared_status ".
"WHERE usr_id = ".$this->db->quote($this->usr_id ,'integer')." ";
$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: