Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Contains class containing the internal calendar API.

Copyright: 2017 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 325 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: api  - X-Ref

Class containing the local calendar API.

This should not be used outside of core_calendar.

get_events($timestartfrom = null,$timestartto = null,$timesortfrom = null,$timesortto = null,$timestartaftereventid = null,$timesortaftereventid = null,$limitnum = 20,$type = null,array $usersfilter = null,array $groupsfilter = null,array $coursesfilter = null,array $categoriesfilter = null,$withduration = true,$ignorehidden = true,callable $filter = null)   X-Ref
Get all events restricted by various parameters, taking in to account user and group overrides.

param: int|null      $timestartfrom         Events with timestart from this value (inclusive).
param: int|null      $timestartto           Events with timestart until this value (inclusive).
param: int|null      $timesortfrom          Events with timesort from this value (inclusive).
param: int|null      $timesortto            Events with timesort until this value (inclusive).
param: int|null      $timestartaftereventid Restrict the events in the timestart range to ones after this ID.
param: int|null      $timesortaftereventid  Restrict the events in the timesort range to ones after this ID.
param: int           $limitnum              Return at most this number of events.
param: int|null      $type                  Return only events of this type.
param: array|null    $usersfilter           Return only events for these users.
param: array|null    $groupsfilter          Return only events for these groups.
param: array|null    $coursesfilter         Return only events for these courses.
param: bool          $withduration          If true return only events starting within specified
param: bool          $ignorehidden          If true don't return hidden events.
return: \core_calendar\local\event\entities\event_interface[] Array of event_interfaces.

get_action_events_by_timesort($timesortfrom = null,$timesortto = null,$aftereventid = null,$limitnum = 20,$limittononsuspendedevents = false,?\stdClass $user = null)   X-Ref
Get a list of action events for the logged in user by the given
timesort values.

param: int|null $timesortfrom The start timesort value (inclusive)
param: int|null $timesortto The end timesort value (inclusive)
param: int|null $aftereventid Only return events after this one
param: int $limitnum Limit results to this amount (between 1 and 50)
param: bool $lmittononsuspendedevents Limit course events to courses the user is active in (not suspended).
param: \stdClass|null $user The user id or false for $USER
return: array A list of action_event_interface objects

get_action_events_by_course($course,$timesortfrom = null,$timesortto = null,$aftereventid = null,$limitnum = 20)   X-Ref
Get a list of action events for the logged in user by the given
course and timesort values.

param: \stdClass $course The course the events must belong to
param: int|null $timesortfrom The start timesort value (inclusive)
param: int|null $timesortto The end timesort value (inclusive)
param: int|null $aftereventid Only return events after this one
param: int $limitnum Limit results to this amount (between 1 and 50)
return: array A list of action_event_interface objects

get_action_events_by_courses($courses = [],$timesortfrom = null,$timesortto = null,$limitnum = 20)   X-Ref
Get a list of action events for the logged in user by the given
courses and timesort values.

The limit number applies per course, not for the result set as a whole.
E.g. Requesting 3 courses with a limit of 10 will result in up to 30
events being returned (up to 10 per course).

param: array $courses The courses the events must belong to
param: int|null $timesortfrom The start timesort value (inclusive)
param: int|null $timesortto The end timesort value (inclusive)
param: int $limitnum Limit results per course to this amount (between 1 and 50)
return: array A list of action_event_interface objects indexed by course id

update_event_start_day(event_interface $event,\DateTimeInterface $startdate)   X-Ref
Change the start day for an event. Only the date will be
modified, the time of day for the event will be left as is.

param: event_interface $event The existing event to modify
param: DateTimeInterface $startdate The new date to use for the start day
return: event_interface The new event with updated start date