5 include_once(
'./Services/Calendar/interfaces/interface.ilDatePeriod.php');
6 include_once(
'./Services/Calendar/classes/class.ilDate.php');
45 $this->appointment_id = $a_appointment_id;
62 $query =
"SELECT * FROM event_appointment " .
63 "WHERE event_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
69 $info[
'start'] = $date->getUnixTime();
71 $info[
'end'] = $date->getUnixTime();
94 $sessions =
$tree->getChildsByType($a_ref_id,
'sess');
96 foreach ($sessions as $tree_data) {
97 $obj_ids[] = $tree_data[
'obj_id'];
99 if (!count($obj_ids)) {
105 $tomorrow = clone $now;
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') .
' ' .
114 $event_ids = array();
118 $event_ids[] =
$row->event_id;
121 if (count($event_ids)) {
126 $query =
"SELECT event_id FROM event_appointment " .
127 "WHERE e_start > " .
$ilDB->now() .
" " .
128 "AND " .
$ilDB->in(
'event_id', $obj_ids,
false,
'integer') .
" " .
133 $event_id =
$row->event_id;
135 return isset($event_id) ? array($event_id) : array();
150 $tree = $DIC[
'tree'];
151 $ilDB = $DIC[
'ilDB'];
153 $sessions =
$tree->getChildsByType($a_ref_id,
'sess');
155 foreach ($sessions as $tree_data) {
156 $obj_ids[] = $tree_data[
'obj_id'];
158 if (!count($obj_ids)) {
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 ";
168 $event_id =
$row->event_id;
170 return isset($event_id) ? $event_id : 0;
206 $this->start = $a_start;
234 $this->appointment_id = $a_appointment_id;
238 return $this->appointment_id;
243 $this->session_id = $a_session_id;
247 return $this->session_id;
252 $this->starting_time = $a_starting_time;
257 return isset($this->starting_time) ? $this->starting_time : mktime(8, 0, 0, date(
'n', time()), date(
'd', time()), date(
'Y', time()));
262 $this->ending_time = $a_ending_time;
267 return isset($this->ending_time) ? $this->ending_time : mktime(16, 0, 0, date(
'n', time()), date(
'd', time()), date(
'Y', time()));
272 $this->fulltime = $a_status;
276 return $this->fulltime;
291 $start = date($this->lng->txt(
'lang_timeformat_no_sec'),
$start);
292 $end = date($this->lng->txt(
'lang_timeformat_no_sec'),
$end);
332 $new_app->setSessionId($new_id);
335 $new_app->toggleFullTime($this->
isFullday());
344 $ilDB = $DIC[
'ilDB'];
349 $next_id =
$ilDB->nextId(
'event_appointment');
350 $query =
"INSERT INTO event_appointment (appointment_id,event_id,e_start,e_end,fulltime) " .
352 $ilDB->quote($next_id,
'integer') .
", " .
358 $this->appointment_id = $next_id;
368 $ilDB = $DIC[
'ilDB'];
373 $query =
"UPDATE event_appointment " .
383 public function delete()
388 public static function _delete($a_appointment_id)
392 $ilDB = $DIC[
'ilDB'];
394 $query =
"DELETE FROM event_appointment " .
395 "WHERE appointment_id = " .
$ilDB->quote($a_appointment_id,
'integer') .
" ";
405 $ilDB = $DIC[
'ilDB'];
407 $query =
"DELETE FROM event_appointment " .
408 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" ";
418 $ilDB = $DIC[
'ilDB'];
420 $query =
"SELECT * FROM event_appointment " .
421 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" " .
422 "ORDER BY starting_time";
428 return is_array($appointments) ? $appointments : array();
433 if ($this->starting_time > $this->ending_time) {
434 $this->ilErr->appendMessage($this->lng->txt(
'event_etime_smaller_stime'));
445 $ilDB = $DIC[
'ilDB'];
451 $query =
"SELECT * FROM event_appointment " .
465 $this->starting_time = $this->start->getUnixTime();
466 $this->ending_time = $this->end->getUnixTime();
static _delete($a_appointment_id)
setEndingTime($a_ending_time)
setAppointmentId($a_appointment_id)
static _deleteBySession($a_event_id)
foreach($_POST as $key=> $value) $res
static _appointmentToString($start, $end, $fulltime)
cloneObject($new_id)
clone appointment
_timeToString($start, $end)
static lookupLastSessionByCourse($a_ref_id)
public
toggleFullTime($a_status)
setSessionId($a_session_id)
setStart($a_start)
set start
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
__construct($a_appointment_id=null)
Consructor.
static _lookupAppointment($a_obj_id)
lookup appointment
static _readAppointmentsBySession($a_event_id)
static lookupNextSessionByCourse($a_ref_id)
public
setStartingTime($a_starting_time)
class ilSessionAppointment