| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Source view] [Print] [Project Stats]
Library of functions for events manipulation. The public API is all at the end of this file.
| Author: | Martin Dougiamas and many others |
| License: | http://www.gnu.org/copyleft/gpl.html GNU Public License |
| Version: | $Id: eventslib.php,v 1.16.2.3 2008/10/06 22:07:10 skodak Exp $ |
| File Size: | 513 lines (18 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| events_load_def($component) X-Ref |
| Loads the events definitions for the component (from file). If no events are defined for the component, we simply return an empty array. param: $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' return: array of capabilities or empty array if not exists |
| events_get_cached($component) X-Ref |
| Gets the capabilities that have been cached in the database for this component. param: $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' return: array of events |
| events_update_definition($component='moodle') X-Ref |
| We can not removed all event handlers in table, then add them again because event handlers could be referenced by queued items Note that the absence of the db/events.php event definition file will cause any queued events for the component to be removed from the database. param: $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' return: boolean |
| events_uninstall($component) X-Ref |
| Remove all event handlers and queued events param: $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' |
| events_cleanup($component, $cachedhandlers) X-Ref |
| Deletes cached events that are no longer needed by the component. param: $component - examples: 'moodle', 'mod/forum', 'block/quiz_results' param: $chachedevents - array of the cached events definitions that will be return: int - number of deprecated capabilities that have been removed |
| events_queue_handler($handler, $event, $errormessage) X-Ref |
| puts a handler on queue param: object handler - event handler object from db param: object eventdata - event data object return: id number of new queue handler |
| events_dispatch($handler, $eventdata, &$errormessage) X-Ref |
| trigger a single event with a specified handler param: handler - hander object from db param: eventdata - event dataobject param: errormessage - error message indicating problem return: bool - success or fail |
| events_process_queued_handler($qhandler) X-Ref |
| given a queued handler, call the respective event handler to process the event param: object qhandler - events_queued_handler object from db return: boolean meaning success, or NULL on fatal failure |
| events_dequeue($qhandler) X-Ref |
| removes this queued handler from the events_queued_handler table removes events_queue record from events_queue if no more references to this event object exists param: object qhandler - events_queued_handler object from db |
| events_get_handlers($eventname) X-Ref |
| Returns hanflers for given event. Uses caching for better perf. param: string $eventanme name of even or 'reset' return: mixed array of handlers or false otherwise |
| events_cron($eventname='') X-Ref |
| Events cron will try to empty the events queue by processing all the queued events handlers param: string eventname - empty means all return: number of dispatched+removed broken events |
| events_trigger($eventname, $eventdata) X-Ref |
| Function to call all eventhandlers when triggering an event param: eventname - name of the event param: eventdata - event data object (without magic quotes) return: number of failed events |
| events_is_registered($eventname, $component) X-Ref |
| checks if an event is registered for this component param: string eventname - name of the event param: string component - component name, can be mod/data or moodle return: bool |
| events_pending_count($eventname) X-Ref |
| checks if an event is queued for processing - either cron handlers attached or failed instant handlers param: string eventname - name of the event return: int number of queued events |
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |