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');
79 $this->type = $a_type;
82 if(!$a_user_id || $a_user_id == $ilUser->getId())
91 $this->weekstart = $this->user_settings->getWeekStart();
92 $this->timezone = $this->user->getTimeZone();
97 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
106 include_once(
'./Services/Calendar/classes/class.ilCalendarScheduleFilterHidden.php');
112 include_once(
'./Services/Calendar/classes/class.ilCalendarScheduleFilterBookings.php');
125 return $this->limit_events != -1;
143 $this->limit_events = $a_limit;
153 $this->subitems_enabled = $a_status;
172 $this->filters[] = $a_filter;
186 $fend = clone $fstart;
199 $tmp_schedule = array();
202 if($schedule[
'fullday'])
204 if(($f_unix_start == $schedule[
'dstart']) or
205 $f_unix_start == $schedule[
'dend'] or
206 ($f_unix_start > $schedule[
'dstart'] and $f_unix_end <= $schedule[
'dend']))
211 elseif(($schedule[
'dstart'] == $unix_start) or
212 (($schedule[
'dstart'] <= $unix_start) and ($schedule[
'dend'] > $unix_start)) or
213 (($schedule[
'dstart'] >= $unix_start) and ($schedule[
'dstart'] < $unix_end)))
218 return $tmp_schedule;
233 foreach($events as $event)
235 $ids[] = $event->getEntryId();
238 include_once(
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
240 include_once(
'Services/Calendar/classes/class.ilCalendarCategory.php');
241 $cat_types = array();
242 foreach(array_unique($cat_map) as $cat_id)
245 $cat_types[$cat_id] = $cat->getType();
249 foreach($events as $event)
252 include_once(
'Services/Calendar/classes/class.ilCalendarRecurrences.php');
256 foreach($recs as $rec)
259 foreach($calc->calculateDateList($this->start,$this->end)->get() as $rec_date)
261 if($this->type == self::TYPE_PD_UPCOMING &&
267 $this->schedule[$counter][
'event'] = $event;
268 $this->schedule[$counter][
'dstart'] = $rec_date->get(
IL_CAL_UNIX);
269 $this->schedule[$counter][
'dend'] = $this->schedule[$counter][
'dstart'] + $duration;
270 $this->schedule[$counter][
'fullday'] = $event->isFullday();
271 $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
272 $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
277 case self::TYPE_WEEK:
280 $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
283 $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
290 if($this->type != self::TYPE_PD_UPCOMING &&
301 $this->schedule[$counter][
'event'] = $event;
302 $this->schedule[$counter][
'dstart'] = $event->getStart()->get(
IL_CAL_UNIX);
303 $this->schedule[$counter][
'dend'] = $event->getEnd()->get(
IL_CAL_UNIX);
304 $this->schedule[$counter][
'fullday'] = $event->isFullday();
305 $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
306 $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
308 if(!$event->isFullday())
313 case self::TYPE_WEEK:
316 $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
319 $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
327 if($this->type != self::TYPE_PD_UPCOMING &&
335 if($this->type == self::TYPE_PD_UPCOMING)
340 $this->schedule = array_slice($this->schedule, 0, $this->
getEventsLimit());
357 foreach($this->filters as $filter)
361 $a_cats = $filter->filterCategories($a_cats);
372 foreach($this->filters as $filter)
374 if(!$filter->isValidEvent($a_event))
396 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
408 $query =
"SELECT ce.cal_id cal_id FROM cal_entries ce ".
409 "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id ".
411 "AND ".$ilDB->in(
'ca.cat_id',$cats,
false,
'integer').
' '.
412 "ORDER BY last_update";
423 return $events ? $events : array();
436 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
446 $query =
"SELECT ce.cal_id cal_id".
447 " FROM cal_entries ce".
448 " LEFT JOIN cal_recurrence_rules crr ON (ce.cal_id = crr.cal_id)".
449 " JOIN cal_cat_assignments ca ON (ca.cal_id = ce.cal_id)";
451 if($this->type != self::TYPE_INBOX)
453 $query .=
" WHERE ((starta <= ".$this->db->quote($this->end->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
454 " AND enda >= ".$this->db->quote($this->start->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
")".
455 " OR (starta <= ".$this->db->quote($this->end->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
456 " AND NOT rule_id IS NULL))";
464 $query .=
" AND ".$ilDB->in(
'ca.cat_id',$cats,
false,
'integer').
493 $this->start = clone $seed;
494 $this->end = clone $seed;
499 case self::TYPE_WEEK:
500 $this->start = clone $seed;
502 $day_diff = $this->weekstart - $start_info[
'isoday'];
507 $this->start->increment(
IL_CAL_DAY,$day_diff);
513 case self::TYPE_MONTH:
515 list($year,$month) = explode(
'-',$year_month);
524 case self::TYPE_PD_UPCOMING:
525 case self::TYPE_INBOX:
526 $this->start = $seed;