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] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 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: 456 lines (16 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.

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

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

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

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

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

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

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