ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCalendarSchedule Class Reference

Represents a list of calendar appointments (including recurring events) for a specific user in a given time range. More...

+ Collaboration diagram for ilCalendarSchedule:

Public Member Functions

 __construct (ilDate $seed, $a_type, $a_user_id=0, $a_strict_period=false)
 Constructor. More...
 
 getEventsLimit ()
 get current limit of events More...
 
 setEventsLimit ($a_limit)
 Set events limit. More...
 
 addSubitemCalendars ($a_status)
 Enable subitem calendars (session calendars for courses) More...
 
 enabledSubitemCalendars ()
 Are subitem calendars enabled. More...
 
 addFilter (ilCalendarScheduleFilter $a_filter)
 Add filter. More...
 
 getByDay (ilDate $a_start, $a_timezone)
 get byday More...
 
 calculate ()
 calculate More...
 
 getScheduledEvents ()
 
 getChangedEvents ($a_include_subitem_calendars=false)
 get new/changed events More...
 
 getEvents ()
 Read events (will be moved to another class, since only active and/or visible calendars are shown) More...
 
 setPeriod (ilDate $a_start, ilDate $a_end)
 Set period. More...
 

Data Fields

const TYPE_DAY = 1
 
const TYPE_WEEK = 2
 
const TYPE_MONTH = 3
 
const TYPE_INBOX = 4
 
const TYPE_HALF_YEAR = 6
 
const TYPE_PD_UPCOMING = 5
 

Protected Member Functions

 areEventsLimited ()
 Check if events are limited. More...
 
 filterCategories (array $a_cats)
 
 modifyEventByFilters (ilCalendarEntry $event)
 
 addCustomEvents (ilDate $start, ilDate $end, array $categories)
 
 initPeriod (ilDate $seed)
 init period of events More...
 

Protected Attributes

 $limit_events = -1
 
 $schedule = array()
 
 $timezone
 
 $weekstart
 
 $type = 0
 
 $subitems_enabled = false
 
 $start = null
 
 $end = null
 
 $user = null
 
 $user_settings = null
 
 $db = null
 
 $filters = array()
 
 $strict_period
 
 $logger
 

Detailed Description

Represents a list of calendar appointments (including recurring events) for a specific user in a given time range.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 36 of file class.ilCalendarSchedule.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarSchedule::__construct ( ilDate  $seed,
  $a_type,
  $a_user_id = 0,
  $a_strict_period = false 
)

Constructor.

@access public

Parameters
ilDateseed date
inttype of schedule (TYPE_DAY,TYPE_WEEK or TYPE_MONTH)
intuser_id
boolstrict_period true if no extra days needed.

Definition at line 82 of file class.ilCalendarSchedule.php.

83 {
84 global $DIC;
85
86 $ilUser = $DIC['ilUser'];
87 $ilDB = $DIC['ilDB'];
88
89 $this->logger = $DIC->logger()->cal();
90
91 $this->db = $ilDB;
92
93 $this->type = $a_type;
94
95 //this strict period is just to avoid possible side effects.
96 //I there are none, we can get rid of this strict period control and remove it from the constructor
97 //and from the calls in ilCalendarView getEvents.
98 $this->strict_period = $a_strict_period;
99
100 if (!$a_user_id || $a_user_id == $ilUser->getId()) {
101 $this->user = $ilUser;
102 } else {
103 $this->user = new ilObjUser($a_user_id);
104 }
105 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
106 $this->weekstart = $this->user_settings->getWeekStart();
107 $this->timezone = $this->user->getTimeZone();
108
109 $this->initPeriod($seed);
110
111
112 // category / event filters
113
114 // portfolio does custom filter handling (booking group ids)
116 // consultation hour calendar views do not mind calendar category visibility
118 // this is the "default" filter which handles currently hidden categories for the user
119 $this->addFilter(new ilCalendarScheduleFilterHidden($this->user->getId()));
120 } else {
121 // handle booking visibility (target object, booked out)
122 //this filter deals with consultation hours
123 $this->addFilter(new ilCalendarScheduleFilterBookings($this->user->getId()));
124 }
125
127 //this filter deals with booking pool reservations
128 $this->addFilter(new ilCalendarScheduleFilterBookingPool($this->user->getId()));
129 }
130
131 $this->addFilter(new ilCalendarScheduleFilterExercise($this->user->getId()));
132 $this->addFilter(new ilCalendarScheduleFilterTimings($this->user->getId()));
133 }
134 }
user()
Definition: user.php:4
static _getInstance($a_usr_id=0)
get singleton instance
Calendar schedule filter for booking pool reservations.
Calendar schedule filter for consultation hour bookings.
Calendar schedule filter for hidden categories.
Calendar schedule filter for individual timings.
addFilter(ilCalendarScheduleFilter $a_filter)
Add filter.
initPeriod(ilDate $seed)
init period of events
static _getInstanceByUserId($a_user_id)
get singleton instance
global $ilDB
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46

References $a_type, $DIC, $ilDB, $ilUser, ilCalendarCategories\_getInstance(), ilCalendarUserSettings\_getInstanceByUserId(), addFilter(), initPeriod(), ilCalendarCategories\MODE_CONSULTATION, ilCalendarCategories\MODE_PERSONAL_DESKTOP_MEMBERSHIP, ilCalendarCategories\MODE_PORTFOLIO_CONSULTATION, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomEvents()

ilCalendarSchedule::addCustomEvents ( ilDate  $start,
ilDate  $end,
array  $categories 
)
protected

Definition at line 383 of file class.ilCalendarSchedule.php.

384 {
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);
390 }
391 }
392 return $new_events;
393 }

References $end, and $start.

Referenced by getChangedEvents(), and getEvents().

+ Here is the caller graph for this function:

◆ addFilter()

ilCalendarSchedule::addFilter ( ilCalendarScheduleFilter  $a_filter)

Add filter.

Parameters
ilCalendarScheduleFilter$a_filter

Definition at line 187 of file class.ilCalendarSchedule.php.

188 {
189 $this->filters[] = $a_filter;
190 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ addSubitemCalendars()

ilCalendarSchedule::addSubitemCalendars (   $a_status)

Enable subitem calendars (session calendars for courses)

Parameters

return

Definition at line 168 of file class.ilCalendarSchedule.php.

169 {
170 $this->subitems_enabled = $a_status;
171 }

◆ areEventsLimited()

ilCalendarSchedule::areEventsLimited ( )
protected

Check if events are limited.

Returns
type

Definition at line 140 of file class.ilCalendarSchedule.php.

141 {
142 return $this->limit_events != -1;
143 }

Referenced by calculate().

+ Here is the caller graph for this function:

◆ calculate()

ilCalendarSchedule::calculate ( )

calculate

@access protected

Definition at line 249 of file class.ilCalendarSchedule.php.

250 {
251 $events = $this->getEvents();
252
253 // we need category type for booking handling
254 $ids = array();
255 foreach ($events as $event) {
256 $ids[] = $event->getEntryId();
257 }
258
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) {
264 $cat = new ilCalendarCategory($cat_id);
265 $cat_types[$cat_id] = $cat->getType();
266 }
267
268 $counter = 0;
269 foreach ($events as $event) {
270 // Calculdate recurring events
271 include_once('Services/Calendar/classes/class.ilCalendarRecurrences.php');
272 if ($recs = ilCalendarRecurrences::_getRecurrences($event->getEntryId())) {
273 $duration = $event->getEnd()->get(IL_CAL_UNIX) - $event->getStart()->get(IL_CAL_UNIX);
274 foreach ($recs as $rec) {
275 $calc = new ilCalendarRecurrenceCalculator($event, $rec);
276 foreach ($calc->calculateDateList($this->start, $this->end)->get() as $rec_date) {
277 if ($this->type == self::TYPE_PD_UPCOMING &&
278 $rec_date->get(IL_CAL_UNIX) < time()) {
279 continue;
280 }
281
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()]];
288
289 switch ($this->type) {
290 case self::TYPE_DAY:
291 case self::TYPE_WEEK:
292 // store date info (used for calculation of overlapping events)
293 $tmp_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone);
294 $this->schedule[$counter]['start_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
295
296 $tmp_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone);
297 $this->schedule[$counter]['end_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
298 break;
299
300 default:
301 break;
302 }
303 $counter++;
304 if ($this->type != self::TYPE_PD_UPCOMING &&
305 $this->areEventsLimited() && $counter >= $this->getEventsLimit()) {
306 break;
307 }
308 }
309 }
310 } else {
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()]];
317
318 if (!$event->isFullday()) {
319 switch ($this->type) {
320 case self::TYPE_DAY:
321 case self::TYPE_WEEK:
322 // store date info (used for calculation of overlapping events)
323 $tmp_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone);
324 $this->schedule[$counter]['start_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
325
326 $tmp_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone);
327 $this->schedule[$counter]['end_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
328 break;
329
330 default:
331 break;
332 }
333 }
334 $counter++;
335 if ($this->type != self::TYPE_PD_UPCOMING &&
336 $this->areEventsLimited() && $counter >= $this->getEventsLimit()) {
337 break;
338 }
339 }
340 }
341
342 if ($this->type == self::TYPE_PD_UPCOMING) {
343 $this->schedule = ilUtil::sortArray($this->schedule, "dstart", "asc", true);
344 if ($this->areEventsLimited() && sizeof($this->schedule) >= $this->getEventsLimit()) {
345 $this->schedule = array_slice($this->schedule, 0, $this->getEventsLimit());
346 }
347 }
348 }
const IL_CAL_FKT_GETDATE
const IL_CAL_UNIX
static _getAppointmentCalendars($a_cal_ids)
lookup calendars for appointment ids
Stores calendar categories.
Calculates an ilDateList for a given calendar entry and recurrence rule.
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
areEventsLimited()
Check if events are limited.
getEvents()
Read events (will be moved to another class, since only active and/or visible calendars are shown)
getEventsLimit()
get current limit of events
@classDescription Date and time handling
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

References ilCalendarCategoryAssignments\_getAppointmentCalendars(), ilCalendarRecurrences\_getRecurrences(), areEventsLimited(), getEvents(), getEventsLimit(), IL_CAL_FKT_GETDATE, IL_CAL_UNIX, ilUtil\sortArray(), TYPE_DAY, and TYPE_WEEK.

+ Here is the call graph for this function:

◆ enabledSubitemCalendars()

ilCalendarSchedule::enabledSubitemCalendars ( )

Are subitem calendars enabled.

Returns

Definition at line 177 of file class.ilCalendarSchedule.php.

178 {
179 return (bool) $this->subitems_enabled;
180 }

References $subitems_enabled.

Referenced by getEvents().

+ Here is the caller graph for this function:

◆ filterCategories()

ilCalendarSchedule::filterCategories ( array  $a_cats)
protected

Definition at line 355 of file class.ilCalendarSchedule.php.

356 {
357 if (!sizeof($a_cats)) {
358 return $a_cats;
359 }
360
361 foreach ($this->filters as $filter) {
362 if (sizeof($a_cats)) {
363 $a_cats = $filter->filterCategories($a_cats);
364 }
365 }
366
367 return $a_cats;
368 }

Referenced by getChangedEvents(), and getEvents().

+ Here is the caller graph for this function:

◆ getByDay()

ilCalendarSchedule::getByDay ( ilDate  $a_start,
  $a_timezone 
)

get byday

@access public

Parameters
ilDatestart

Definition at line 199 of file class.ilCalendarSchedule.php.

200 {
201 $start = new ilDateTime($a_start->get(IL_CAL_DATETIME), IL_CAL_DATETIME, $this->timezone);
202 $fstart = new ilDate($a_start->get(IL_CAL_UNIX), IL_CAL_UNIX);
203 $fend = clone $fstart;
204
205 $f_unix_start = $fstart->get(IL_CAL_UNIX);
206 $fend->increment(ilDateTime::DAY, 1);
207 $f_unix_end = $fend->get(IL_CAL_UNIX);
208
209 $unix_start = $start->get(IL_CAL_UNIX);
210 $start->increment(ilDateTime::DAY, 1);
211 $unix_end = $start->get(IL_CAL_UNIX);
212
213 $counter = 0;
214
215 $tmp_date = new ilDateTime($unix_start, IL_CAL_UNIX, $this->timezone);
216 $tmp_schedule = array();
217 $tmp_schedule_fullday = array();
218 foreach ($this->schedule as $schedule) {
219 if ($schedule['fullday']) {
220 if (($f_unix_start == $schedule['dstart']) or
221 $f_unix_start == $schedule['dend'] or
222 ($f_unix_start > $schedule['dstart'] and $f_unix_end <= $schedule['dend'])) {
223 $tmp_schedule_fullday[] = $schedule;
224 }
225 } elseif (($schedule['dstart'] == $unix_start) or
226 (($schedule['dstart'] <= $unix_start) and ($schedule['dend'] > $unix_start)) or
227 (($schedule['dstart'] >= $unix_start) and ($schedule['dstart'] < $unix_end))) {
228 $tmp_schedule[] = $schedule;
229 }
230 }
231
232 //order non full day events by starting date;
233 usort($tmp_schedule, function ($a, $b) {
234 return $a['dstart'] <=> $b['dstart'];
235 });
236
237 //merge both arrays keeping the full day events first and then rest ordered by starting date.
238 $schedules = array_merge($tmp_schedule_fullday, $tmp_schedule);
239
240 return $schedules;
241 }
const IL_CAL_DATETIME
Class for single dates.
get($a_format, $a_format_str='', $a_tz='')
get formatted date
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, $schedule, $start, ilDateTime\DAY, ilDate\get(), IL_CAL_DATETIME, and IL_CAL_UNIX.

+ Here is the call graph for this function:

◆ getChangedEvents()

ilCalendarSchedule::getChangedEvents (   $a_include_subitem_calendars = false)

get new/changed events

Parameters
bool$a_include_subitem_calendarsE.g include session calendars of courses.
Returns
object $events[] Array of changed events @access protected

Definition at line 403 of file class.ilCalendarSchedule.php.

404 {
405 global $DIC;
406
407 $ilDB = $DIC['ilDB'];
408
409 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
410 $cats = ilCalendarCategories::_getInstance($this->user->getId())->getCategories($a_include_subitem_calendars);
411 $cats = $this->filterCategories($cats);
412
413 if (!count($cats)) {
414 return array();
415 }
416
417 $start = new ilDate(date('Y-m-d', time()), IL_CAL_DATE);
418 $start->increment(IL_CAL_MONTH, -1);
419
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 " .
422 "WHERE last_update > " . $ilDB->quote($start->get(IL_CAL_DATETIME), 'timestamp') . " " .
423 "AND " . $ilDB->in('ca.cat_id', $cats, false, 'integer') . ' ' .
424 "ORDER BY last_update";
425 $res = $this->db->query($query);
426
427 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
428 $event = new ilCalendarEntry($row->cal_id);
429 $valid_event = $this->modifyEventByFilters($event);
430 if ($valid_event) {
431 $events[] = $valid_event;
432 }
433 }
434
435 foreach ($this->addCustomEvents($this->start, $this->end, $cats) as $event) {
436 $events[] = $event;
437 }
438
439 return $events ? $events : array();
440 }
const IL_CAL_DATE
const IL_CAL_MONTH
Model for a calendar entry.
modifyEventByFilters(ilCalendarEntry $event)
addCustomEvents(ilDate $start, ilDate $end, array $categories)
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, $start, ilCalendarCategories\_getInstance(), addCustomEvents(), ilDBConstants\FETCHMODE_OBJECT, filterCategories(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_MONTH, modifyEventByFilters(), and user().

+ Here is the call graph for this function:

◆ getEvents()

ilCalendarSchedule::getEvents ( )

Read events (will be moved to another class, since only active and/or visible calendars are shown)

@access protected

Definition at line 448 of file class.ilCalendarSchedule.php.

449 {
450 global $DIC;
451
452 $ilDB = $DIC['ilDB'];
453
454 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
455 $cats = ilCalendarCategories::_getInstance($this->user->getId())->getCategories($this->enabledSubitemCalendars());
456 $cats = $this->filterCategories($cats);
457
458 if (!count($cats)) {
459 return array();
460 }
461
462 // TODO: optimize
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)";
467
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))";
473 } else {
474 $date = new ilDateTime(mktime(0, 0, 0), IL_CAL_UNIX);
475 $query .= " WHERE starta >= " . $this->db->quote($date->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp');
476 }
477
478 $query .= " AND " . $ilDB->in('ca.cat_id', $cats, false, 'integer') .
479 " ORDER BY starta";
480
481 $res = $this->db->query($query);
482
483 $events = array();
484 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
485 $event = new ilCalendarEntry($row->cal_id);
486 $valid_event = $this->modifyEventByFilters($event);
487 if ($valid_event) {
488 $events[] = $valid_event;
489 }
490 }
491
492 foreach ($this->addCustomEvents($this->start, $this->end, $cats) as $event) {
493 $events[] = $event;
494 }
495
496 return $events;
497 }
enabledSubitemCalendars()
Are subitem calendars enabled.

References $DIC, $ilDB, $query, $res, ilCalendarCategories\_getInstance(), addCustomEvents(), enabledSubitemCalendars(), ilDBConstants\FETCHMODE_OBJECT, filterCategories(), IL_CAL_DATETIME, IL_CAL_UNIX, modifyEventByFilters(), and user().

Referenced by calculate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEventsLimit()

ilCalendarSchedule::getEventsLimit ( )

get current limit of events

Returns
type

Definition at line 149 of file class.ilCalendarSchedule.php.

References $limit_events.

Referenced by calculate().

+ Here is the caller graph for this function:

◆ getScheduledEvents()

ilCalendarSchedule::getScheduledEvents ( )

Definition at line 350 of file class.ilCalendarSchedule.php.

351 {
352 return (array) $this->schedule;
353 }

References $schedule.

◆ initPeriod()

ilCalendarSchedule::initPeriod ( ilDate  $seed)
protected

init period of events

@access protected

Parameters
ilDateseed
Returns

Definition at line 506 of file class.ilCalendarSchedule.php.

507 {
508 switch ($this->type) {
509 case self::TYPE_DAY:
510 $this->start = clone $seed;
511 $this->end = clone $seed;
512 //this strict period is just to avoid possible side effects.
513 if (!$this->strict_period) {
514 $this->start->increment(IL_CAL_DAY, -2);
515 $this->end->increment(IL_CAL_DAY, 2);
516 } else {
517 $this->end->increment(IL_CAL_DAY, 1);
518 $this->end->increment(IL_CAL_SECOND, -1);
519 }
520 break;
521
522 case self::TYPE_WEEK:
523 $this->start = clone $seed;
524 $start_info = $this->start->get(IL_CAL_FKT_GETDATE, '', 'UTC');
525 $day_diff = $this->weekstart - $start_info['isoday'];
526
527 if ($day_diff == 7) {
528 $day_diff = 0;
529 }
530
531 //this strict period is just to avoid possible side effects.
532 if ($this->strict_period) {
533 $this->start->increment(IL_CAL_DAY, $day_diff);
534 $this->end = clone $this->start;
535 $this->end->increment(IL_CAL_WEEK); #22173
536 } else {
537 $this->start->increment(IL_CAL_DAY, $day_diff);
538 $this->start->increment(IL_CAL_DAY, -1);
539 $this->end = clone $this->start;
540 $this->end->increment(IL_CAL_DAY, 9);
541 }
542 break;
543
544 case self::TYPE_MONTH:
545 if ($this->strict_period) {
546 $this->start = clone $seed;
547 $this->end = clone $seed;
548 $this->end->increment(IL_CAL_MONTH, 1);
549 } else {
550 $year_month = $seed->get(IL_CAL_FKT_DATE, 'Y-m', 'UTC');
551 list($year, $month) = explode('-', $year_month);
552
553 #21716
554 $this->start = new ilDate($year_month . '-01', IL_CAL_DATE);
555
556 $start_unix_time = $this->start->getUnixTime();
557
558 $start_day_of_week = (int) date('w', $start_unix_time);
559
560 $number_days_previous_month = 0;
561
562 if ($start_day_of_week === 0 && $this->weekstart === ilCalendarSettings::WEEK_START_MONDAY) {
563 $number_days_previous_month = 6;
564 } elseif ($start_day_of_week > 0) {
565 $number_days_previous_month = $start_day_of_week;
566
567 if ($this->weekstart === ilCalendarSettings::WEEK_START_MONDAY) {
568 $number_days_previous_month = $start_day_of_week - 1;
569 }
570 }
571
572 $this->start->increment(IL_CAL_DAY, -$number_days_previous_month);
573
574 #21716
575 $this->end = new ilDate($year_month . '-' . ilCalendarUtil::_getMaxDayOfMonth($year, $month), IL_CAL_DATE);
576
577 $end_unix_time = $this->end->getUnixTime();
578
579 $end_day_of_week = (int) date('w', $end_unix_time);
580
581 if ($end_day_of_week > 0) {
582 $number_days_next_month = 7 - $end_day_of_week;
583
584 if ($this->weekstart == ilCalendarSettings::WEEK_START_SUNDAY) {
585 $number_days_next_month = $number_days_next_month - 1;
586 }
587
588 $this->end->increment(IL_CAL_DAY, $number_days_next_month);
589 }
590 }
591
592 break;
593
595 $this->start = clone $seed;
596 $this->end = clone $this->start;
597 $this->end->increment(IL_CAL_MONTH, 6);
598 break;
599
601 case self::TYPE_INBOX:
602 $this->start = $seed;
603 $this->end = clone $this->start;
604 $this->end->increment(IL_CAL_MONTH, 12);
605 break;
606 }
607
608 return true;
609 }
const IL_CAL_WEEK
const IL_CAL_FKT_DATE
const IL_CAL_DAY
const IL_CAL_SECOND
static _getMaxDayOfMonth($a_year, $a_month)
get max day of month 2008,2 => 29
increment($a_type, $a_count=1)
increment

References $start, ilCalendarUtil\_getMaxDayOfMonth(), IL_CAL_DATE, IL_CAL_DAY, IL_CAL_FKT_DATE, IL_CAL_FKT_GETDATE, IL_CAL_MONTH, IL_CAL_SECOND, IL_CAL_WEEK, ilDateTime\increment(), TYPE_DAY, TYPE_HALF_YEAR, TYPE_INBOX, TYPE_MONTH, TYPE_PD_UPCOMING, TYPE_WEEK, ilCalendarSettings\WEEK_START_MONDAY, and ilCalendarSettings\WEEK_START_SUNDAY.

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modifyEventByFilters()

ilCalendarSchedule::modifyEventByFilters ( ilCalendarEntry  $event)
protected

Definition at line 370 of file class.ilCalendarSchedule.php.

371 {
372 foreach ($this->filters as $filter) {
373 $res = $filter->modifyEvent($event);
374 if (!$res) {
375 $this->logger->info('filtering failed for ' . get_class($filter));
376 return false;
377 }
378 $event = $res;
379 }
380 return $event;
381 }

References $res.

Referenced by getChangedEvents(), and getEvents().

+ Here is the caller graph for this function:

◆ setEventsLimit()

ilCalendarSchedule::setEventsLimit (   $a_limit)

Set events limit.

Parameters
type$a_limit

Definition at line 158 of file class.ilCalendarSchedule.php.

159 {
160 $this->limit_events = $a_limit;
161 }

◆ setPeriod()

ilCalendarSchedule::setPeriod ( ilDate  $a_start,
ilDate  $a_end 
)

Set period.

Parameters
ilDatestart
ilDateend
Returns

Definition at line 617 of file class.ilCalendarSchedule.php.

618 {
619 $this->start = $a_start;
620 $this->end = $a_end;
621 }

Field Documentation

◆ $db

ilCalendarSchedule::$db = null
protected

Definition at line 59 of file class.ilCalendarSchedule.php.

◆ $end

ilCalendarSchedule::$end = null
protected

Definition at line 56 of file class.ilCalendarSchedule.php.

Referenced by addCustomEvents().

◆ $filters

ilCalendarSchedule::$filters = array()
protected

Definition at line 60 of file class.ilCalendarSchedule.php.

◆ $limit_events

ilCalendarSchedule::$limit_events = -1
protected

Definition at line 47 of file class.ilCalendarSchedule.php.

Referenced by getEventsLimit().

◆ $logger

ilCalendarSchedule::$logger
protected

Definition at line 70 of file class.ilCalendarSchedule.php.

◆ $schedule

ilCalendarSchedule::$schedule = array()
protected

Definition at line 48 of file class.ilCalendarSchedule.php.

Referenced by getByDay(), and getScheduledEvents().

◆ $start

ilCalendarSchedule::$start = null
protected

◆ $strict_period

ilCalendarSchedule::$strict_period
protected

Definition at line 65 of file class.ilCalendarSchedule.php.

◆ $subitems_enabled

ilCalendarSchedule::$subitems_enabled = false
protected

Definition at line 53 of file class.ilCalendarSchedule.php.

Referenced by enabledSubitemCalendars().

◆ $timezone

ilCalendarSchedule::$timezone
protected

Definition at line 49 of file class.ilCalendarSchedule.php.

◆ $type

ilCalendarSchedule::$type = 0
protected

Definition at line 51 of file class.ilCalendarSchedule.php.

◆ $user

ilCalendarSchedule::$user = null
protected

Definition at line 57 of file class.ilCalendarSchedule.php.

◆ $user_settings

ilCalendarSchedule::$user_settings = null
protected

Definition at line 58 of file class.ilCalendarSchedule.php.

◆ $weekstart

ilCalendarSchedule::$weekstart
protected

Definition at line 50 of file class.ilCalendarSchedule.php.

◆ TYPE_DAY

const ilCalendarSchedule::TYPE_DAY = 1

Definition at line 38 of file class.ilCalendarSchedule.php.

Referenced by calculate(), ilCalendarViewGUI\getEvents(), and initPeriod().

◆ TYPE_HALF_YEAR

const ilCalendarSchedule::TYPE_HALF_YEAR = 6

Definition at line 42 of file class.ilCalendarSchedule.php.

Referenced by ilCalendarViewGUI\getEvents(), and initPeriod().

◆ TYPE_INBOX

const ilCalendarSchedule::TYPE_INBOX = 4

Definition at line 41 of file class.ilCalendarSchedule.php.

Referenced by ilCalendarBlockGUI\getOverview(), and initPeriod().

◆ TYPE_MONTH

const ilCalendarSchedule::TYPE_MONTH = 3

◆ TYPE_PD_UPCOMING

const ilCalendarSchedule::TYPE_PD_UPCOMING = 5

Definition at line 45 of file class.ilCalendarSchedule.php.

Referenced by ilCalendarBlockGUI\getEvents(), and initPeriod().

◆ TYPE_WEEK

const ilCalendarSchedule::TYPE_WEEK = 2

The documentation for this class was generated from the following file: