Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
tool_monitor\eventobservers Class Reference

Observer class containing methods monitoring various events. More...

Public Member Functions

 process_buffer ()
 This method process all events stored in the buffer.
 

Static Public Member Functions

static course_deleted (\core\event\course_deleted $event)
 Course delete event observer.
 
static course_module_deleted (\core\event\course_module_deleted $event)
 Observer that monitors course module deleted event and delete user subscriptions.
 
static process_event (\core\event\base $event)
 The observer monitoring all the events.
 
static user_deleted (\core\event\user_deleted $event)
 Observer that monitors user deleted event and delete user subscriptions.
 

Protected Member Functions

 buffer_event (\core\event\base $event)
 Api to buffer events to store, to reduce db queries.
 
 flush ()
 Protected method that flushes the buffer of events and writes them to the database.
 

Protected Attributes

array $buffer = array()
 $buffer buffer of events.
 
int $count = 0
 Number of entries in the buffer.
 

Static Protected Attributes

static eventobservers $instance
 a reference to a self instance.
 

Detailed Description

Observer class containing methods monitoring various events.

Since
Moodle 2.8
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ buffer_event()

tool_monitor\eventobservers::buffer_event ( \core\event\base $event)
protected

Api to buffer events to store, to reduce db queries.

Parameters
core\event\base$event

◆ course_deleted()

static tool_monitor\eventobservers::course_deleted ( \core\event\course_deleted $event)
static

Course delete event observer.

This observer monitors course delete event, and when a course is deleted it deletes any rules and subscriptions associated with it, so no orphan data is left behind.

Parameters
core\event\course_deleted$eventThe course deleted event.

◆ course_module_deleted()

static tool_monitor\eventobservers::course_module_deleted ( \core\event\course_module_deleted $event)
static

Observer that monitors course module deleted event and delete user subscriptions.

Parameters
core\event\course_module_deleted$eventthe event object.

◆ flush()

tool_monitor\eventobservers::flush ( )
protected

Protected method that flushes the buffer of events and writes them to the database.

Return values
arraya copy of the events buffer.

◆ process_buffer()

tool_monitor\eventobservers::process_buffer ( )

This method process all events stored in the buffer.

This is a multi purpose api. It does the following:-

  1. Write event data to tool_monitor_events
  2. Find out users that need to be notified about rule completion and schedule a task to send them messages.

◆ process_event()

static tool_monitor\eventobservers::process_event ( \core\event\base $event)
static

The observer monitoring all the events.

This observers puts small event objects in buffer for later writing to the database. At the end of the request the buffer is cleaned up and all data dumped into the tool_monitor_events table.

Parameters
core\event\base$eventevent object

◆ user_deleted()

static tool_monitor\eventobservers::user_deleted ( \core\event\user_deleted $event)
static

Observer that monitors user deleted event and delete user subscriptions.

Parameters
core\event\user_deleted$eventthe event object.

The documentation for this class was generated from the following file: