Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

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: 137 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,?string $searchvalue = 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.
param: string|null           $searchvalue          The value a user wishes to search against
return: event_interface[] Array of event_interfaces.

get_action_events_by_timesort(\stdClass $user,$timesortfrom,$timesortto,event_interface $afterevent,$limitnum,$limittononsuspendedevents,?string $searchvalue = null)   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).
param: string|null     $searchvalue  The value a user wishes to search against
return: event_interface

get_action_events_by_course(\stdClass $user,\stdClass $course,$timesortfrom,$timesortto,event_interface $afterevent,$limitnum,?string $searchvalue = null)   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
param: string|null     $searchvalue  The value a user wishes to search against
return: action_event_interface