ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarRegistration Class Reference

registration for calendar appointments More...

+ Collaboration diagram for ilCalendarRegistration:

Public Member Functions

 __construct ($a_appointment_id)
 Constructor.
 getAppointmentId ()
 Get appoinmtent id.
 getRegisteredUsers ()
 Get all registered users.
 isRegistered ($a_usr_id, ilDateTime $start, ilDateTime $end)
 Check if one user is registered.
 register ($a_usr_id, ilDateTime $start, ilDateTime $end)
 Register one user.
 unregister ($a_usr_id, ilDateTime $start, ilDateTime $end)
 unregister one user

Static Public Member Functions

static deleteByUser ($a_usr_id)
 Delete all user registrations.
static deleteByAppointment ($a_cal_id)

Protected Member Functions

 read ()
 Read registration.

Private Attributes

 $appointment_id = 0
 $registered = array()

Detailed Description

registration for calendar appointments

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 13 of file class.ilCalendarRegistration.php.

Constructor & Destructor Documentation

ilCalendarRegistration::__construct (   $a_appointment_id)

Constructor.

Returns

Definition at line 23 of file class.ilCalendarRegistration.php.

References read().

{
$this->appointment_id = $a_appointment_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCalendarRegistration::deleteByAppointment (   $a_cal_id)
static

Definition at line 44 of file class.ilCalendarRegistration.php.

References $ilDB, and $query.

{
global $ilDB;
$query = "DELETE FROM cal_registrations ".
"WHERE cal_id = ".$ilDB->quote($a_cal_id,'integer');
$ilDB->manipulate($query);
}
static ilCalendarRegistration::deleteByUser (   $a_usr_id)
static

Delete all user registrations.

Parameters
object$a_usr_id
Returns

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

References $ilDB, and $query.

{
global $ilDB;
$query = "DELETE FROM cal_registrations ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id,'integer');
$ilDB->manipulate($query);
}
ilCalendarRegistration::getAppointmentId ( )

Get appoinmtent id.

Returns
int app_id

Definition at line 57 of file class.ilCalendarRegistration.php.

References $appointment_id.

Referenced by read(), register(), and unregister().

{
}

+ Here is the caller graph for this function:

ilCalendarRegistration::getRegisteredUsers ( )

Get all registered users.

Returns

Definition at line 66 of file class.ilCalendarRegistration.php.

References $registered, and IL_CAL_UNIX.

{
foreach($this->registered as $reg_data)
{
if($reg_data['usr_id'] == $a_usr_id)
{
if($reg_data['dstart'] == $start->get(IL_CAL_UNIX) and $reg_data['dend'] == $end->get(IL_CAL_UNIX))
{
return true;
}
}
}
return (array) $this->registered;
}
ilCalendarRegistration::isRegistered (   $a_usr_id,
ilDateTime  $start,
ilDateTime  $end 
)

Check if one user is registered.

Parameters
object$a_usr_id
Returns
bool

Definition at line 86 of file class.ilCalendarRegistration.php.

References ilDateTime\get(), and IL_CAL_UNIX.

{
foreach($this->registered as $reg_data)
{
if($reg_data['usr_id'] == $a_usr_id)
{
if($reg_data['dstart'] == $start->get(IL_CAL_UNIX) and $reg_data['dend'] == $end->get(IL_CAL_UNIX))
{
return true;
}
}
}
}

+ Here is the call graph for this function:

ilCalendarRegistration::read ( )
protected

Read registration.

Returns

Definition at line 146 of file class.ilCalendarRegistration.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and getAppointmentId().

Referenced by __construct().

{
global $ilDB;
if(!$this->getAppointmentId())
{
return false;
}
$query = "SELECT * FROM cal_registrations WHERE cal_id = ".$ilDB->quote($this->getAppointmentId(),'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->registered[] = array(
'usr_id'=> $row->usr_id,
'dstart' =>$row->dstart,
'dend' => $row->dend
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarRegistration::register (   $a_usr_id,
ilDateTime  $start,
ilDateTime  $end 
)

Register one user.

Parameters
int$a_usr_id
Returns

Definition at line 105 of file class.ilCalendarRegistration.php.

References $ilDB, $query, getAppointmentId(), IL_CAL_UNIX, and unregister().

{
global $ilDB;
$this->unregister($a_usr_id,$start,$end);
$query = "INSERT INTO cal_registrations (cal_id,usr_id,dstart,dend) ".
"VALUES ( ".
$ilDB->quote($this->getAppointmentId(),'integer').", ".
$ilDB->quote($a_usr_id,'integer').", ".
$ilDB->quote($start->get(IL_CAL_UNIX),'integer').", ".
$ilDB->quote($end->get(IL_CAL_UNIX),'integer').
")";
$ilDB->manipulate($query);
$this->registered[] = $a_usr_id;
return true;
}

+ Here is the call graph for this function:

ilCalendarRegistration::unregister (   $a_usr_id,
ilDateTime  $start,
ilDateTime  $end 
)

unregister one user

Parameters
int$a_usr_id
Returns

Definition at line 129 of file class.ilCalendarRegistration.php.

References $ilDB, $query, $res, ilDateTime\get(), getAppointmentId(), and IL_CAL_UNIX.

Referenced by register().

{
global $ilDB;
$query = "DELETE FROM cal_registrations ".
"WHERE cal_id = ".$ilDB->quote($this->getAppointmentId(),'integer').' '.
"AND usr_id = ".$ilDB->quote($a_usr_id,'integer').' '.
"AND dstart = ".$ilDB->quote($start->get(IL_CAL_UNIX),'integer').' '.
"AND dend = ".$ilDB->quote($end->get(IL_CAL_UNIX),'integer');
$res = $ilDB->manipulate($query);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilCalendarRegistration::$appointment_id = 0
private

Definition at line 15 of file class.ilCalendarRegistration.php.

Referenced by getAppointmentId().

ilCalendarRegistration::$registered = array()
private

Definition at line 17 of file class.ilCalendarRegistration.php.

Referenced by getRegisteredUsers().


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