Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

Event vault interface

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

Defines 1 class

event_vault_interface:: (4 methods):
  get_event_by_id()
  get_events()
  get_action_events_by_timesort()
  get_action_events_by_course()


Interface: event_vault_interface  - X-Ref

Interface for an event vault class

get_event_by_id($id)   X-Ref
Retrieve an event for the given id.

param: int $id The event id
return: event_interface|false

get_events($timestartfrom = null,$timestartto = null,$timesortfrom = null,$timesortto = null,event_interface $timestartafterevent = null,event_interface $timesortafterevent = 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: event_interface|null  $timestartafterevent   Restrict the events in the timestart range to ones after this one.
param: event_interface|null  $timesortafterevent    Restrict the events in the timesort range to ones after this one.
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.
param: callable|null         $filter                Additional logic to filter out unwanted events.
return: event_interface[] Array of event_interfaces.

get_action_events_by_timesort(\stdClass $user,$timesortfrom,$timesortto,event_interface $afterevent,$limitnum,$limittononsuspendedevents)   X-Ref
Retrieve an array of events for the given user and time constraints.

If using this function for pagination then you can provide the last event that you've seen
($afterevent) and it will be used to appropriately offset the result set so that you don't
receive the same events again.
param: \stdClass       $user         The user for whom the events belong
param: int             $timesortfrom Events with timesort from this value (inclusive)
param: int             $timesortto   Events with timesort until this value (inclusive)
param: event_interface $afterevent   Only return events after this one
param: int             $limitnum     Return at most this number of events
param: bool            $lmittononsuspendedevents Limit course events to courses the user is active in (not suspended).
return: event_interface

get_action_events_by_course(\stdClass $user,\stdClass $course,$timesortfrom,$timesortto,event_interface $afterevent,$limitnum)   X-Ref
Retrieve an array of events for the given user filtered by the course and time constraints.

If using this function for pagination then you can provide the last event that you've seen
($afterevent) and it will be used to appropriately offset the result set so that you don't
receive the same events again.

param: \stdClass       $user         The user for whom the events belong
param: \stdClass       $course       The course to filter by
param: int             $timesortfrom Events with timesort from this value (inclusive)
param: int             $timesortto   Events with timesort until this value (inclusive)
param: event_interface $afterevent   Only return events after this one
param: int             $limitnum     Return at most this number of events
return: action_event_interface