24 include_once(
'./Services/Calendar/classes/class.ilCalendarUserSettings.php');
25 include_once(
'./Services/Calendar/classes/class.ilDateTime.php');
26 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php');
27 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
28 include_once(
'./Services/Calendar/classes/class.ilCalendarHidden.php');
78 $this->type = $a_type;
81 if(!$a_user_id || $a_user_id == $ilUser->getId())
83 $this->user = $ilUser;
91 $this->weekstart = $this->user_settings->getWeekStart();
92 $this->timezone = $this->user->getTimeZone();
104 $this->subitems_enabled = $a_status;
127 $fend = clone $fstart;
140 $tmp_schedule = array();
143 if($schedule[
'fullday'])
145 if(($f_unix_start == $schedule[
'dstart']) or
146 $f_unix_start == $schedule[
'dend'] or
147 ($f_unix_start > $schedule[
'dstart'] and $f_unix_end <= $schedule[
'dend']))
152 elseif(($schedule[
'dstart'] == $unix_start) or
153 (($schedule[
'dstart'] <= $unix_start) and ($schedule[
'dend'] > $unix_start)) or
154 (($schedule[
'dstart'] >= $unix_start) and ($schedule[
'dstart'] < $unix_end)))
159 return $tmp_schedule;
176 foreach($events as $event)
178 $ids[] = $event->getEntryId();
180 include_once(
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
182 include_once(
'Services/Calendar/classes/class.ilCalendarCategory.php');
183 $cat_types = array();
184 foreach(array_unique($cat_map) as $cat_id)
187 $cat_types[$cat_id] = $cat->getType();
191 foreach($events as $event)
194 include_once(
'Services/Calendar/classes/class.ilCalendarRecurrences.php');
198 foreach($recs as $rec)
201 foreach($calc->calculateDateList($this->start,$this->end)->get() as $rec_date)
203 $this->schedule[$counter][
'event'] = $event;
204 $this->schedule[$counter][
'dstart'] = $rec_date->get(
IL_CAL_UNIX);
205 $this->schedule[$counter][
'dend'] = $this->schedule[$counter][
'dstart'] + $duration;
206 $this->schedule[$counter][
'fullday'] = $event->isFullday();
207 $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
208 $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
213 case self::TYPE_WEEK:
216 $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
219 $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
231 $this->schedule[$counter][
'event'] = $event;
232 $this->schedule[$counter][
'dstart'] = $event->getStart()->get(
IL_CAL_UNIX);
233 $this->schedule[$counter][
'dend'] = $event->getEnd()->get(
IL_CAL_UNIX);
234 $this->schedule[$counter][
'fullday'] = $event->isFullday();
235 $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
236 $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
238 if(!$event->isFullday())
243 case self::TYPE_WEEK:
246 $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
249 $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
273 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
285 $query =
"SELECT ce.cal_id cal_id FROM cal_entries ce ".
286 "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id ".
288 "AND ".$ilDB->in(
'ca.cat_id',$cats,
false,
'integer').
' '.
289 "ORDER BY last_update";
294 if(!$this->hidden_cat->isAppointmentVisible(
$row->cal_id))
299 return $events ? $events : array();
312 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
314 if(!$this->filter_bookings)
325 $query =
"SELECT ce.cal_id cal_id FROM cal_entries ce LEFT JOIN cal_recurrence_rules crr ON ce.cal_id = crr.cal_id ".
326 "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id ";
328 if($this->type != self::TYPE_INBOX)
330 $query .=
"WHERE ((starta <= ".$this->db->quote($this->end->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
" ".
331 "AND enda >= ".$this->db->quote($this->start->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
") ".
332 "OR (starta <= ".$this->db->quote($this->end->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
" ".
333 "AND NOT rule_id IS NULL)) ";
341 $query .=
"AND ".$ilDB->in(
'ca.cat_id',$cats,
false,
'integer').
" ".
347 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
353 if(!$this->filter_bookings)
360 if(!$booking->isBookedOut(
$row->cal_id,
true))
389 $this->start = clone $seed;
390 $this->end = clone $seed;
395 case self::TYPE_WEEK:
396 $this->start = clone $seed;
398 $day_diff = $this->weekstart - $start_info[
'isoday'];
403 $this->start->increment(
IL_CAL_DAY,$day_diff);
409 case self::TYPE_MONTH:
411 list($year,$month) = explode(
'-',$year_month);