Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | List of all members
core_calendar\local\api Class Reference

Class containing the local calendar API. More...

Static Public Member Functions

static get_action_events_by_course ( $course, $timesortfrom=null, $timesortto=null, $aftereventid=null, $limitnum=20)
 Get a list of action events for the logged in user by the given course and timesort values. More...
 
static get_action_events_by_courses ( $courses=[], $timesortfrom=null, $timesortto=null, $limitnum=20)
 Get a list of action events for the logged in user by the given courses and timesort values. More...
 
static get_action_events_by_timesort ( $timesortfrom=null, $timesortto=null, $aftereventid=null, $limitnum=20, $limittononsuspendedevents=false, ?\stdClass $user=null)
 Get a list of action events for the logged in user by the given timesort values. More...
 
static 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)
 Get all events restricted by various parameters, taking in to account user and group overrides. More...
 
static update_event_start_day (event_interface $event, DateTimeInterface $startdate)
 Change the start day for an event. More...
 

Detailed Description

Class containing the local calendar API.

This should not be used outside of core_calendar.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_action_events_by_course()

static core_calendar\local\api::get_action_events_by_course (   $course,
  $timesortfrom = null,
  $timesortto = null,
  $aftereventid = null,
  $limitnum = 20 
)
static

Get a list of action events for the logged in user by the given course and timesort values.

Parameters
stdClass$courseThe course the events must belong to
int | null$timesortfromThe start timesort value (inclusive)
int | null$timesorttoThe end timesort value (inclusive)
int | null$aftereventidOnly return events after this one
int$limitnumLimit results to this amount (between 1 and 50)
Return values
arrayA list of action_event_interface objects
Exceptions
limit_invalid_parameter_exception

◆ get_action_events_by_courses()

static core_calendar\local\api::get_action_events_by_courses (   $courses = [],
  $timesortfrom = null,
  $timesortto = null,
  $limitnum = 20 
)
static

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).

Parameters
array$coursesThe courses the events must belong to
int | null$timesortfromThe start timesort value (inclusive)
int | null$timesorttoThe end timesort value (inclusive)
int$limitnumLimit results per course to this amount (between 1 and 50)
Return values
arrayA list of action_event_interface objects indexed by course id

◆ get_action_events_by_timesort()

static core_calendar\local\api::get_action_events_by_timesort (   $timesortfrom = null,
  $timesortto = null,
  $aftereventid = null,
  $limitnum = 20,
  $limittononsuspendedevents = false,
?\stdClass  $user = null 
)
static

Get a list of action events for the logged in user by the given timesort values.

Parameters
int | null$timesortfromThe start timesort value (inclusive)
int | null$timesorttoThe end timesort value (inclusive)
int | null$aftereventidOnly return events after this one
int$limitnumLimit results to this amount (between 1 and 50)
bool$lmittononsuspendedeventsLimit course events to courses the user is active in (not suspended).
stdClass | null$userThe user id or false for $USER
Return values
arrayA list of action_event_interface objects
Exceptions
moodle_exception

◆ get_events()

static core_calendar\local\api::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 
)
static

Get all events restricted by various parameters, taking in to account user and group overrides.

Parameters
int | null$timestartfromEvents with timestart from this value (inclusive).
int | null$timestarttoEvents with timestart until this value (inclusive).
int | null$timesortfromEvents with timesort from this value (inclusive).
int | null$timesorttoEvents with timesort until this value (inclusive).
int | null$timestartaftereventidRestrict the events in the timestart range to ones after this ID.
int | null$timesortaftereventidRestrict the events in the timesort range to ones after this ID.
int$limitnumReturn at most this number of events.
int | null$typeReturn only events of this type.
array | null$usersfilterReturn only events for these users.
array | null$groupsfilterReturn only events for these groups.
array | null$coursesfilterReturn only events for these courses.
bool$withdurationIf true return only events starting within specified timestart otherwise return in progress events as well.
bool$ignorehiddenIf true don't return hidden events.
Return values
core_calendar::local::event::entities::event_interface[]Array of event_interfaces.

◆ update_event_start_day()

static core_calendar\local\api::update_event_start_day ( event_interface  $event,
DateTimeInterface  $startdate 
)
static

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.

Parameters
event_interface$eventThe existing event to modify
DateTimeInterface$startdateThe new date to use for the start day
Return values
event_interfaceThe new event with updated start date

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