Events View code

Class for handling and dispatching system and user defined events.

package

CMS

license

GPL

Methods

CreateEvent(string $modulename, string $eventname) 

Inform the system about a new event that can be generated.

static

Arguments

string $modulename

The name of the module that is sending the event

string $eventname

The name of the event

RemoveEvent(string $modulename, string $eventname) 

Remove an event from the CMS system.

static

This function removes all handlers to the event, and completely removes all references to this event from the database

Note, only events created by this module can be removed.

Arguments

string $modulename

The name of the module that is sending the event

string $eventname

The name of the event

SendEvent(string $modulename, string $eventname, array $params = array()) 

Trigger an event.

static

This function will call all registered event handlers for the event

Arguments

string $modulename

The name of the module that is sending the event

string $eventname

The name of the event

array $params

The parameters associated with this event.

ListEventHandlers(string $modulename, string $eventname) : mixed

Return the list of event handlers for a particular event.

static

Arguments

string $modulename

The name of the module sending the event

string $eventname

The name of the event

Response

mixed

If successful, an array of arrays, each element in the array contains two elements 'handler_name', and 'module_handler', any one of these could be null. If it fails, false is returned.

ListEvents() : mixed

Get a list of all of the known events.

static

Response

mixed

If successful, a list of all the known events. If it fails, false

AddEventHandler(string $modulename, string $eventname, string $tag_name = false, string $module_handler = false, boolean $removable = true) : boolean

Add an event handler for a module event.

static

Arguments

string $modulename

The name of the module sending the event

string $eventname

The name of the event

string $tag_name

The name of a user defined tag. If not passed, no user defined tag is set.

string $module_handler

The name of the module. If not passed, no module is set.

boolean $removable

Can this event be removed from the list? Defaults to true.

Response

boolean

If successful, true. If it fails, false.

RemoveEventHandlerById(integer $handler_id) 

Remove an event handler given its id

static

Arguments

integer $handler_id

RemoveEventHandler(string $modulename, string $eventname, string $tag_name = false, string $module_handler = false) : boolean

Remove an event handler for a particular event.

static

Arguments

string $modulename

The name of the module sending the event

string $eventname

The name of the event

string $tag_name

The name of a user defined tag. If not passed, no user defined tag is set.

string $module_handler

The name of the module. If not passed, no module is set.

Response

boolean

If successful, true. If it fails, false.

RemoveAllEventHandlers(string $modulename, string $eventname) : boolean

Clears all the event handlers for the given event.

static

Arguments

string $modulename

The name of the module sending the event

string $eventname

The name of the event

Response

boolean

If successful, true. If it fails, false.

OrderHandlerUp(integer $handler_id) 

Move an event handler (by id) up in its event.

static

..

Arguments

integer $handler_id

OrderHandlerDown(integer $handler_id) 

Move an event handler (by id) up in its event.

static

..

Arguments

integer $handler_id

GetEventHelp(string $eventname) : string

Place to handle the help messages for core events. Basically just going to call out to the lang() function.

static

Arguments

string $eventname

The name of the event

Response

string

Returns the help string for the event. Empty string if nothing is found.

GetEventDescription(string $eventname) : string

Place to handle the description strings for core events. Basically just going to call out to the lang() function.

static

Arguments

string $eventname

The name of the event

Response

string

Returns the description string for the event. Empty string if nothing is found.