General developer forum
Sending SMS when an important event occurs
Thank you for the reply.
Sir could you please tell me if my approach is correct ?
This is the simple picture I have in mind after reading about Moodle a bit.
I have a cron() method inside my block.
Inside that cron() method of my block,
I write the code to check the moodle database for new assignment deadlines, new quizzes, new resource updates, new forums posts
the code to send SMS via my gateway(I'm going to use Kannel WAP/SMS gateway for this project).
I didn't quite understand your reply since I'm still trying to understand how moodle works and where I should start. Im not familiar with php either but hopefully I'll catch up soon.
Please read the links that Tim had provided. Rather than doing things in a cron, the messaging system will call your messaging handler. So it is a push, rather than a polling type of system.
If there are some events that are not currently triggering a message event, then you can add them in the code.
However, one of your criteria about sending a message when there is X minutes before an assignment is due, will still need to be done in a cron type of event.
I think event triggering is better than doing this in cron.
As I understood so far, what I have to do is,
for example, when considering adding a new resource,
1. I should go through the code of resource module and find out where in that code "adding a resource to the database" happens and write code to create an eventdata object and trigger the event(call events_trigger() function)
2. Then write the event handler function
3. Then I have to insert my handler in events.php inside the db folder of resource module. If events.php doesnt already exist I have to create it
Am I correct ?