ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 // portfolio does custom filter handling (booking group ids)
115 // consultation hour calendar views do not mind calendar category visibility
117 // this is the "default" filter which handles currently hidden categories for the user
118 $this->addFilter(new ilCalendarScheduleFilterHidden($this->user->getId()));
119 } else {
120 // handle booking visibility (target object, booked out)
121 //this filter deals with consultation hours
122 $this->addFilter(new ilCalendarScheduleFilterBookings($this->user->getId()));
123 }
124
126 //this filter deals with booking pool reservations
127 $this->addFilter(new ilCalendarScheduleFilterBookingPool($this->user->getId()));
128 }
129
130 $this->addFilter(new ilCalendarScheduleFilterExercise($this->user->getId()));
131 $this->addFilter(new ilCalendarScheduleFilterTimings($this->user->getId()));
132 }
133 }
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 $DIC
Definition: saml.php:7
global $ilDB
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92

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 382 of file class.ilCalendarSchedule.php.

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

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 186 of file class.ilCalendarSchedule.php.

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

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 167 of file class.ilCalendarSchedule.php.

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

◆ areEventsLimited()

ilCalendarSchedule::areEventsLimited ( )
protected

Check if events are limited.

Returns
type

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

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

Referenced by calculate().

+ Here is the caller graph for this function:

◆ calculate()

ilCalendarSchedule::calculate ( )

calculate

@access protected

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

249 {
250 $events = $this->getEvents();
251
252 // we need category type for booking handling
253 $ids = array();
254 foreach ($events as $event) {
255 $ids[] = $event->getEntryId();
256 }
257
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) {
263 $cat = new ilCalendarCategory($cat_id);
264 $cat_types[$cat_id] = $cat->getType();
265 }
266
267 $counter = 0;
268 foreach ($events as $event) {
269 // Calculdate recurring events
270 include_once('Services/Calendar/classes/class.ilCalendarRecurrences.php');
271 if ($recs = ilCalendarRecurrences::_getRecurrences($event->getEntryId())) {
272 $duration = $event->getEnd()->get(IL_CAL_UNIX) - $event->getStart()->get(IL_CAL_UNIX);
273 foreach ($recs as $rec) {
274 $calc = new ilCalendarRecurrenceCalculator($event, $rec);
275 foreach ($calc->calculateDateList($this->start, $this->end)->get() as $rec_date) {
276 if ($this->type == self::TYPE_PD_UPCOMING &&
277 $rec_date->get(IL_CAL_UNIX) < time()) {
278 continue;
279 }
280
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()]];
287
288 switch ($this->type) {
289 case self::TYPE_DAY:
290 case self::TYPE_WEEK:
291 // store date info (used for calculation of overlapping events)
292 $tmp_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone);
293 $this->schedule[$counter]['start_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
294
295 $tmp_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone);
296 $this->schedule[$counter]['end_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
297 break;
298
299 default:
300 break;
301 }
302 $counter++;
303 if ($this->type != self::TYPE_PD_UPCOMING &&
304 $this->areEventsLimited() && $counter >= $this->getEventsLimit()) {
305 break;
306 }
307 }
308 }
309 } else {
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()]];
316
317 if (!$event->isFullday()) {
318 switch ($this->type) {
319 case self::TYPE_DAY:
320 case self::TYPE_WEEK:
321 // store date info (used for calculation of overlapping events)
322 $tmp_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone);
323 $this->schedule[$counter]['start_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
324
325 $tmp_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone);
326 $this->schedule[$counter]['end_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
327 break;
328
329 default:
330 break;
331 }
332 }
333 $counter++;
334 if ($this->type != self::TYPE_PD_UPCOMING &&
335 $this->areEventsLimited() && $counter >= $this->getEventsLimit()) {
336 break;
337 }
338 }
339 }
340
341 if ($this->type == self::TYPE_PD_UPCOMING) {
342 $this->schedule = ilUtil::sortArray($this->schedule, "dstart", "asc", true);
343 if ($this->areEventsLimited() && sizeof($this->schedule) >= $this->getEventsLimit()) {
344 $this->schedule = array_slice($this->schedule, 0, $this->getEventsLimit());
345 }
346 }
347 }
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
if($argc< 2) $events

References $events, 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 176 of file class.ilCalendarSchedule.php.

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

References $subitems_enabled.

Referenced by getEvents().

+ Here is the caller graph for this function:

◆ filterCategories()

ilCalendarSchedule::filterCategories ( array  $a_cats)
protected

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

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

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 198 of file class.ilCalendarSchedule.php.

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

References $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 402 of file class.ilCalendarSchedule.php.

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

References $DIC, $events, $ilDB, $query, $res, $row, $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 447 of file class.ilCalendarSchedule.php.

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

References $DIC, $events, $ilDB, $query, $res, $row, 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 148 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 349 of file class.ilCalendarSchedule.php.

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

References $schedule.

◆ initPeriod()

ilCalendarSchedule::initPeriod ( ilDate  $seed)
protected

init period of events

@access protected

Parameters
ilDateseed
Returns

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

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

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

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 157 of file class.ilCalendarSchedule.php.

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

◆ setPeriod()

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

Set period.

Parameters
ilDatestart
ilDateend
Returns

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

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

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: