Where is the best place to define custom event handlers?

Where is the best place to define custom event handlers?

by Ben Lobo -
Number of replies: 2
Hi

I'm fairly new to Moodle development. I need to add some event triggers to occur on various occasions (e.g. when a course assignment is graded) so that I can catch the events using my own custom event handlers and carry out further processing (in this case I'll be sending a SOAP request to an external web service providing details about the event).

My question is, where is the best place to define my event handlers and the functions that they call?

After reading through the documentation, I thought it would be in '/local/db/events.php' but this doesn't seem to be available yet and I'm developing this for a Moodle 1.9.3 site.

In order to test so far I've been defining my event handlers in an activity module and then bumping up the version number every time I need to register a new handler as this seems to be the only way of doing it but I suspect there must be a better way.

Does anyone have any suggestions?

Thanks

Ben


Average of ratings: -
In reply to Ben Lobo

Re: Where is the best place to define custom event handlers?

by Penny Leach -
Hi Ben,

You can vote for the 1.9.x bug for local/db/events.php

http://tracker.moodle.org/browse/MDL-17442

And hopefully I'll commit it soon. Or you can apply the patches attached to the bug manually and wait for that day to arrive ;)
In reply to Penny Leach

Re: Where is the best place to define custom event handlers?

by Ben Lobo -
Thanks Penny. I'll do both.