Events API: Difference between revisions
From MoodleDocs
No edit summary |
|||
Line 1: | Line 1: | ||
Events and Event-based Logging. Specification for 2.6 | Events and Event-based Logging. Specification for 2.6 | ||
= Introduction = | |||
= event_base class = | = event_base class = |
Revision as of 06:49, 20 May 2013
Events and Event-based Logging. Specification for 2.6
Introduction
event_base class
abstract class event_base implements cacheable_object { // ... constants and all properties as protected variables protected final function __construct() {} protected function __construct($args); public static final function create($args) { return new self($args); } public static final funciton restore($object) { $event = new self(); // .. restore each property from $object to $event } public static final function create_and_trigger($args) { $event = self::create($args); $event->trigger(); } public final function trigger() { // ... } public static function event_name(); public static function event_description(); public function can_view($user = null); public function event_data(); public function prepare_to_cache() { // .. basic implementation caching ALL fields } public static function wake_from_cache($a) { // .. basic implementation restoring ALL fields } }