ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 

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.

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

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

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

Member Function Documentation

◆ addCustomEvents()

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

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

References array.

Referenced by getChangedEvents(), and getEvents().

372  {
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);
378  }
379  }
380  return $new_events;
381  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ addFilter()

ilCalendarSchedule::addFilter ( ilCalendarScheduleFilter  $a_filter)

Add filter.

Parameters
ilCalendarScheduleFilter$a_filter

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

Referenced by __construct().

178  {
179  $this->filters[] = $a_filter;
180  }
+ Here is the caller graph for this function:

◆ addSubitemCalendars()

ilCalendarSchedule::addSubitemCalendars (   $a_status)

Enable subitem calendars (session calendars for courses)

Parameters

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

159  {
160  $this->subitems_enabled = $a_status;
161  }

◆ areEventsLimited()

ilCalendarSchedule::areEventsLimited ( )
protected

Check if events are limited.

Returns
type

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

Referenced by calculate().

131  {
132  return $this->limit_events != -1;
133  }
+ Here is the caller graph for this function:

◆ calculate()

ilCalendarSchedule::calculate ( )

calculate

protected

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

References $counter, ilCalendarCategoryAssignments\_getAppointmentCalendars(), ilCalendarRecurrences\_getRecurrences(), areEventsLimited(), array, getEvents(), getEventsLimit(), IL_CAL_FKT_GETDATE, IL_CAL_UNIX, ilUtil\sortArray(), time, and timezone.

238  {
239  $events = $this->getEvents();
240 
241  // we need category type for booking handling
242  $ids = array();
243  foreach ($events as $event) {
244  $ids[] = $event->getEntryId();
245  }
246 
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) {
252  $cat = new ilCalendarCategory($cat_id);
253  $cat_types[$cat_id] = $cat->getType();
254  }
255 
256  $counter = 0;
257  foreach ($events as $event) {
258  // Calculdate recurring events
259  include_once('Services/Calendar/classes/class.ilCalendarRecurrences.php');
260  if ($recs = ilCalendarRecurrences::_getRecurrences($event->getEntryId())) {
261  $duration = $event->getEnd()->get(IL_CAL_UNIX) - $event->getStart()->get(IL_CAL_UNIX);
262  foreach ($recs as $rec) {
263  $calc = new ilCalendarRecurrenceCalculator($event, $rec);
264  foreach ($calc->calculateDateList($this->start, $this->end)->get() as $rec_date) {
265  if ($this->type == self::TYPE_PD_UPCOMING &&
266  $rec_date->get(IL_CAL_UNIX) < time()) {
267  continue;
268  }
269 
270  $this->schedule[$counter]['event'] = $event;
271  $this->schedule[$counter]['dstart'] = $rec_date->get(IL_CAL_UNIX);
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()]];
276 
277  switch ($this->type) {
278  case self::TYPE_DAY:
279  case self::TYPE_WEEK:
280  // store date info (used for calculation of overlapping events)
281  $tmp_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone);
282  $this->schedule[$counter]['start_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
283 
284  $tmp_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone);
285  $this->schedule[$counter]['end_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
286  break;
287 
288  default:
289  break;
290  }
291  $counter++;
292  if ($this->type != self::TYPE_PD_UPCOMING &&
293  $this->areEventsLimited() && $counter >= $this->getEventsLimit()) {
294  break;
295  }
296  }
297  }
298  } else {
299  $this->schedule[$counter]['event'] = $event;
300  $this->schedule[$counter]['dstart'] = $event->getStart()->get(IL_CAL_UNIX);
301  $this->schedule[$counter]['dend'] = $event->getEnd()->get(IL_CAL_UNIX);
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()]];
305 
306  if (!$event->isFullday()) {
307  switch ($this->type) {
308  case self::TYPE_DAY:
309  case self::TYPE_WEEK:
310  // store date info (used for calculation of overlapping events)
311  $tmp_date = new ilDateTime($this->schedule[$counter]['dstart'], IL_CAL_UNIX, $this->timezone);
312  $this->schedule[$counter]['start_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
313 
314  $tmp_date = new ilDateTime($this->schedule[$counter]['dend'], IL_CAL_UNIX, $this->timezone);
315  $this->schedule[$counter]['end_info'] = $tmp_date->get(IL_CAL_FKT_GETDATE, '', $this->timezone);
316  break;
317 
318  default:
319  break;
320  }
321  }
322  $counter++;
323  if ($this->type != self::TYPE_PD_UPCOMING &&
324  $this->areEventsLimited() && $counter >= $this->getEventsLimit()) {
325  break;
326  }
327  }
328  }
329 
330  if ($this->type == self::TYPE_PD_UPCOMING) {
331  $this->schedule = ilUtil::sortArray($this->schedule, "dstart", "asc", true);
332  if ($this->areEventsLimited() && sizeof($this->schedule) >= $this->getEventsLimit()) {
333  $this->schedule = array_slice($this->schedule, 0, $this->getEventsLimit());
334  }
335  }
336  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
Set timezone
static _getRecurrences($a_cal_id)
get all recurrences of an appointment
areEventsLimited()
Check if events are limited.
getEventsLimit()
get current limit of events
Stores calendar categories.
const IL_CAL_UNIX
$counter
Calculates an ilDateList for a given calendar entry and recurrence rule.
Date and time handling
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.
const IL_CAL_FKT_GETDATE
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static _getAppointmentCalendars($a_cal_ids)
lookup calendars for appointment ids
+ Here is the call graph for this function:

◆ enabledSubitemCalendars()

ilCalendarSchedule::enabledSubitemCalendars ( )

Are subitem calendars enabled.

Returns

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

References $subitems_enabled.

Referenced by getEvents().

168  {
169  return (bool) $this->subitems_enabled;
170  }
+ Here is the caller graph for this function:

◆ filterCategories()

ilCalendarSchedule::filterCategories ( array  $a_cats)
protected

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

Referenced by getChangedEvents(), and getEvents().

344  {
345  if (!sizeof($a_cats)) {
346  return $a_cats;
347  }
348 
349  foreach ($this->filters as $filter) {
350  if (sizeof($a_cats)) {
351  $a_cats = $filter->filterCategories($a_cats);
352  }
353  }
354 
355  return $a_cats;
356  }
+ Here is the caller graph for this function:

◆ getByDay()

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

get byday

public

Parameters
ilDatestart

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

References $counter, $schedule, $start, $timezone, array, ilDateTime\DAY, ilDate\get(), ilDateTime\get(), IL_CAL_DATETIME, IL_CAL_UNIX, ilDateTime\increment(), and timezone.

190  {
192  $fstart = new ilDate($a_start->get(IL_CAL_UNIX), IL_CAL_UNIX);
193  $fend = clone $fstart;
194 
195  $f_unix_start = $fstart->get(IL_CAL_UNIX);
196  $fend->increment(ilDateTime::DAY, 1);
197  $f_unix_end = $fend->get(IL_CAL_UNIX);
198 
199  $unix_start = $start->get(IL_CAL_UNIX);
200  $start->increment(ilDateTime::DAY, 1);
201  $unix_end = $start->get(IL_CAL_UNIX);
202 
203  $counter = 0;
204 
205  $tmp_date = new ilDateTime($unix_start, IL_CAL_UNIX, $this->timezone);
206  $tmp_schedule = array();
207  $tmp_schedule_fullday = array();
208  foreach ($this->schedule as $schedule) {
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'])) {
213  $tmp_schedule_fullday[] = $schedule;
214  }
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))) {
218  $tmp_schedule[] = $schedule;
219  }
220  }
221 
222  //order non full day events by starting date;
223  array_multisort(array_column($tmp_schedule, 'dstart'), SORT_ASC, $tmp_schedule);
224 
225  //merge both arrays keeping the full day events first and then rest ordered by starting date.
226  $schedules = array_merge($tmp_schedule_fullday, $tmp_schedule);
227 
228  return $schedules;
229  }
Set timezone
const IL_CAL_DATETIME
const IL_CAL_UNIX
get($a_format, $a_format_str='', $a_tz='')
get formatted date
$counter
Class for single dates.
Date and time handling
get($a_format, $a_format_str='', $a_tz='')
get formatted date
increment($a_type, $a_count=1)
increment
Create styles array
The data for the language used.
+ 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 protected

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

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

392  {
393  global $ilDB;
394 
395  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
396  $cats = ilCalendarCategories::_getInstance($this->user->getId())->getCategories($a_include_subitem_calendars);
397  $cats = $this->filterCategories($cats);
398 
399  if (!count($cats)) {
400  return array();
401  }
402 
403  $start = new ilDate(date('Y-m-d', time()), IL_CAL_DATE);
404  $start->increment(IL_CAL_MONTH, -1);
405 
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 " .
408  "WHERE last_update > " . $ilDB->quote($start->get(IL_CAL_DATETIME), 'timestamp') . " " .
409  "AND " . $ilDB->in('ca.cat_id', $cats, false, 'integer') . ' ' .
410  "ORDER BY last_update";
411  $res = $this->db->query($query);
412 
413  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
414  $event = new ilCalendarEntry($row->cal_id);
415  $valid_event = $this->modifyEventByFilters($event);
416  if ($valid_event) {
417  $events[] = $valid_event;
418  }
419  }
420 
421  foreach ($this->addCustomEvents($this->start, $this->end, $cats) as $event) {
422  $events[] = $event;
423  }
424 
425  return $events ? $events : array();
426  }
Model for a calendar entry.
modifyEventByFilters(ilCalendarEntry $event)
const IL_CAL_DATETIME
const IL_CAL_MONTH
user()
Definition: user.php:4
Class for single dates.
foreach($_POST as $key=> $value) $res
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$query
static _getInstance($a_usr_id=0)
get singleton instance
Create styles array
The data for the language used.
const IL_CAL_DATE
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
addCustomEvents(ilDate $start, ilDate $end, array $categories)
+ 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)

protected

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

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

Referenced by calculate().

435  {
436  global $ilDB;
437 
438  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
439  $cats = ilCalendarCategories::_getInstance($this->user->getId())->getCategories($this->enabledSubitemCalendars());
440  $cats = $this->filterCategories($cats);
441 
442  if (!count($cats)) {
443  return array();
444  }
445 
446  // TODO: optimize
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)";
451 
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))";
457  } else {
458  $date = new ilDateTime(mktime(0, 0, 0), IL_CAL_UNIX);
459  $query .= " WHERE starta >= " . $this->db->quote($date->get(IL_CAL_DATETIME, '', 'UTC'), 'timestamp');
460  }
461 
462  $query .= " AND " . $ilDB->in('ca.cat_id', $cats, false, 'integer') .
463  " ORDER BY starta";
464 
465  $res = $this->db->query($query);
466 
467  $events = array();
468  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
469  $event = new ilCalendarEntry($row->cal_id);
470  $valid_event = $this->modifyEventByFilters($event);
471  if ($valid_event) {
472  $events[] = $valid_event;
473  }
474  }
475 
476  foreach ($this->addCustomEvents($this->start, $this->end, $cats) as $event) {
477  $events[] = $event;
478  }
479 
480  return $events;
481  }
Model for a calendar entry.
modifyEventByFilters(ilCalendarEntry $event)
const IL_CAL_DATETIME
enabledSubitemCalendars()
Are subitem calendars enabled.
const IL_CAL_UNIX
user()
Definition: user.php:4
foreach($_POST as $key=> $value) $res
Date and time handling
$query
static _getInstance($a_usr_id=0)
get singleton instance
Create styles array
The data for the language used.
global $ilDB
addCustomEvents(ilDate $start, ilDate $end, array $categories)
+ 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 139 of file class.ilCalendarSchedule.php.

References $limit_events.

Referenced by calculate().

140  {
141  return $this->limit_events;
142  }
+ Here is the caller graph for this function:

◆ getScheduledEvents()

ilCalendarSchedule::getScheduledEvents ( )

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

References $schedule, and array.

339  {
340  return (array) $this->schedule;
341  }
Create styles array
The data for the language used.

◆ initPeriod()

ilCalendarSchedule::initPeriod ( ilDate  $seed)
protected

init period of events

protected

Parameters
ilDateseed
Returns

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

References $start, ilCalendarUtil\_getMaxDayOfMonth(), IL_CAL_DATE, IL_CAL_DAY, IL_CAL_FKT_DATE, IL_CAL_FKT_GETDATE, IL_CAL_MONTH, IL_CAL_WEEK, and ilDateTime\increment().

Referenced by __construct().

491  {
492  switch ($this->type) {
493  case self::TYPE_DAY:
494  $this->start = clone $seed;
495  $this->end = clone $seed;
496  //this strict period is just to avoid possible side effects.
497  if (!$this->strict_period) {
498  $this->start->increment(IL_CAL_DAY, -2);
499  $this->end->increment(IL_CAL_DAY, 2);
500  } else {
501  $this->end->increment(IL_CAL_DAY, 1);
502  }
503  break;
504 
505  case self::TYPE_WEEK:
506  $this->start = clone $seed;
507  $start_info = $this->start->get(IL_CAL_FKT_GETDATE, '', 'UTC');
508  $day_diff = $this->weekstart - $start_info['isoday'];
509 
510  if ($day_diff == 7) {
511  $day_diff = 0;
512  }
513 
514  //this strict period is just to avoid possible side effects.
515  if ($this->strict_period) {
516  $this->start->increment(IL_CAL_DAY, $day_diff);
517  $this->end = clone $this->start;
518  $this->end->increment(IL_CAL_WEEK);
519  } else {
520  $this->start->increment(IL_CAL_DAY, $day_diff);
521  $this->start->increment(IL_CAL_DAY, -1);
522  $this->end = clone $this->start;
523  $this->end->increment(IL_CAL_DAY, 9);
524  }
525  break;
526 
527  case self::TYPE_MONTH:
528  if ($this->strict_period) {
529  $this->start = clone $seed;
530  $this->end = clone $seed;
531  $this->end->increment(IL_CAL_MONTH, 1);
532  } else {
533  //todo: previous implementation still taking more days than represented in the view.
534  $year_month = $seed->get(IL_CAL_FKT_DATE, 'Y-m', 'UTC');
535  list($year, $month) = explode('-', $year_month);
536 
537  $this->start = new ilDate($year_month . '-01', IL_CAL_DATE);
538  $this->start->increment(IL_CAL_DAY, -6);
539 
540  $this->end = new ilDate($year_month . '-' . ilCalendarUtil::_getMaxDayOfMonth($year, $month), IL_CAL_DATE);
541  $this->end->increment(IL_CAL_DAY, 6);
542  }
543 
544  break;
545 
546  case self::TYPE_HALF_YEAR:
547  $this->start = clone $seed;
548  $this->end = clone $this->start;
549  $this->end->increment(IL_CAL_MONTH, 6);
550  break;
551 
552  case self::TYPE_PD_UPCOMING:
553  case self::TYPE_INBOX:
554  $this->start = $seed;
555  $this->end = clone $this->start;
556  $this->end->increment(IL_CAL_MONTH, 12);
557  break;
558  }
559 
560  return true;
561  }
const IL_CAL_MONTH
const IL_CAL_WEEK
static _getMaxDayOfMonth($a_year, $a_month)
get max day of month 2008,2 => 29
const IL_CAL_DAY
Class for single dates.
const IL_CAL_FKT_DATE
increment($a_type, $a_count=1)
increment
const IL_CAL_FKT_GETDATE
const IL_CAL_DATE
+ 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 358 of file class.ilCalendarSchedule.php.

References $res, and ilLoggerFactory\getLogger().

Referenced by getChangedEvents(), and getEvents().

359  {
360  foreach ($this->filters as $filter) {
361  $res = $filter->modifyEvent($event);
362  if (!$res) {
363  ilLoggerFactory::getLogger('crs')->debug('filtering failed for ' . get_class($filter));
364  return false;
365  }
366  $event = $res;
367  }
368  return $event;
369  }
foreach($_POST as $key=> $value) $res
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setEventsLimit()

ilCalendarSchedule::setEventsLimit (   $a_limit)

Set events limit.

Parameters
type$a_limit

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

149  {
150  $this->limit_events = $a_limit;
151  }

◆ setPeriod()

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

Set period.

Parameters
ilDatestart
ilDateend
Returns

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

570  {
571  $this->start = $a_start;
572  $this->end = $a_end;
573  }

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.

◆ $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().

◆ $schedule

ilCalendarSchedule::$schedule = array()
protected

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

Referenced by getByDay(), and getScheduledEvents().

◆ $start

ilCalendarSchedule::$start = null
protected

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

Referenced by getByDay(), getChangedEvents(), and initPeriod().

◆ $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.

Referenced by getByDay().

◆ $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

◆ TYPE_HALF_YEAR

const ilCalendarSchedule::TYPE_HALF_YEAR = 6

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

Referenced by ilCalendarViewGUI\getEvents().

◆ TYPE_INBOX

const ilCalendarSchedule::TYPE_INBOX = 4

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

Referenced by ilCalendarBlockGUI\getOverview().

◆ TYPE_MONTH

◆ TYPE_PD_UPCOMING

const ilCalendarSchedule::TYPE_PD_UPCOMING = 5

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

Referenced by ilCalendarBlockGUI\getEvents().

◆ TYPE_WEEK

const ilCalendarSchedule::TYPE_WEEK = 2

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