Events MDL-16203 fire events when a module is added/updated/deleted

This commit is contained in:
Dan Marsden 2010-03-22 02:56:45 +00:00
parent ef3e1fbcb3
commit 75ba5fe41a
3 changed files with 25 additions and 0 deletions

View File

@ -146,6 +146,13 @@ if (!empty($add)) {
echo $OUTPUT->notification("Could not delete the $cm->modname from that section");
}
//trigger event with information about this module.
$eventdata = new object();
$eventdata->component = 'mod/'.$cm->modname;
$eventdata->course = $course->id;
$eventdata->cm = $cm->id;
events_trigger($cm->modname.'_mod_deleted', $eventdata);
add_to_log($course->id, 'course', "delete mod",
"view.php?id=$cm->course",
"$cm->modname $cm->instance", $cm->id);

View File

@ -376,6 +376,12 @@
// set cm idnumber - uniqueness is already verified by form validation
set_coursemodule_idnumber($fromform->coursemodule, $fromform->cmidnumber);
}
//trigger event with information about this module.
$eventdata = new object();
$eventdata->component = 'mod/'.$fromform->modulename;
$eventdata->course = $course->id;
$eventdata->cm = $fromform->coursemodule;
events_trigger($fromform->modulename.'_mod_updated', $eventdata);
add_to_log($course->id, "course", "update mod",
"../mod/$fromform->modulename/view.php?id=$fromform->coursemodule",
@ -479,6 +485,12 @@
if ($CFG->enableavailability) {
condition_info::update_cm_from_form((object)array('id'=>$fromform->coursemodule), $fromform, false);
}
//trigger event with information about this module.
$eventdata = new object();
$eventdata->component = 'mod/'.$fromform->modulename;
$eventdata->course = $course->id;
$eventdata->cm = $fromform->coursemodule;
events_trigger($fromform->modulename.'_mod_created', $eventdata);
add_to_log($course->id, "course", "add mod",
"../mod/$fromform->modulename/view.php?id=$fromform->coursemodule",

View File

@ -88,6 +88,12 @@ groups_groupings_deleted - int course id - deleted all course groupings
role_assigned - object role_assignments table record
role_unassigned - object role_assignments table record
==== Module Related events ====
modulename_mod_deleted - int courseid, int cmid - happens when a module is deleted -eg quiz_mod_deleted
modulename_mod_created - int courseid, int cmid - happens when a module is created -eg quiz_mod_created
modulename_mod_updated - int courseid, int cmid - happens when a module is updated -eg quiz_mod_updated
==== Assignment Related events ====
assignment_finalize_sent - object course, object user, object cm, object assignment, fileareaname