## General developer forum

### Calender update triggers

Calender update triggers

Hi,

I'm interested in a software project which updating a calender that lies somewhere else according to the changes of the moodle calender. I have downloaded and installed the moodle and I want to know that are there any event handling methods that are called when calender get updated? I mean like triggers like stuff? or is there any easier way to achive this task ? thank you

Average of ratings: -
Re: Calender update triggers

I did a quick scan of the events_trigger()'s and below is the list.
Doesn't look like there is a specific one for updating the calendar.

But you may want to hook into the event that results in the calendar being updated, for example the create/update of a course or the enrollment there in.

Anne.
--

events_trigger($event,$eventdata);
events_trigger($eventname,$eventdata);
events_trigger('activity_completion_changed', $data); events_trigger('assessable_content_uploaded',$eventdata);
events_trigger('assessable_content_uploaded', $eventdata); events_trigger('assessable_content_uploaded',$eventdata);
events_trigger('assessable_content_uploaded', $eventdata); events_trigger('assessable_file_uploaded',$eventdata);
events_trigger('assessable_file_uploaded', $eventdata); events_trigger('assessable_file_uploaded',$eventdata);
events_trigger('assessable_files_done', $eventdata); events_trigger('assessable_submitted',$eventdata);
events_trigger('assessable_submitted', $eventdata); events_trigger('assessable_submitted',$eventdata);
events_trigger('blog_entry_added', $this); events_trigger('blog_entry_deleted',$this);
events_trigger('blog_entry_edited', $entry); events_trigger('cohort_added',$cohort);
events_trigger('cohort_deleted', $cohort); events_trigger('cohort_member_added', (object)array('cohortid'=>$cohortid, 'userid'=>$userid)); events_trigger('cohort_member_removed', (object)array('cohortid'=>$cohortid, 'userid'=>$userid)); events_trigger('cohort_updated',$cohort);
events_trigger('course_category_deleted', $this); events_trigger('course_category_deleted',$this);
events_trigger('course_completed', $this->get_record_data()); events_trigger('course_content_removed',$course);
events_trigger('course_created', $course); events_trigger('course_deleted',$course);
events_trigger('course_restored', (object) array(
events_trigger('course_updated', $course); events_trigger('groups_group_created',$group);
events_trigger('groups_group_deleted', $group); events_trigger('groups_group_updated',$group);
events_trigger('groups_grouping_created', $data); events_trigger('groups_grouping_deleted',$grouping);
events_trigger('groups_grouping_updated', $data); events_trigger('groups_groupings_deleted',$courseid);
events_trigger('groups_groupings_groups_removed', $courseid); events_trigger('groups_groups_deleted',$courseid);
events_trigger('groups_member_added', $eventdata); events_trigger('groups_member_removed',$eventdata);
events_trigger('groups_members_removed', $eventdata); events_trigger('lti_unknown_service_api_call',$data);
events_trigger('mod_created', $eventdata); events_trigger('mod_deleted',$eventdata);
events_trigger('portfolio_send', $this->id); events_trigger('quiz_attempt_started',$eventdata);
events_trigger('role_assigned', $ra); events_trigger('role_unassigned',$ra);
events_trigger('role_unassigned', $ra); events_trigger('test_cron', 'ok') events_trigger('test_cron', 'ok'); events_trigger('test_cron', 'ok'); events_trigger('test_instant', 'fail') events_trigger('test_instant', 'ok') events_trigger('test_instant', 'ok') events_trigger('test_instant', 'ok') events_trigger('test_instant', 'ok') events_trigger('test_instant', 'ok') events_trigger('user_created',$DB->get_record('user', array('id'=>$user->id))); events_trigger('user_created',$euser);
events_trigger('user_created', $newuser); events_trigger('user_created',$user);
events_trigger('user_created', $user); events_trigger('user_created',$user);
events_trigger('user_created', $usernew); events_trigger('user_deleted',$user);
events_trigger('user_enrol_modified', $enrolment); events_trigger('user_enrol_modified',$ue);
events_trigger('user_enrol_modified', $ue); events_trigger('user_enrolled',$ue);
events_trigger('user_logout', $params); events_trigger('user_unenrolled',$ue);
events_trigger('user_unenrolled', $ue); events_trigger('user_updated',$DB->get_record('user', array('id'=>$oldinfo->id))); events_trigger('user_updated',$euser);
events_trigger('user_updated', $euser); events_trigger('user_updated',$euser);
events_trigger('user_updated', $euser); events_trigger('user_updated',$existinguser);
events_trigger('user_updated', $updateduser); events_trigger('user_updated',$user);
events_trigger('user_updated', $user); events_trigger('user_updated',$user);
events_trigger('user_updated', $usernew); events_trigger('user_updated',$usernew);
events_trigger('workshop_viewed', (object)array(..))

Average of ratings: -
Re: Calender update triggers

Hi, Thanks for the reply. But sorry I did not understand this sentence.

" But you may want to hook into the event that results in the calendar being updated, for example the create/update of a course or the enrollment there in. "

Average of ratings: -
Re: Calender update triggers

Hi Sudheera,

You could ask yourself what calender items you are interested in.
And then see if those items have a trigger you can use.

For example; if you were interested in the time someone was enrolled in a course, you could use the enrollment trigger.

Hope this makes it a bit clearer.

Anne.

Average of ratings:Useful (1)
Re: Calender update triggers

Hi,

I'm interested in a scenario like, "I'm a student enrolled in a course and then when the teacher add event to the calender I want to write a code to do something." I have identified the event_hook() and can do something in the code when a event added. but it's only happening to the event adding user, I want to do that to all enrolled users. how can I achieve that.? thank you

Average of ratings: -
Re: Calender update triggers

There isn't an event trigger for calendar event added, which is really what you are looking for. The second piece of whom to send information to would be part of the event processes.

The first step then would be to define the event sender in calendar using the events api (http://docs.moodle.org/dev/Events_API). This would be a modification of the core calendar.

The next step would be creating a plugin that handles the event. This would be the part in your description code that does something.

Average of ratings: -