Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

Event vault class

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

Defines 1 class


Class: event_vault  - X-Ref

Event vault class.

This class will handle interacting with the database layer to retrieve
the records. This is required to house the complex logic required for
pagination because it's not a one-to-one mapping between database records
and users.

This is a repository. It's called a vault to reduce confusion because
Moodle has already taken the name repository. Vault is cooler anyway.

__construct(event_factory_interface $factory,raw_event_retrieval_strategy_interface $retrievalstrategy)   X-Ref
Create an event vault.

param: event_factory_interface $factory An event factory
param: raw_event_retrieval_strategy_interface $retrievalstrategy

get_event_by_id($id)   X-Ref
No description

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
No description

get_action_events_by_timesort(\stdClass $user,$timesortfrom = null,$timesortto = null,event_interface $afterevent = null,$limitnum = 20,$limittononsuspendedevents = false,?string $searchvalue = null)   X-Ref
No description

get_action_events_by_course(\stdClass $user,\stdClass $course,$timesortfrom = null,$timesortto = null,event_interface $afterevent = null,$limitnum = 20,?string $searchvalue = null)   X-Ref
No description

timefield_pagination_from($field,$timefrom,$lastseentime = null,$lastseenid = null,$withduration = true)   X-Ref
No description

timefield_pagination_to($field,$timeto,$lastseentime = null,$lastseenid = null)   X-Ref
Generates SQL subquery and parameters for 'to' pagination.

return: array|bool
param: string   $field
param: int      $timeto
param: int|null $lastseentime
param: int|null $lastseenid

transform_from_database_record(\stdClass $record)   X-Ref
Create an event from a database record.

return: event_interface|null
param: \stdClass $record The database record

get_from_db($userid,$whereconditions,$whereparams,$ordersql,$offset,$limitnum)   X-Ref
Fetches records from DB.

return: array
param: int    $userid
param: string $whereconditions
param: array  $whereparams
param: string $ordersql
param: int    $offset
param: int    $limitnum

generate_search_subquery(?string $searchvalue)   X-Ref
Generates SQL subquery and parameters for event searching.

return: array|null
param: string|null $searchvalue Search value.