Create calendar events when a custom plugin triggers an event

Create calendar events when a custom plugin triggers an event

von Mahtab Hussain -
Anzahl Antworten: 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


Mittelwert:  -
Als Antwort auf Mahtab Hussain

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

von Mahtab Hussain -

Anyone who may have a hint?????

Als Antwort auf Mahtab Hussain

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

von Olumuyiwa Taiwo -
Nutzerbild von 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.

Als Antwort auf Olumuyiwa Taiwo

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

von 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

Als Antwort auf Mahtab Hussain

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

von Emma Richardson -
Nutzerbild von Documentation writers Nutzerbild von Particularly helpful Moodlers Nutzerbild von Plugin developers

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