88 $this->strict_period = $a_strict_period;
90 if (!$a_user_id || $a_user_id == $ilUser->getId()) {
96 $this->weekstart = $this->user_settings->getWeekStart();
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();
209 if ($schedule[
'fullday']) {
210 if (($f_unix_start == $schedule[
'dstart']) or
211 $f_unix_start == $schedule[
'dend'] or
212 ($f_unix_start > $schedule[
'dstart'] and $f_unix_end <= $schedule[
'dend'])) {
215 } elseif (($schedule[
'dstart'] == $unix_start) or
216 (($schedule[
'dstart'] <= $unix_start) and ($schedule[
'dend'] > $unix_start)) or
217 (($schedule[
'dstart'] >= $unix_start) and ($schedule[
'dstart'] < $unix_end))) {
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) {
279 case self::TYPE_WEEK:
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) {
309 case self::TYPE_WEEK:
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) {
505 case self::TYPE_WEEK:
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);
527 case self::TYPE_MONTH:
528 if ($this->strict_period) {
529 $this->start = clone $seed;
530 $this->end = clone $seed;
535 list($year, $month) = explode(
'-', $year_month);
546 case self::TYPE_HALF_YEAR:
547 $this->start = clone $seed;
552 case self::TYPE_PD_UPCOMING:
553 case self::TYPE_INBOX:
554 $this->start = $seed;
571 $this->start = $a_start;
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
Model for a calendar entry.
__construct(ilDate $seed, $a_type, $a_user_id=0, $a_strict_period=false)
Constructor.
areEventsLimited()
Check if events are limited.
modifyEventByFilters(ilCalendarEntry $event)
getEventsLimit()
get current limit of events
Calendar schedule filter for consultation hour bookings.
setPeriod(ilDate $a_start, ilDate $a_end)
Set period.
const MODE_PERSONAL_DESKTOP_MEMBERSHIP
static _getInstanceByUserId($a_user_id)
get singleton instance
enabledSubitemCalendars()
Are subitem calendars enabled.
addSubitemCalendars($a_status)
Enable subitem calendars (session calendars for courses)
Stores calendar categories.
filterCategories(array $a_cats)
setEventsLimit($a_limit)
Set events limit.
getByDay(ilDate $a_start, $a_timezone)
get byday
get($a_format, $a_format_str='', $a_tz='')
get formatted date
static _getMaxDayOfMonth($a_year, $a_month)
get max day of month 2008,2 => 29
Calendar schedule filter for hidden categories.
Calendar schedule filter interface.
foreach($_POST as $key=> $value) $res
Calculates an ilDateList for a given calendar entry and recurrence rule.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Calendar schedule filter for exercises.
const MODE_PORTFOLIO_CONSULTATION
get($a_format, $a_format_str='', $a_tz='')
get formatted date
increment($a_type, $a_count=1)
increment
static _getInstance($a_usr_id=0)
get singleton instance
getEvents()
Read events (will be moved to another class, since only active and/or visible calendars are shown) ...
Create styles array
The data for the language used.
initPeriod(ilDate $seed)
init period of events
Calendar schedule filter for booking pool reservations.
addFilter(ilCalendarScheduleFilter $a_filter)
Add filter.
getChangedEvents($a_include_subitem_calendars=false)
get new/changed events
static getLogger($a_component_id)
Get component logger.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
addCustomEvents(ilDate $start, ilDate $end, array $categories)
Represents a list of calendar appointments (including recurring events) for a specific user in a give...
static _getAppointmentCalendars($a_cal_ids)
lookup calendars for appointment ids