ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSessionAppointment Class Reference

class ilSessionAppointment More...

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

Public Member Functions

 __construct ($a_appointment_id=null)
 Consructor. More...
 
 isFullday ()
 is fullday More...
 
 getStart ()
 get start More...
 
 setStart ($a_start)
 set start More...
 
 getEnd ()
 get end More...
 
 setEnd ($a_end)
 set end More...
 
 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 More...
 
 create ()
 
 update ()
 
 delete ()
 
 validate ()
 
 __read ()
 
 isFullday ()
 is fullday More...
 

Static Public Member Functions

static _lookupAppointment ($a_obj_id)
 lookup appointment More...
 
static lookupNextSessionByCourse ($a_ref_id)
 @access public More...
 
static lookupLastSessionByCourse ($a_ref_id)
 @access public More...
 
static _appointmentToString ($start, $end, $fulltime)
 
static _delete ($a_appointment_id)
 
static _deleteBySession ($a_event_id)
 
static _readAppointmentsBySession ($a_event_id)
 
 getStart ()
 Interface method get start. More...
 
 getEnd ()
 Interface method get end. More...
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilSessionAppointment::__construct (   $a_appointment_id = null)

Consructor.

Parameters
int$a_appointment_id

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

33 {
34 global $DIC;
35
36 $ilErr = $DIC['ilErr'];
37 $ilDB = $DIC['ilDB'];
38 $lng = $DIC['lng'];
39 $tree = $DIC['tree'];
40
41 $this->ilErr = $ilErr;
42 $this->db = $ilDB;
43 $this->lng = $lng;
44
45 $this->appointment_id = $a_appointment_id;
46 $this->__read();
47 }
global $DIC
Definition: saml.php:7

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilSessionAppointment::__read ( )

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

442 {
443 global $DIC;
444
445 $ilDB = $DIC['ilDB'];
446
447 if (!$this->getAppointmentId()) {
448 return null;
449 }
450
451 $query = "SELECT * FROM event_appointment " .
452 "WHERE appointment_id = " . $ilDB->quote($this->getAppointmentId(), 'integer') . " ";
453 $res = $this->db->query($query);
454 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
455 $this->setSessionId($row->event_id);
456 $this->toggleFullTime($row->fulltime);
457
458 if ($this->isFullday()) {
459 $this->start = new ilDate($row->e_start, IL_CAL_DATETIME);
460 $this->end = new ilDate($row->e_end, IL_CAL_DATETIME);
461 } else {
462 $this->start = new ilDateTime($row->e_start, IL_CAL_DATETIME, 'UTC');
463 $this->end = new ilDateTime($row->e_end, IL_CAL_DATETIME, 'UTC');
464 }
465 $this->starting_time = $this->start->getUnixTime();
466 $this->ending_time = $this->end->getUnixTime();
467 }
468 return true;
469 }
const IL_CAL_DATETIME
@classDescription Date and time handling
Class for single dates.
$row
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, getAppointmentId(), IL_CAL_DATETIME, isFullday(), setSessionId(), and toggleFullTime().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _appointmentToString()

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

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

298 {
299 global $DIC;
300
301 $lng = $DIC['lng'];
302
303 if ($fulltime) {
306 #new ilDate($end,IL_CAL_UNIX)).' ('.$lng->txt('event_full_time_info').')';
308 );
309 } else {
313 );
314 }
315 }
const IL_CAL_UNIX
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.

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

Referenced by ilCourseContentGUI\__renderItem(), ilCourseContentGUI\__renderUserItem(), appointmentToString(), ilCourseContentGUI\editTimings(), ilRepositoryExplorerGUI\getNodeContent(), ilObjSessionListGUI\getTitle(), ilObjectCopySelectionTableGUI\parseSource(), ilTimingsManageTableGUI\parseTitle(), ilTimingsPersonalTableGUI\parseTitle(), ilContainerContentGUI\renderCard(), and ilSessionMailTemplateParticipantContext\resolveSpecificPlaceholder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _delete()

static ilSessionAppointment::_delete (   $a_appointment_id)
static

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

389 {
390 global $DIC;
391
392 $ilDB = $DIC['ilDB'];
393
394 $query = "DELETE FROM event_appointment " .
395 "WHERE appointment_id = " . $ilDB->quote($a_appointment_id, 'integer') . " ";
396 $res = $ilDB->manipulate($query);
397
398 return true;
399 }

References $DIC, $ilDB, $query, and $res.

Referenced by delete().

+ Here is the caller graph for this function:

◆ _deleteBySession()

static ilSessionAppointment::_deleteBySession (   $a_event_id)
static

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

402 {
403 global $DIC;
404
405 $ilDB = $DIC['ilDB'];
406
407 $query = "DELETE FROM event_appointment " .
408 "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer') . " ";
409 $res = $ilDB->manipulate($query);
410
411 return true;
412 }

References $DIC, $ilDB, $query, and $res.

Referenced by ilObjSession\delete().

+ Here is the caller graph for this function:

◆ _lookupAppointment()

static ilSessionAppointment::_lookupAppointment (   $a_obj_id)
static

lookup appointment

@access public

Parameters
intobj_id

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

57 {
58 global $DIC;
59
60 $ilDB = $DIC['ilDB'];
61
62 $query = "SELECT * FROM event_appointment " .
63 "WHERE event_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
64 $res = $ilDB->query($query);
65 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
66 $info['fullday'] = $row->fulltime;
67
68 $date = new ilDateTime($row->e_start, IL_CAL_DATETIME, 'UTC');
69 $info['start'] = $date->getUnixTime();
70 $date = new ilDateTime($row->e_end, IL_CAL_DATETIME, 'UTC');
71 $info['end'] = $date->getUnixTime();
72
73 return $info;
74 }
75 return array();
76 }
$info
Definition: index.php:5

References $DIC, $ilDB, $info, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and IL_CAL_DATETIME.

Referenced by ilCourseContentGUI\__renderItem(), ilCourseContentGUI\__renderUserItem(), ilLPStatusEvent\_getStatusInfo(), ilObjectActivation\addAdditionalSubItemInformation(), ilLPStatusEvent\determineStatus(), ilCourseContentGUI\editTimings(), ilObjSessionListGUI\getAppointmentInfo(), ilRepositoryExplorerGUI\getNodeContent(), ilObjectCopySelectionTableGUI\parseSource(), ilTimingsManageTableGUI\parseTitle(), ilTimingsPersonalTableGUI\parseTitle(), ilContainerContentGUI\renderCard(), and ilSessionMailTemplateParticipantContext\resolveSpecificPlaceholder().

+ Here is the caller graph for this function:

◆ _readAppointmentsBySession()

static ilSessionAppointment::_readAppointmentsBySession (   $a_event_id)
static

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

415 {
416 global $DIC;
417
418 $ilDB = $DIC['ilDB'];
419
420 $query = "SELECT * FROM event_appointment " .
421 "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer') . " " .
422 "ORDER BY starting_time";
423
424 $res = $ilDB->query($query);
425 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
426 $appointments[] = new ilSessionAppointment($row->appointment_id);
427 }
428 return is_array($appointments) ? $appointments : array();
429 }
class ilSessionAppointment

References $DIC, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjSession\initAppointments().

+ Here is the caller graph for this function:

◆ _timeToString()

ilSessionAppointment::_timeToString (   $start,
  $end 
)

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

285 {
286 global $DIC;
287
288 $ilUser = $DIC['ilUser'];
289 $lng = $DIC['lng'];
290
291 $start = date($this->lng->txt('lang_timeformat_no_sec'), $start);
292 $end = date($this->lng->txt('lang_timeformat_no_sec'), $end);
293
294 return $start . ' - ' . $end;
295 }
$ilUser
Definition: imgupload.php:18

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

Referenced by formatTime().

+ Here is the caller graph for this function:

◆ appointmentToString()

ilSessionAppointment::appointmentToString ( )

◆ cloneObject()

ilSessionAppointment::cloneObject (   $new_id)

clone appointment

@access public

Parameters

return

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

330 {
331 $new_app = new ilSessionAppointment();
332 $new_app->setSessionId($new_id);
333 $new_app->setStartingTime($this->getStartingTime());
334 $new_app->setEndingTime($this->getEndingTime());
335 $new_app->toggleFullTime($this->isFullday());
336 $new_app->create();
337 return $new_app;
338 }

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

+ Here is the call graph for this function:

◆ create()

ilSessionAppointment::create ( )

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

341 {
342 global $DIC;
343
344 $ilDB = $DIC['ilDB'];
345
346 if (!$this->getSessionId()) {
347 return false;
348 }
349 $next_id = $ilDB->nextId('event_appointment');
350 $query = "INSERT INTO event_appointment (appointment_id,event_id,e_start,e_end,fulltime) " .
351 "VALUES( " .
352 $ilDB->quote($next_id, 'integer') . ", " .
353 $ilDB->quote($this->getSessionId(), 'integer') . ", " .
354 $ilDB->quote($this->getStart()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
355 $ilDB->quote($this->getEnd()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
356 $ilDB->quote($this->enabledFullTime(), 'integer') . " " .
357 ")";
358 $this->appointment_id = $next_id;
359 $res = $ilDB->manipulate($query);
360
361 return true;
362 }

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

+ Here is the call graph for this function:

◆ delete()

ilSessionAppointment::delete ( )

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

384 {
386 }
static _delete($a_appointment_id)

References _delete(), and getAppointmentId().

+ Here is the call graph for this function:

◆ enabledFullTime()

ilSessionAppointment::enabledFullTime ( )

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

275 {
276 return $this->fulltime;
277 }

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

+ Here is the caller graph for this function:

◆ formatTime()

ilSessionAppointment::formatTime ( )

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

280 {
282 }

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

+ Here is the call graph for this function:

◆ getAppointmentId()

ilSessionAppointment::getAppointmentId ( )

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

237 {
238 return $this->appointment_id;
239 }

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

+ Here is the caller graph for this function:

◆ getEnd()

ilSessionAppointment::getEnd ( )

get end

@access public

Returns
ilDateTime

Implements ilDatePeriod.

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

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

References IL_CAL_DATETIME.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getEndingTime()

ilSessionAppointment::getEndingTime ( )

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

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

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

+ Here is the caller graph for this function:

◆ getSessionId()

ilSessionAppointment::getSessionId ( )

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

246 {
247 return $this->session_id;
248 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getStart()

ilSessionAppointment::getStart ( )

get start

@access public

Parameters

return ilDateTime

Implements ilDatePeriod.

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

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

References IL_CAL_DATETIME.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getStartingTime()

ilSessionAppointment::getStartingTime ( )

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

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

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

+ Here is the caller graph for this function:

◆ isFullday()

ilSessionAppointment::isFullday ( )

is fullday

@access public

Parameters

return

Implements ilDatePeriod.

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

182 {
183 return $this->enabledFullTime();
184 }

References enabledFullTime().

Referenced by __read(), and cloneObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupLastSessionByCourse()

static ilSessionAppointment::lookupLastSessionByCourse (   $a_ref_id)
static

@access public

Parameters

return

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

147 {
148 global $DIC;
149
150 $tree = $DIC['tree'];
151 $ilDB = $DIC['ilDB'];
152
153 $sessions = $tree->getChildsByType($a_ref_id, 'sess');
154 $obj_ids = array();
155 foreach ($sessions as $tree_data) {
156 $obj_ids[] = $tree_data['obj_id'];
157 }
158 if (!count($obj_ids)) {
159 return false;
160 }
161 $query = "SELECT event_id FROM event_appointment " .
162 "WHERE e_start < " . $ilDB->now() . " " .
163 "AND " . $ilDB->in('event_id', $obj_ids, false, 'integer') . " " .
164 "ORDER BY e_start DESC ";
165 $ilDB->setLimit(1);
166 $res = $ilDB->query($query);
167 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
168 $event_id = $row->event_id;
169 }
170 return isset($event_id) ? $event_id : 0;
171 }

References $DIC, $ilDB, $query, $res, $row, $tree, and ilDBConstants\FETCHMODE_OBJECT.

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

+ Here is the caller graph for this function:

◆ lookupNextSessionByCourse()

static ilSessionAppointment::lookupNextSessionByCourse (   $a_ref_id)
static

@access public

Parameters

return array

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

87 {
88 global $DIC;
89
90 $tree = $DIC['tree'];
91 $ilDB = $DIC['ilDB'];
92
93
94 $sessions = $tree->getChildsByType($a_ref_id, 'sess');
95 $obj_ids = array();
96 foreach ($sessions as $tree_data) {
97 $obj_ids[] = $tree_data['obj_id'];
98 }
99 if (!count($obj_ids)) {
100 return false;
101 }
102
103 // Try to read the next sessions within the next 24 hours
104 $now = new ilDate(time(), IL_CAL_UNIX);
105 $tomorrow = clone $now;
106 $tomorrow->increment(IL_CAL_DAY, 2);
107
108 $query = "SELECT event_id FROM event_appointment " .
109 "WHERE e_start > " . $ilDB->quote($now->get(IL_CAL_DATE, 'timestamp')) . ' ' .
110 "AND e_start < " . $ilDB->quote($tomorrow->get(IL_CAL_DATE, 'timestamp')) . ' ' .
111 "AND " . $ilDB->in('event_id', $obj_ids, false, 'integer') . ' ' .
112 "ORDER BY e_start ";
113
114 $event_ids = array();
115
116 $res = $ilDB->query($query);
117 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
118 $event_ids[] = $row->event_id;
119 }
120
121 if (count($event_ids)) {
122 return $event_ids;
123 }
124
125 // Alternativ: get next event.
126 $query = "SELECT event_id FROM event_appointment " .
127 "WHERE e_start > " . $ilDB->now() . " " .
128 "AND " . $ilDB->in('event_id', $obj_ids, false, 'integer') . " " .
129 "ORDER BY e_start ";
130 $ilDB->setLimit(1);
131 $res = $ilDB->query($query);
132 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
133 $event_id = $row->event_id;
134 }
135 return isset($event_id) ? array($event_id) : array();
136 }
const IL_CAL_DATE
const IL_CAL_DAY

References $DIC, $ilDB, $query, $res, $row, $tree, ilDBConstants\FETCHMODE_OBJECT, IL_CAL_DATE, IL_CAL_DAY, and IL_CAL_UNIX.

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

+ Here is the caller graph for this function:

◆ setAppointmentId()

ilSessionAppointment::setAppointmentId (   $a_appointment_id)

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

233 {
234 $this->appointment_id = $a_appointment_id;
235 }

◆ setEnd()

ilSessionAppointment::setEnd (   $a_end)

set end

@access public

Parameters
object$dateilDateTime
Returns

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

228 {
229 $this->end = $a_end;
230 }

◆ setEndingTime()

ilSessionAppointment::setEndingTime (   $a_ending_time)

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

261 {
262 $this->ending_time = $a_ending_time;
263 $this->end = new ilDateTime($this->ending_time, IL_CAL_UNIX);
264 }

References IL_CAL_UNIX.

◆ setSessionId()

ilSessionAppointment::setSessionId (   $a_session_id)

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

242 {
243 $this->session_id = $a_session_id;
244 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ setStart()

ilSessionAppointment::setStart (   $a_start)

set start

@access public

Parameters
object$datailDateTime

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

205 {
206 $this->start = $a_start;
207 }

◆ setStartingTime()

ilSessionAppointment::setStartingTime (   $a_starting_time)

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

251 {
252 $this->starting_time = $a_starting_time;
253 $this->start = new ilDateTime($this->starting_time, IL_CAL_UNIX);
254 }

References IL_CAL_UNIX.

◆ toggleFullTime()

ilSessionAppointment::toggleFullTime (   $a_status)

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

271 {
272 $this->fulltime = $a_status;
273 }

Referenced by __read().

+ Here is the caller graph for this function:

◆ update()

ilSessionAppointment::update ( )

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

365 {
366 global $DIC;
367
368 $ilDB = $DIC['ilDB'];
369
370 if (!$this->getSessionId()) {
371 return false;
372 }
373 $query = "UPDATE event_appointment " .
374 "SET event_id = " . $ilDB->quote($this->getSessionId(), 'integer') . ", " .
375 "e_start = " . $ilDB->quote($this->getStart()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
376 "e_end = " . $ilDB->quote($this->getEnd()->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp') . ", " .
377 "fulltime = " . $ilDB->quote($this->enabledFullTime(), 'integer') . " " .
378 "WHERE appointment_id = " . $ilDB->quote($this->getAppointmentId(), 'integer') . " ";
379 $res = $ilDB->manipulate($query);
380 return true;
381 }

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

+ Here is the call graph for this function:

◆ validate()

ilSessionAppointment::validate ( )

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

432 {
433 if ($this->starting_time > $this->ending_time) {
434 $this->ilErr->appendMessage($this->lng->txt('event_etime_smaller_stime'));
435 return false;
436 }
437 return true;
438 }

Field Documentation

◆ $end

ilSessionAppointment::$end = null
protected

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

Referenced by _appointmentToString(), and _timeToString().

◆ $ending_time

ilSessionAppointment::$ending_time = null

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

◆ $ilDB

◆ $ilErr

ilSessionAppointment::$ilErr

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

Referenced by __construct().

◆ $lng

ilSessionAppointment::$lng

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

Referenced by __construct(), _appointmentToString(), and _timeToString().

◆ $start

ilSessionAppointment::$start = null
protected

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

Referenced by _appointmentToString(), and _timeToString().

◆ $starting_time

ilSessionAppointment::$starting_time = null

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

◆ $tree

ilSessionAppointment::$tree

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