88 $this->strict_period = $a_strict_period;
90 if (!$a_user_id || $a_user_id ==
$ilUser->getId()) {
96 $this->weekstart = $this->user_settings->getWeekStart();
97 $this->timezone = $this->
user->getTimeZone();
121 include_once
'./Services/Calendar/classes/class.ilCalendarScheduleFilterExercise.php';
132 return $this->limit_events != -1;
150 $this->limit_events = $a_limit;
160 $this->subitems_enabled = $a_status;
179 $this->filters[] = $a_filter;
193 $fend = clone $fstart;
206 $tmp_schedule = array();
207 $tmp_schedule_fullday = array();
210 if (($f_unix_start ==
$schedule[
'dstart']) or
215 } elseif ((
$schedule[
'dstart'] == $unix_start) or
223 array_multisort(array_column($tmp_schedule,
'dstart'), SORT_ASC, $tmp_schedule);
226 $schedules = array_merge($tmp_schedule_fullday, $tmp_schedule);
243 foreach ($events as $event) {
244 $ids[] = $event->getEntryId();
247 include_once(
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
249 include_once(
'Services/Calendar/classes/class.ilCalendarCategory.php');
250 $cat_types = array();
251 foreach (array_unique($cat_map) as $cat_id) {
253 $cat_types[$cat_id] = $cat->getType();
257 foreach ($events as $event) {
259 include_once(
'Services/Calendar/classes/class.ilCalendarRecurrences.php');
262 foreach ($recs as $rec) {
264 foreach ($calc->calculateDateList($this->start, $this->end)->get() as $rec_date) {
265 if ($this->type == self::TYPE_PD_UPCOMING &&
270 $this->schedule[
$counter][
'event'] = $event;
272 $this->schedule[
$counter][
'dend'] = $this->schedule[
$counter][
'dstart'] + $duration;
273 $this->schedule[
$counter][
'fullday'] = $event->isFullday();
274 $this->schedule[
$counter][
'category_id'] = $cat_map[$event->getEntryId()];
275 $this->schedule[
$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
277 switch ($this->type) {
292 if ($this->type != self::TYPE_PD_UPCOMING &&
299 $this->schedule[
$counter][
'event'] = $event;
302 $this->schedule[
$counter][
'fullday'] = $event->isFullday();
303 $this->schedule[
$counter][
'category_id'] = $cat_map[$event->getEntryId()];
304 $this->schedule[
$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
306 if (!$event->isFullday()) {
307 switch ($this->type) {
323 if ($this->type != self::TYPE_PD_UPCOMING &&
330 if ($this->type == self::TYPE_PD_UPCOMING) {
333 $this->schedule = array_slice($this->schedule, 0, $this->
getEventsLimit());
345 if (!
sizeof($a_cats)) {
349 foreach ($this->filters as $filter) {
350 if (
sizeof($a_cats)) {
351 $a_cats = $filter->filterCategories($a_cats);
360 foreach ($this->filters as $filter) {
361 $res = $filter->modifyEvent($event);
373 $new_events = array();
374 foreach ($this->filters as $filter) {
375 $events_by_filter = $filter->addCustomEvents(
$start,
$end, $categories);
376 if ($events_by_filter) {
377 $new_events = array_merge($new_events, $events_by_filter);
395 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
406 $query =
"SELECT ce.cal_id cal_id FROM cal_entries ce " .
407 "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id " .
409 "AND " .
$ilDB->in(
'ca.cat_id', $cats,
false,
'integer') .
' ' .
410 "ORDER BY last_update";
417 $events[] = $valid_event;
421 foreach ($this->
addCustomEvents($this->start, $this->end, $cats) as $event) {
425 return $events ? $events : array();
438 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
447 $query =
"SELECT ce.cal_id cal_id" .
448 " FROM cal_entries ce" .
449 " LEFT JOIN cal_recurrence_rules crr ON (ce.cal_id = crr.cal_id)" .
450 " JOIN cal_cat_assignments ca ON (ca.cal_id = ce.cal_id)";
452 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))";
459 $query .=
" WHERE starta >= " . $this->db->quote($date->get(
IL_CAL_DATETIME,
'',
'UTC'),
'timestamp');
462 $query .=
" AND " .
$ilDB->in(
'ca.cat_id', $cats,
false,
'integer') .
472 $events[] = $valid_event;
476 foreach ($this->
addCustomEvents($this->start, $this->end, $cats) as $event) {
492 switch ($this->type) {
494 $this->start = clone $seed;
495 $this->end = clone $seed;
497 if (!$this->strict_period) {
506 $this->start = clone $seed;
508 $day_diff = $this->weekstart - $start_info[
'isoday'];
510 if ($day_diff == 7) {
515 if ($this->strict_period) {
516 $this->start->increment(
IL_CAL_DAY, $day_diff);
520 $this->start->increment(
IL_CAL_DAY, $day_diff);
528 if ($this->strict_period) {
529 $this->start = clone $seed;
530 $this->end = clone $seed;
535 list($year, $month) = explode(
'-', $year_month);
547 $this->start = clone $seed;
554 $this->start = $seed;
571 $this->start = $a_start;
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
const MODE_PORTFOLIO_CONSULTATION
static _getInstance($a_usr_id=0)
get singleton instance
static _getAppointmentCalendars($a_cal_ids)
lookup calendars for appointment ids
Stores calendar categories.
Model for a calendar entry.
Calculates an ilDateList for a given calendar entry and recurrence rule.
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
Calendar schedule filter for booking pool reservations.
Calendar schedule filter for consultation hour bookings.
Calendar schedule filter for exercises.
Calendar schedule filter for hidden categories.
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
enabledSubitemCalendars()
Are subitem calendars enabled.
areEventsLimited()
Check if events are limited.
setEventsLimit($a_limit)
Set events limit.
__construct(ilDate $seed, $a_type, $a_user_id=0, $a_strict_period=false)
Constructor.
modifyEventByFilters(ilCalendarEntry $event)
getChangedEvents($a_include_subitem_calendars=false)
get new/changed events
getEvents()
Read events (will be moved to another class, since only active and/or visible calendars are shown)
addCustomEvents(ilDate $start, ilDate $end, array $categories)
addFilter(ilCalendarScheduleFilter $a_filter)
Add filter.
setPeriod(ilDate $a_start, ilDate $a_end)
Set period.
filterCategories(array $a_cats)
addSubitemCalendars($a_status)
Enable subitem calendars (session calendars for courses)
getByDay(ilDate $a_start, $a_timezone)
get byday
getEventsLimit()
get current limit of events
initPeriod(ilDate $seed)
init period of events
static _getInstanceByUserId($a_user_id)
get singleton instance
static _getMaxDayOfMonth($a_year, $a_month)
get max day of month 2008,2 => 29
@classDescription Date and time handling
increment($a_type, $a_count=1)
increment
get($a_format, $a_format_str='', $a_tz='')
get formatted date
static getLogger($a_component_id)
Get component logger.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
Calendar schedule filter interface.
foreach($_POST as $key=> $value) $res