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');
80 $this->type = $a_type;
83 if(!$a_user_id || $a_user_id == $ilUser->getId())
93 $this->weekstart = $this->user_settings->getWeekStart();
94 $this->timezone = $this->user->getTimeZone();
105 return $this->limit_events != -1;
123 $this->limit_events = $a_limit;
133 $this->subitems_enabled = $a_status;
156 $fend = clone $fstart;
169 $tmp_schedule = array();
172 if($schedule[
'fullday'])
174 if(($f_unix_start == $schedule[
'dstart']) or
175 $f_unix_start == $schedule[
'dend'] or
176 ($f_unix_start > $schedule[
'dstart'] and $f_unix_end <= $schedule[
'dend']))
181 elseif(($schedule[
'dstart'] == $unix_start) or
182 (($schedule[
'dstart'] <= $unix_start) and ($schedule[
'dend'] > $unix_start)) or
183 (($schedule[
'dstart'] >= $unix_start) and ($schedule[
'dstart'] < $unix_end)))
188 return $tmp_schedule;
205 foreach($events as $event)
207 $ids[] = $event->getEntryId();
209 include_once(
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
211 include_once(
'Services/Calendar/classes/class.ilCalendarCategory.php');
212 $cat_types = array();
213 foreach(array_unique($cat_map) as $cat_id)
216 $cat_types[$cat_id] = $cat->getType();
220 foreach($events as $event)
223 include_once(
'Services/Calendar/classes/class.ilCalendarRecurrences.php');
227 foreach($recs as $rec)
230 foreach($calc->calculateDateList($this->start,$this->end)->get() as $rec_date)
232 if($this->type == self::TYPE_PD_UPCOMING &&
238 $this->schedule[$counter][
'event'] = $event;
239 $this->schedule[$counter][
'dstart'] = $rec_date->get(
IL_CAL_UNIX);
240 $this->schedule[$counter][
'dend'] = $this->schedule[$counter][
'dstart'] + $duration;
241 $this->schedule[$counter][
'fullday'] = $event->isFullday();
242 $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
243 $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
248 case self::TYPE_WEEK:
251 $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
254 $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
261 if($this->type != self::TYPE_PD_UPCOMING &&
272 $this->schedule[$counter][
'event'] = $event;
273 $this->schedule[$counter][
'dstart'] = $event->getStart()->get(
IL_CAL_UNIX);
274 $this->schedule[$counter][
'dend'] = $event->getEnd()->get(
IL_CAL_UNIX);
275 $this->schedule[$counter][
'fullday'] = $event->isFullday();
276 $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
277 $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
279 if(!$event->isFullday())
284 case self::TYPE_WEEK:
287 $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
290 $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE,
'',$this->timezone);
298 if($this->type != self::TYPE_PD_UPCOMING &&
306 if($this->type == self::TYPE_PD_UPCOMING)
311 $this->schedule = array_slice($this->schedule, 0, $this->
getEventsLimit());
334 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
346 $query =
"SELECT ce.cal_id cal_id FROM cal_entries ce ".
347 "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id ".
349 "AND ".$ilDB->in(
'ca.cat_id',$cats,
false,
'integer').
' '.
350 "ORDER BY last_update";
355 if(!$this->hidden_cat->isAppointmentVisible(
$row->cal_id))
360 return $events ? $events : array();
373 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
375 if(!$this->filter_bookings)
386 $query =
"SELECT ce.cal_id cal_id FROM cal_entries ce LEFT JOIN cal_recurrence_rules crr ON ce.cal_id = crr.cal_id ".
387 "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id ";
389 if($this->type != self::TYPE_INBOX)
391 $query .=
"WHERE ((starta <= ".$this->db->quote($this->end->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
" ".
392 "AND enda >= ".$this->db->quote($this->start->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
") ".
393 "OR (starta <= ".$this->db->quote($this->end->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp').
" ".
394 "AND NOT rule_id IS NULL)) ";
402 $query .=
"AND ".$ilDB->in(
'ca.cat_id',$cats,
false,
'integer').
" ".
408 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
414 if(!$this->filter_bookings)
421 if(!$booking->isBookedOut(
$row->cal_id,
true))
444 $this->start = clone $seed;
445 $this->end = clone $seed;
450 case self::TYPE_WEEK:
451 $this->start = clone $seed;
453 $day_diff = $this->weekstart - $start_info[
'isoday'];
458 $this->start->increment(
IL_CAL_DAY,$day_diff);
464 case self::TYPE_MONTH:
466 list($year,$month) = explode(
'-',$year_month);
475 case self::TYPE_PD_UPCOMING:
476 case self::TYPE_INBOX:
477 $this->start = $seed;