MDL-29112 trigger event mod_deleted after deleting mod through AJAX
authorSun Zhigang <sunner@gmail.com>
Thu, 25 Aug 2011 10:47:35 +0000 (18:47 +0800)
committerSam Hemelryk <sam@moodle.com>
Mon, 12 Sep 2011 05:36:02 +0000 (17:36 +1200)
course/rest.php

index 7c6c04f..17be668 100644 (file)
@@ -209,6 +209,14 @@ switch($requestmethod) {
                     error_log("Ajax rest.php: Could not delete the $cm->modname $cm->name from section");
                 }
 
+                // Trigger a mod_deleted event with information about this module.
+                $eventdata = new stdClass();
+                $eventdata->modulename = $cm->modname;
+                $eventdata->cmid       = $cm->id;
+                $eventdata->courseid   = $course->id;
+                $eventdata->userid     = $USER->id;
+                events_trigger('mod_deleted', $eventdata);
+
                 rebuild_course_cache($course->id);
 
                 add_to_log($courseid, "course", "delete mod",