Events
in package
Class for handling and dispatching system and user defined events.
Tags
Table of Contents
Methods
- AddEventHandler() : bool
- Add an event handler for a module event.
- CreateEvent() : mixed
- Inform the system about a new event that can be generated.
- GetEventDescription() : string
- Place to handle the description strings for core events. Basically just going to call out to the lang() function.
- GetEventHelp() : string
- Place to handle the help messages for core events. Basically just going to call out to the lang() function.
- ListEventHandlers() : mixed
- Return the list of event handlers for a particular event.
- ListEvents() : mixed
- Get a list of all of the known events.
- OrderHandlerDown() : mixed
- Move an event handler (by id) up in its event.
- OrderHandlerUp() : mixed
- Move an event handler (by id) up in its event.
- RemoveAllEventHandlers() : bool
- Clears all the event handlers for the given event.
- RemoveEvent() : mixed
- Remove an event from the CMS system.
- RemoveEventHandler() : bool
- Remove an event handler for a particular event.
- RemoveEventHandlerById() : mixed
- Remove an event handler given its id
- SendEvent() : mixed
- Trigger an event.
Methods
AddEventHandler()
Add an event handler for a module event.
public
static AddEventHandler(string $modulename, string $eventname[, string $tag_name = false ][, string $module_handler = false ][, bool $removable = true ]) : bool
Parameters
- $modulename : string
-
The name of the module sending the event
- $eventname : string
-
The name of the event
- $tag_name : string = false
-
The name of a user defined tag. If not passed, no user defined tag is set.
- $module_handler : string = false
-
The name of the module. If not passed, no module is set.
- $removable : bool = true
-
Can this event be removed from the list? Defaults to true.
Return values
bool —If successful, true. If it fails, false.
CreateEvent()
Inform the system about a new event that can be generated.
public
static CreateEvent(string $modulename, string $eventname) : mixed
Parameters
- $modulename : string
-
The name of the module that is sending the event
- $eventname : string
-
The name of the event
GetEventDescription()
Place to handle the description strings for core events. Basically just going to call out to the lang() function.
public
static GetEventDescription(string $eventname) : string
Parameters
- $eventname : string
-
The name of the event
Return values
string —Returns the description string for the event. Empty string if nothing is found.
GetEventHelp()
Place to handle the help messages for core events. Basically just going to call out to the lang() function.
public
static GetEventHelp(string $eventname) : string
Parameters
- $eventname : string
-
The name of the event
Return values
string —Returns the help string for the event. Empty string if nothing is found.
ListEventHandlers()
Return the list of event handlers for a particular event.
public
static ListEventHandlers(string $modulename, string $eventname) : mixed
Parameters
- $modulename : string
-
The name of the module sending the event
- $eventname : string
-
The name of the event
Return values
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()
Get a list of all of the known events.
public
static ListEvents() : mixed
Return values
mixed —If successful, a list of all the known events. If it fails, false
OrderHandlerDown()
Move an event handler (by id) up in its event.
public
static OrderHandlerDown(int $handler_id) : mixed
..
Parameters
- $handler_id : int
OrderHandlerUp()
Move an event handler (by id) up in its event.
public
static OrderHandlerUp(int $handler_id) : mixed
..
Parameters
- $handler_id : int
RemoveAllEventHandlers()
Clears all the event handlers for the given event.
public
static RemoveAllEventHandlers(string $modulename, string $eventname) : bool
Parameters
- $modulename : string
-
The name of the module sending the event
- $eventname : string
-
The name of the event
Return values
bool —If successful, true. If it fails, false.
RemoveEvent()
Remove an event from the CMS system.
public
static RemoveEvent(string $modulename, string $eventname) : mixed
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.
Parameters
- $modulename : string
-
The name of the module that is sending the event
- $eventname : string
-
The name of the event
RemoveEventHandler()
Remove an event handler for a particular event.
public
static RemoveEventHandler(string $modulename, string $eventname[, string $tag_name = false ][, string $module_handler = false ]) : bool
Parameters
- $modulename : string
-
The name of the module sending the event
- $eventname : string
-
The name of the event
- $tag_name : string = false
-
The name of a user defined tag. If not passed, no user defined tag is set.
- $module_handler : string = false
-
The name of the module. If not passed, no module is set.
Return values
bool —If successful, true. If it fails, false.
RemoveEventHandlerById()
Remove an event handler given its id
public
static RemoveEventHandlerById(int $handler_id) : mixed
Parameters
- $handler_id : int
SendEvent()
Trigger an event.
public
static SendEvent(string $modulename, string $eventname[, array<string|int, mixed> $params = array() ]) : mixed
This function will call all registered event handlers for the event
Parameters
- $modulename : string
-
The name of the module that is sending the event
- $eventname : string
-
The name of the event
- $params : array<string|int, mixed> = array()
-
The parameters associated with this event.