Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Events API: Difference between revisions

From MoodleDocs
(Created page with "Events and Event-based Logging. Specification for 2.6 = event_base class = <pre> abstract class event_base { // ... constants and all properties as protected variables prot...")
 
Line 4: Line 4:


<pre>
<pre>
abstract class event_base {
abstract class event_base implements cacheable_object {
   // ... constants and all properties as protected variables
   // ... constants and all properties as protected variables
   protected final function __construct() {}
   protected final function __construct() {}
Line 26: Line 26:
   public function can_view($user = null);
   public function can_view($user = null);
   public function event_data();
   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
  }
}
}
</pre>
</pre>

Revision as of 06:45, 20 May 2013

Events and Event-based Logging. Specification for 2.6

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
  }
}