ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSessionAppointment Class Reference

class ilSessionAppointment More...

+ Inheritance diagram for ilSessionAppointment:
+ Collaboration diagram for ilSessionAppointment:

Public Member Functions

 ilSessionAppointment ($a_appointment_id=null)
 isFullday ()
 is fullday
 getStart ()
 get start
 setStart ($a_start)
 set start
 getEnd ()
 get end
 setEnd ($a_end)
 set end
 setAppointmentId ($a_appointment_id)
 getAppointmentId ()
 setSessionId ($a_session_id)
 getSessionId ()
 setStartingTime ($a_starting_time)
 getStartingTime ()
 setEndingTime ($a_ending_time)
 getEndingTime ()
 toggleFullTime ($a_status)
 enabledFullTime ()
 formatTime ()
 _timeToString ($start, $end)
 appointmentToString ()
 cloneObject ($new_id)
 clone appointment
 create ()
 update ()
 delete ()
 _delete ($a_appointment_id)
 _deleteBySession ($a_event_id)
 _readAppointmentsBySession ($a_event_id)
 validate ()
 __read ()

Static Public Member Functions

static _lookupAppointment ($a_obj_id)
 lookup appointment
static lookupNextSessionByCourse ($a_ref_id)
 public
static lookupLastSessionByCourse ($a_ref_id)
 public
static _appointmentToString ($start, $end, $fulltime)

Data Fields

 $ilErr
 $ilDB
 $tree
 $lng
 $starting_time = null
 $ending_time = null

Protected Attributes

 $start = null
 $end = null

Detailed Description

class ilSessionAppointment

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

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

Member Function Documentation

ilSessionAppointment::__read ( )

Definition at line 424 of file class.ilSessionAppointment.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, getAppointmentId(), IL_CAL_DATETIME, isFullday(), setSessionId(), and toggleFullTime().

Referenced by ilSessionAppointment().

{
global $ilDB;
if(!$this->getAppointmentId())
{
return null;
}
$query = "SELECT * FROM event_appointment ".
"WHERE appointment_id = ".$ilDB->quote($this->getAppointmentId() ,'integer')." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setSessionId($row->event_id);
$this->toggleFullTime($row->fulltime);
if($this->isFullday())
{
$this->start = new ilDate($row->e_start,IL_CAL_DATETIME);
$this->end = new ilDate($row->e_end,IL_CAL_DATETIME);
}
else
{
$this->start = new ilDateTime($row->e_start,IL_CAL_DATETIME,'UTC');
$this->end = new ilDateTime($row->e_end,IL_CAL_DATETIME,'UTC');
}
$this->starting_time = $this->start->getUnixTime();
$this->ending_time = $this->end->getUnixTime();
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSessionAppointment::_appointmentToString (   $start,
  $end,
  $fulltime 
)
static

Definition at line 287 of file class.ilSessionAppointment.php.

References $end, $lng, $start, ilDatePresentation\formatPeriod(), and IL_CAL_UNIX.

Referenced by appointmentToString(), ilRepositoryExplorer\buildTitle(), ilObjSessionListGUI\getTitle(), and ilObjectCopySelectionTableGUI\parseSource().

{
global $lng;
if($fulltime)
{
#new ilDate($end,IL_CAL_UNIX)).' ('.$lng->txt('event_full_time_info').')';
}
else
{
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSessionAppointment::_delete (   $a_appointment_id)

Definition at line 375 of file class.ilSessionAppointment.php.

References $ilDB, $query, and $res.

Referenced by delete().

{
global $ilDB;
$query = "DELETE FROM event_appointment ".
"WHERE appointment_id = ".$ilDB->quote($a_appointment_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

ilSessionAppointment::_deleteBySession (   $a_event_id)

Definition at line 386 of file class.ilSessionAppointment.php.

References $ilDB, $query, and $res.

Referenced by ilObjSession\delete().

{
global $ilDB;
$query = "DELETE FROM event_appointment ".
"WHERE event_id = ".$ilDB->quote($a_event_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

static ilSessionAppointment::_lookupAppointment (   $a_obj_id)
static

lookup appointment

public

Parameters
intobj_id

Definition at line 47 of file class.ilSessionAppointment.php.

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

Referenced by ilLPStatusEvent\_getStatusInfo(), ilObjectActivation\addAdditionalSubItemInformation(), ilRepositoryExplorer\buildTitle(), ilLPStatusEvent\determineStatus(), ilObjSessionListGUI\getAppointmentInfo(), and ilObjectCopySelectionTableGUI\parseSource().

{
global $ilDB;
$query = "SELECT * FROM event_appointment ".
"WHERE event_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$info['fullday'] = $row->fulltime;
$date = new ilDateTime($row->e_start,IL_CAL_DATETIME,'UTC');
$info['start'] = $date->getUnixTime();
$date = new ilDateTime($row->e_end,IL_CAL_DATETIME,'UTC');
$info['end'] = $date->getUnixTime();
return $info;
}
return array();
}

+ Here is the caller graph for this function:

ilSessionAppointment::_readAppointmentsBySession (   $a_event_id)

Definition at line 397 of file class.ilSessionAppointment.php.

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

Referenced by ilObjSession\initAppointments().

{
global $ilDB;
$query = "SELECT * FROM event_appointment ".
"WHERE event_id = ".$ilDB->quote($a_event_id ,'integer')." ".
"ORDER BY starting_time";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$appointments[] =& new ilSessionAppointment($row->appointment_id);
}
return is_array($appointments) ? $appointments : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSessionAppointment::_timeToString (   $start,
  $end 
)

Definition at line 277 of file class.ilSessionAppointment.php.

References $end, $ilUser, $lng, and $start.

Referenced by formatTime().

{
global $ilUser,$lng;
$start = date($this->lng->txt('lang_timeformat_no_sec'),$start);
$end = date($this->lng->txt('lang_timeformat_no_sec'),$end);
return $start.' - '. $end;
}

+ Here is the caller graph for this function:

ilSessionAppointment::appointmentToString ( )

Definition at line 306 of file class.ilSessionAppointment.php.

References _appointmentToString(), enabledFullTime(), getEndingTime(), and getStartingTime().

+ Here is the call graph for this function:

ilSessionAppointment::cloneObject (   $new_id)

clone appointment

public

Parameters
@return

Definition at line 318 of file class.ilSessionAppointment.php.

References getEndingTime(), getStartingTime(), ilSessionAppointment(), and isFullday().

{
$new_app = new ilSessionAppointment();
$new_app->setSessionId($new_id);
$new_app->setStartingTime($this->getStartingTime());
$new_app->setEndingTime($this->getEndingTime());
$new_app->toggleFullTime($this->isFullday());
$new_app->create();
return $new_app;
}

+ Here is the call graph for this function:

ilSessionAppointment::create ( )

Definition at line 329 of file class.ilSessionAppointment.php.

References $ilDB, $query, $res, enabledFullTime(), getEnd(), getSessionId(), getStart(), and IL_CAL_DATETIME.

{
global $ilDB;
if(!$this->getSessionId())
{
return false;
}
$next_id = $ilDB->nextId('event_appointment');
$query = "INSERT INTO event_appointment (appointment_id,event_id,e_start,e_end,fulltime) ".
"VALUES( ".
$ilDB->quote($next_id,'integer').", ".
$ilDB->quote($this->getSessionId() ,'integer').", ".
$ilDB->quote($this->getStart()->get(IL_CAL_DATETIME,'','UTC') ,'timestamp').", ".
$ilDB->quote($this->getEnd()->get(IL_CAL_DATETIME,'','UTC') ,'timestamp').", ".
$ilDB->quote($this->enabledFullTime() ,'integer')." ".
")";
$this->appointment_id = $next_id;
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilSessionAppointment::delete ( )

Definition at line 370 of file class.ilSessionAppointment.php.

References _delete(), and getAppointmentId().

+ Here is the call graph for this function:

ilSessionAppointment::enabledFullTime ( )

Definition at line 267 of file class.ilSessionAppointment.php.

Referenced by appointmentToString(), create(), isFullday(), and update().

{
return $this->fulltime;
}

+ Here is the caller graph for this function:

ilSessionAppointment::formatTime ( )

Definition at line 272 of file class.ilSessionAppointment.php.

References _timeToString(), getEndingTime(), and getStartingTime().

+ Here is the call graph for this function:

ilSessionAppointment::getAppointmentId ( )

Definition at line 228 of file class.ilSessionAppointment.php.

Referenced by __read(), delete(), and update().

{
return $this->appointment_id;
}

+ Here is the caller graph for this function:

ilSessionAppointment::getEnd ( )

get end

public

Returns
ilDateTime

Implements ilDatePeriod.

Definition at line 207 of file class.ilSessionAppointment.php.

References IL_CAL_DATETIME.

Referenced by create(), and update().

{
return $this->end ? $this->end : $this->end = new ilDateTime(date('Y-m-d').' 16:00:00',IL_CAL_DATETIME);
}

+ Here is the caller graph for this function:

ilSessionAppointment::getEndingTime ( )

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

Referenced by appointmentToString(), cloneObject(), and formatTime().

{
return isset($this->ending_time) ? $this->ending_time : mktime(16,0,0,date('n',time()),date('d',time()),date('Y',time()));
}

+ Here is the caller graph for this function:

ilSessionAppointment::getSessionId ( )

Definition at line 237 of file class.ilSessionAppointment.php.

Referenced by create(), and update().

{
return $this->session_id;
}

+ Here is the caller graph for this function:

ilSessionAppointment::getStart ( )

get start

public

Parameters
@returnilDateTime

Implements ilDatePeriod.

Definition at line 185 of file class.ilSessionAppointment.php.

References IL_CAL_DATETIME.

Referenced by create(), and update().

{
return $this->start ? $this->start : $this->start = new ilDateTime(date('Y-m-d').' 08:00:00',IL_CAL_DATETIME);
}

+ Here is the caller graph for this function:

ilSessionAppointment::getStartingTime ( )

Definition at line 248 of file class.ilSessionAppointment.php.

Referenced by appointmentToString(), cloneObject(), and formatTime().

{
return isset($this->starting_time) ? $this->starting_time : mktime(8,0,0,date('n',time()),date('d',time()),date('Y',time()));
}

+ Here is the caller graph for this function:

ilSessionAppointment::ilSessionAppointment (   $a_appointment_id = null)

Definition at line 28 of file class.ilSessionAppointment.php.

References $ilDB, $ilErr, $lng, $tree, and __read().

Referenced by _readAppointmentsBySession(), and cloneObject().

{
$this->ilErr =& $ilErr;
$this->db =& $ilDB;
$this->lng =& $lng;
$this->appointment_id = $a_appointment_id;
$this->__read();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSessionAppointment::isFullday ( )

is fullday

public

Parameters
@return

Implements ilDatePeriod.

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

References enabledFullTime().

Referenced by __read(), and cloneObject().

{
return $this->enabledFullTime();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSessionAppointment::lookupLastSessionByCourse (   $a_ref_id)
static

public

Parameters
@return

Definition at line 138 of file class.ilSessionAppointment.php.

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

Referenced by ilContainerSimpleContentGUI\initDetails(), ilContainerByTypeContentGUI\initDetails(), and ilContainerSessionsContentGUI\initDetails().

{
global $tree,$ilDB;
$sessions = $tree->getChildsByType($a_ref_id,'sess');
$obj_ids = array();
foreach($sessions as $tree_data)
{
$obj_ids[] = $tree_data['obj_id'];
}
if(!count($obj_ids))
{
return false;
}
$query = "SELECT event_id FROM event_appointment ".
"WHERE e_start < ".$ilDB->now()." ".
"AND ".$ilDB->in('event_id',$obj_ids,false,'integer')." ".
"ORDER BY e_start DESC ";
$ilDB->setLimit(1);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$event_id = $row->event_id;
}
return isset($event_id) ? $event_id : 0;
}

+ Here is the caller graph for this function:

static ilSessionAppointment::lookupNextSessionByCourse (   $a_ref_id)
static

public

Parameters
@returnarray

Definition at line 76 of file class.ilSessionAppointment.php.

References $ilDB, $query, $res, $row, $tree, DB_FETCHMODE_OBJECT, IL_CAL_DATE, IL_CAL_DAY, and IL_CAL_UNIX.

Referenced by ilContainerSimpleContentGUI\initDetails(), ilContainerByTypeContentGUI\initDetails(), and ilContainerSessionsContentGUI\initDetails().

{
global $tree,$ilDB;
$sessions = $tree->getChildsByType($a_ref_id,'sess');
$obj_ids = array();
foreach($sessions as $tree_data)
{
$obj_ids[] = $tree_data['obj_id'];
}
if(!count($obj_ids))
{
return false;
}
// Try to read the next sessions within the next 24 hours
$now = new ilDate(time(),IL_CAL_UNIX);
$tomorrow = clone $now;
$tomorrow->increment(IL_CAL_DAY,2);
$query = "SELECT event_id FROM event_appointment ".
"WHERE e_start > ".$ilDB->quote($now->get(IL_CAL_DATE,'timestamp')).' '.
"AND e_start < ".$ilDB->quote($tomorrow->get(IL_CAL_DATE,'timestamp')).' '.
"AND ".$ilDB->in('event_id',$obj_ids,false,'integer').' '.
"ORDER BY e_start ";
$event_ids = array();
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$event_ids[] = $row->event_id;
}
if(count($event_ids))
{
return $event_ids;
}
// Alternativ: get next event.
$query = "SELECT event_id FROM event_appointment ".
"WHERE e_start > ".$ilDB->now()." ".
"AND ".$ilDB->in('event_id',$obj_ids,false,'integer')." ".
"ORDER BY e_start ";
$ilDB->setLimit(1);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$event_id = $row->event_id;
}
return isset($event_id) ? array($event_id) : array();
}

+ Here is the caller graph for this function:

ilSessionAppointment::setAppointmentId (   $a_appointment_id)

Definition at line 224 of file class.ilSessionAppointment.php.

{
$this->appointment_id = $a_appointment_id;
}
ilSessionAppointment::setEnd (   $a_end)

set end

public

Parameters
object$dateilDateTime
Returns

Definition at line 219 of file class.ilSessionAppointment.php.

{
$this->end = $a_end;
}
ilSessionAppointment::setEndingTime (   $a_ending_time)

Definition at line 253 of file class.ilSessionAppointment.php.

References IL_CAL_UNIX.

{
$this->ending_time = $a_ending_time;
$this->end = new ilDateTime($this->ending_time,IL_CAL_UNIX);
}
ilSessionAppointment::setSessionId (   $a_session_id)

Definition at line 233 of file class.ilSessionAppointment.php.

Referenced by __read().

{
$this->session_id = $a_session_id;
}

+ Here is the caller graph for this function:

ilSessionAppointment::setStart (   $a_start)

set start

public

Parameters
object$datailDateTime

Definition at line 196 of file class.ilSessionAppointment.php.

{
$this->start = $a_start;
}
ilSessionAppointment::setStartingTime (   $a_starting_time)

Definition at line 242 of file class.ilSessionAppointment.php.

References IL_CAL_UNIX.

{
$this->starting_time = $a_starting_time;
$this->start = new ilDateTime($this->starting_time,IL_CAL_UNIX);
}
ilSessionAppointment::toggleFullTime (   $a_status)

Definition at line 263 of file class.ilSessionAppointment.php.

Referenced by __read().

{
$this->fulltime = $a_status;
}

+ Here is the caller graph for this function:

ilSessionAppointment::update ( )

Definition at line 352 of file class.ilSessionAppointment.php.

References $ilDB, $query, $res, enabledFullTime(), getAppointmentId(), getEnd(), getSessionId(), getStart(), and IL_CAL_DATETIME.

{
global $ilDB;
if(!$this->getSessionId())
{
return false;
}
$query = "UPDATE event_appointment ".
"SET event_id = ".$ilDB->quote($this->getSessionId() ,'integer').", ".
"e_start = ".$ilDB->quote($this->getStart()->get(IL_CAL_DATETIME,'','UTC') ,'timestamp').", ".
"e_end = ".$ilDB->quote($this->getEnd()->get(IL_CAL_DATETIME,'','UTC'), 'timestamp').", ".
"fulltime = ".$ilDB->quote($this->enabledFullTime() ,'integer')." ".
"WHERE appointment_id = ".$ilDB->quote($this->getAppointmentId() ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilSessionAppointment::validate ( )

Definition at line 413 of file class.ilSessionAppointment.php.

{
if($this->starting_time > $this->ending_time)
{
$this->ilErr->appendMessage($this->lng->txt('event_etime_smaller_stime'));
return false;
}
return true;
}

Field Documentation

ilSessionAppointment::$end = null
protected

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

Referenced by _appointmentToString(), and _timeToString().

ilSessionAppointment::$ending_time = null

Definition at line 26 of file class.ilSessionAppointment.php.

ilSessionAppointment::$ilErr

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

Referenced by ilSessionAppointment().

ilSessionAppointment::$lng
ilSessionAppointment::$start = null
protected

Definition at line 22 of file class.ilSessionAppointment.php.

Referenced by _appointmentToString(), and _timeToString().

ilSessionAppointment::$starting_time = null

Definition at line 25 of file class.ilSessionAppointment.php.

ilSessionAppointment::$tree

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