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();
 
  141        return $this->limit_events != -1;
 
  159        $this->limit_events = $a_limit;
 
  169        $this->subitems_enabled = $a_status;
 
  188        $this->filters[] = $a_filter;
 
  202        $fend = clone $fstart;
 
  215        $tmp_schedule = array();
 
  216        $tmp_schedule_fullday = array();
 
  219                if (($f_unix_start == 
$schedule[
'dstart']) or
 
  224            } elseif ((
$schedule[
'dstart'] == $unix_start) or
 
  232        usort($tmp_schedule, 
function ($a, $b) {
 
  233            return $a[
'dstart'] <=> $b[
'dstart'];
 
  237        $schedules = array_merge($tmp_schedule_fullday, $tmp_schedule);
 
  255            $ids[] = $event->getEntryId();
 
  258        include_once(
'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
 
  260        include_once(
'Services/Calendar/classes/class.ilCalendarCategory.php');
 
  261        $cat_types = array();
 
  262        foreach (array_unique($cat_map) as $cat_id) {
 
  264            $cat_types[$cat_id] = $cat->getType();
 
  270            include_once(
'Services/Calendar/classes/class.ilCalendarRecurrences.php');
 
  273                foreach ($recs as $rec) {
 
  275                    foreach ($calc->calculateDateList($this->start, $this->end)->get() as $rec_date) {
 
  276                        if ($this->type == self::TYPE_PD_UPCOMING &&
 
  281                        $this->schedule[$counter][
'event'] = $event;
 
  282                        $this->schedule[$counter][
'dstart'] = $rec_date->get(
IL_CAL_UNIX);
 
  283                        $this->schedule[$counter][
'dend'] = $this->schedule[$counter][
'dstart'] + $duration;
 
  284                        $this->schedule[$counter][
'fullday'] = $event->isFullday();
 
  285                        $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
 
  286                        $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
 
  288                        switch ($this->type) {
 
  293                                $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE, 
'', $this->timezone);
 
  296                                $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE, 
'', $this->timezone);
 
  303                        if ($this->type != self::TYPE_PD_UPCOMING &&
 
  310                $this->schedule[$counter][
'event'] = $event;
 
  311                $this->schedule[$counter][
'dstart'] = $event->getStart()->get(
IL_CAL_UNIX);
 
  312                $this->schedule[$counter][
'dend'] = $event->getEnd()->get(
IL_CAL_UNIX);
 
  313                $this->schedule[$counter][
'fullday'] = $event->isFullday();
 
  314                $this->schedule[$counter][
'category_id'] = $cat_map[$event->getEntryId()];
 
  315                $this->schedule[$counter][
'category_type'] = $cat_types[$cat_map[$event->getEntryId()]];
 
  317                if (!$event->isFullday()) {
 
  318                    switch ($this->type) {
 
  323                            $this->schedule[$counter][
'start_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE, 
'', $this->timezone);
 
  326                            $this->schedule[$counter][
'end_info'] = $tmp_date->get(
IL_CAL_FKT_GETDATE, 
'', $this->timezone);
 
  334                if ($this->type != self::TYPE_PD_UPCOMING &&
 
  341        if ($this->type == self::TYPE_PD_UPCOMING) {
 
  344                $this->schedule = array_slice($this->schedule, 0, $this->
getEventsLimit());
 
  356        if (!
sizeof($a_cats)) {
 
  360        foreach ($this->filters as $filter) {
 
  361            if (
sizeof($a_cats)) {
 
  362                $a_cats = $filter->filterCategories($a_cats);
 
  371        foreach ($this->filters as $filter) {
 
  372            $res = $filter->modifyEvent($event);
 
  374                $this->logger->info(
'filtering failed for ' . get_class($filter));
 
  384        $new_events = array();
 
  385        foreach ($this->filters as $filter) {
 
  386            $events_by_filter = $filter->addCustomEvents(
$start, 
$end, $categories);
 
  387            if ($events_by_filter) {
 
  388                $new_events = array_merge($new_events, $events_by_filter);
 
  408        include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
 
  419        $query = 
"SELECT ce.cal_id cal_id FROM cal_entries ce  " .
 
  420            "JOIN cal_cat_assignments ca ON ca.cal_id = ce.cal_id " .
 
  422            "AND " . 
$ilDB->in(
'ca.cat_id', $cats, 
false, 
'integer') . 
' ' .
 
  423            "ORDER BY last_update";
 
  434        foreach ($this->
addCustomEvents($this->start, $this->end, $cats) as $event) {
 
  453        include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
 
  462        $query = 
"SELECT ce.cal_id cal_id" .
 
  463            " FROM cal_entries ce" .
 
  464            " LEFT JOIN cal_recurrence_rules crr ON (ce.cal_id = crr.cal_id)" .
 
  465            " JOIN cal_cat_assignments ca ON (ca.cal_id = ce.cal_id)";
 
  467        if ($this->type != self::TYPE_INBOX) {
 
  468            $query .= 
" WHERE ((starta <= " . $this->db->quote($this->end->get(
IL_CAL_DATETIME, 
'', 
'UTC'), 
'timestamp') .
 
  469                " AND enda >= " . $this->db->quote($this->start->get(
IL_CAL_DATETIME, 
'', 
'UTC'), 
'timestamp') . 
")" .
 
  470                " OR (starta <= " . $this->db->quote($this->end->get(
IL_CAL_DATETIME, 
'', 
'UTC'), 
'timestamp') .
 
  471                " AND NOT rule_id IS NULL))";
 
  474            $query .= 
" WHERE starta >= " . $this->db->quote($date->get(
IL_CAL_DATETIME, 
'', 
'UTC'), 
'timestamp');
 
  477        $query .= 
" AND " . 
$ilDB->in(
'ca.cat_id', $cats, 
false, 
'integer') .
 
  491        foreach ($this->
addCustomEvents($this->start, $this->end, $cats) as $event) {
 
  507        switch ($this->type) {
 
  509                $this->start = clone $seed;
 
  510                $this->end = clone $seed;
 
  512                if (!$this->strict_period) {
 
  522                $this->start = clone $seed;
 
  524                $day_diff = $this->weekstart - $start_info[
'isoday'];
 
  526                if ($day_diff == 7) {
 
  531                if ($this->strict_period) {
 
  532                    $this->start->increment(
IL_CAL_DAY, $day_diff);
 
  536                    $this->start->increment(
IL_CAL_DAY, $day_diff);
 
  544                if ($this->strict_period) {
 
  545                    $this->start = clone $seed;
 
  546                    $this->end = clone $seed;
 
  550                    list($year, $month) = explode(
'-', $year_month);
 
  555                    $start_unix_time = $this->start->getUnixTime();
 
  557                    $start_day_of_week = (int) date(
'w', $start_unix_time);
 
  559                    $number_days_previous_month = 0;
 
  562                        $number_days_previous_month = 6;
 
  563                    } elseif ($start_day_of_week > 0) {
 
  564                        $number_days_previous_month = $start_day_of_week;
 
  567                            $number_days_previous_month = $start_day_of_week - 1;
 
  571                    $this->start->increment(
IL_CAL_DAY, -$number_days_previous_month);
 
  576                    $end_unix_time = $this->end->getUnixTime();
 
  578                    $end_day_of_week = (int) date(
'w', $end_unix_time);
 
  580                    if ($end_day_of_week > 0) {
 
  581                        $number_days_next_month = 7 - $end_day_of_week;
 
  584                            $number_days_next_month = $number_days_next_month - 1;
 
  587                        $this->end->increment(
IL_CAL_DAY, $number_days_next_month);
 
  594                $this->start = clone $seed;
 
  601                $this->start = $seed;
 
  618        $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.
foreach($_POST as $key=> $value) $res