89        $this->logger = 
$DIC->logger()->cal();
 
   98        $this->strict_period = $a_strict_period;
 
  100        if (!$a_user_id || $a_user_id == 
$ilUser->getId()) {
 
  106        $this->weekstart = $this->user_settings->getWeekStart();
 
  107        $this->timezone = $this->
user->getTimeZone();
 
  142        return $this->limit_events != -1;
 
  160        $this->limit_events = $a_limit;
 
  170        $this->subitems_enabled = $a_status;
 
  189        $this->filters[] = $a_filter;
 
  203        $fend = clone $fstart;
 
  216        $tmp_schedule = array();
 
  217        $tmp_schedule_fullday = array();
 
  220                if (($f_unix_start == 
$schedule[
'dstart']) or
 
  225            } elseif ((
$schedule[
'dstart'] == $unix_start) or
 
  233        usort($tmp_schedule, 
function (
$a, 
$b) {
 
  234            return $a[
'dstart'] <=> 
$b[
'dstart'];
 
  238        $schedules = array_merge($tmp_schedule_fullday, $tmp_schedule);
 
  255        foreach ($events as $event) {
 
  256            $ids[] = $event->getEntryId();
 
  259        include_once(
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  261        include_once(
'Services/Calendar/classes/class.ilCalendarCategory.php');
 
  262        $cat_types = array();
 
  263        foreach (array_unique($cat_map) as $cat_id) {
 
  265            $cat_types[$cat_id] = $cat->getType();
 
  269        foreach ($events as $event) {
 
  271            include_once(
'Services/Calendar/classes/class.ilCalendarRecurrences.php');
 
  274                foreach ($recs as $rec) {
 
  276                    foreach ($calc->calculateDateList($this->start, $this->end)->get() as $rec_date) {
 
  277                        if ($this->type == self::TYPE_PD_UPCOMING &&
 
  282                        $this->schedule[$counter][
'event'] = $event;
 
  283                        $this->schedule[$counter][
'dstart'] = $rec_date->get(
IL_CAL_UNIX);
 
  284                        $this->schedule[$counter][
'dend'] = $this->schedule[$counter][
'dstart'] + $duration;
 
  285                        $this->schedule[$counter][
'fullday'] = $event->isFullday();
 
  286                        $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
 
  287                        $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
 
  289                        switch ($this->type) {
 
  294                                $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE, 
'', $this->timezone);
 
  297                                $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE, 
'', $this->timezone);
 
  304                        if ($this->type != self::TYPE_PD_UPCOMING &&
 
  311                $this->schedule[$counter][
'event'] = $event;
 
  312                $this->schedule[$counter][
'dstart'] = $event->getStart()->get(
IL_CAL_UNIX);
 
  313                $this->schedule[$counter][
'dend'] = $event->getEnd()->get(
IL_CAL_UNIX);
 
  314                $this->schedule[$counter][
'fullday'] = $event->isFullday();
 
  315                $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
 
  316                $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
 
  318                if (!$event->isFullday()) {
 
  319                    switch ($this->type) {
 
  324                            $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE, 
'', $this->timezone);
 
  327                            $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE, 
'', $this->timezone);
 
  335                if ($this->type != self::TYPE_PD_UPCOMING &&
 
  342        if ($this->type == self::TYPE_PD_UPCOMING) {
 
  345                $this->schedule = array_slice($this->schedule, 0, $this->
getEventsLimit());
 
  357        if (!
sizeof($a_cats)) {
 
  361        foreach ($this->filters as $filter) {
 
  362            if (
sizeof($a_cats)) {
 
  363                $a_cats = $filter->filterCategories($a_cats);
 
  372        foreach ($this->filters as $filter) {
 
  373            $res = $filter->modifyEvent($event);
 
  375                $this->logger->info(
'filtering failed for ' . get_class($filter));
 
  385        $new_events = array();
 
  386        foreach ($this->filters as $filter) {
 
  387            $events_by_filter = $filter->addCustomEvents(
$start, 
$end, $categories);
 
  388            if ($events_by_filter) {
 
  389                $new_events = array_merge($new_events, $events_by_filter);
 
  409        include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
 
  420        $query = 
"SELECT ce.cal_id cal_id FROM cal_entries ce  " .
 
  421            "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id " .
 
  423            "AND " . 
$ilDB->in(
'ca.cat_id', $cats, 
false, 
'integer') . 
' ' .
 
  424            "ORDER BY last_update";
 
  431                $events[] = $valid_event;
 
  435        foreach ($this->
addCustomEvents($this->start, $this->end, $cats) as $event) {
 
  439        return $events ? $events : array();
 
  454        include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
 
  463        $query = 
"SELECT ce.cal_id cal_id" .
 
  464            " FROM cal_entries ce" .
 
  465            " LEFT JOIN cal_recurrence_rules crr ON (ce.cal_id = crr.cal_id)" .
 
  466            " JOIN cal_cat_assignments ca ON (ca.cal_id = ce.cal_id)";
 
  468        if ($this->type != self::TYPE_INBOX) {
 
  469            $query .= 
" WHERE ((starta <= " . $this->db->quote($this->end->get(
IL_CAL_DATETIME, 
'', 
'UTC'), 
'timestamp') .
 
  470                " AND enda >= " . $this->db->quote($this->start->get(
IL_CAL_DATETIME, 
'', 
'UTC'), 
'timestamp') . 
")" .
 
  471                " OR (starta <= " . $this->db->quote($this->end->get(
IL_CAL_DATETIME, 
'', 
'UTC'), 
'timestamp') .
 
  472                " AND NOT rule_id IS NULL))";
 
  475            $query .= 
" WHERE starta >= " . $this->db->quote($date->get(
IL_CAL_DATETIME, 
'', 
'UTC'), 
'timestamp');
 
  478        $query .= 
" AND " . 
$ilDB->in(
'ca.cat_id', $cats, 
false, 
'integer') .
 
  488                $events[] = $valid_event;
 
  492        foreach ($this->
addCustomEvents($this->start, $this->end, $cats) as $event) {
 
  508        switch ($this->type) {
 
  510                $this->start = clone $seed;
 
  511                $this->end = clone $seed;
 
  513                if (!$this->strict_period) {
 
  523                $this->start = clone $seed;
 
  525                $day_diff = $this->weekstart - $start_info[
'isoday'];
 
  527                if ($day_diff == 7) {
 
  532                if ($this->strict_period) {
 
  533                    $this->start->increment(
IL_CAL_DAY, $day_diff);
 
  537                    $this->start->increment(
IL_CAL_DAY, $day_diff);
 
  545                if ($this->strict_period) {
 
  546                    $this->start = clone $seed;
 
  547                    $this->end = clone $seed;
 
  551                    list($year, $month) = explode(
'-', $year_month);
 
  556                    $start_unix_time = $this->start->getUnixTime();
 
  558                    $start_day_of_week = (int) date(
'w', $start_unix_time);
 
  560                    $number_days_previous_month = 0;
 
  563                        $number_days_previous_month = 6;
 
  564                    } elseif ($start_day_of_week > 0) {
 
  565                        $number_days_previous_month = $start_day_of_week;
 
  568                            $number_days_previous_month = $start_day_of_week - 1;
 
  572                    $this->start->increment(
IL_CAL_DAY, -$number_days_previous_month);
 
  577                    $end_unix_time = $this->end->getUnixTime();
 
  579                    $end_day_of_week = (int) date(
'w', $end_unix_time);
 
  581                    if ($end_day_of_week > 0) {
 
  582                        $number_days_next_month = 7 - $end_day_of_week;
 
  585                            $number_days_next_month = $number_days_next_month - 1;
 
  588                        $this->end->increment(
IL_CAL_DAY, $number_days_next_month);
 
  595                $this->start = clone $seed;
 
  602                $this->start = $seed;
 
  619        $this->start = $a_start;
 
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.
Calendar schedule filter for individual timings.
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 sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
Calendar schedule filter interface.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
foreach($_POST as $key=> $value) $res