Create calendar events when a custom plugin triggers an event

Create calendar events when a custom plugin triggers an event

by Mahtab Hussain -
Number of replies: 4
May you all live in peace!

I am a Moodle developer. I have developed a local plugin. The plugin allows managing webinars related information. It works fine. Now,I am looking for a way to create calendar events for every webinar entry so that site visitors can view Webinars information in Calendar block. Further, if the plugin modifies any webinar entry, the relevant calendar event may also modify accordingly.

I have already created events in my plugin which fire when an entry is created, updated, and deleted. These events do not actually create calendar events.

I know that when we create a course assignment with a due date, relevant calendar event gets created automatically. So, I was wondering how we manage calendar entries from within a plugin.

I have tried to go through Events 2 API and have learned that /db/events.php file in a plugin can be used to define callback functions relevant to different events. I am wondering if I need to define these callback functions and then within observers.php, I need to write code to create calendar events?
OR
Is there a different way to accomplish the same.

Thanks for your time to read my question. Looking to hear from Moodle gurus.

Warm regards,
Mahtab Hussain


Average of ratings: -
In reply to Mahtab Hussain

Re: Create calendar events when a custom plugin triggers an event

by Mahtab Hussain -

Anyone who may have a hint?????

In reply to Mahtab Hussain

Re: Create calendar events when a custom plugin triggers an event

by Olumuyiwa Taiwo -
Picture of Plugin developers

   need to define these callback functions and then within observers.php, I need to write code to create calendar events

Yes, that's how you wold do it.

In reply to Olumuyiwa Taiwo

Re: Create calendar events when a custom plugin triggers an event

by Mahtab Hussain -

May you live in peace !

Thanks for your update. Actually, I completed the task yesterday following same steps. It works perfect. I actually wanted to know if there is any other recommended approach. Thanks for your confirmation and time and effort to respond.


Thanks heaps.

Warm regards,

Mahtab Hussain

In reply to Mahtab Hussain

Re: Create calendar events when a custom plugin triggers an event

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I know this is a year old but would you be willing to share your code?