Skip to content
Browse files

Merge branch 'MDL-29097_mod_update_create_21' of git://github.com/and…

…yjdavis/moodle into MOODLE_21_STABLE
  • Loading branch information...
2 parents 79d5769 + ce9ad8d commit 21defa3d5e0429350407bdb7292c54f7be07a3d7 @nebgor nebgor committed Jan 31, 2012
Showing with 14 additions and 16 deletions.
  1. +14 −16 course/modedit.php
View
30 course/modedit.php
@@ -279,6 +279,9 @@
$fromform->completiongradeitemnumber = null;
}
+ // the type of event to trigger (mod_created/mod_updated)
+ $eventname = '';
+
if (!empty($fromform->update)) {
if (!empty($course->groupmodeforce) or !isset($fromform->groupmode)) {
@@ -342,14 +345,7 @@
$completion->reset_all_state($cm);
}
- // Trigger mod_updated event with information about this module.
- $eventdata = new stdClass();
- $eventdata->modulename = $fromform->modulename;
- $eventdata->name = $fromform->name;
- $eventdata->cmid = $fromform->coursemodule;
- $eventdata->courseid = $course->id;
- $eventdata->userid = $USER->id;
- events_trigger('mod_updated', $eventdata);
+ $eventname = 'mod_updated';
add_to_log($course->id, "course", "update mod",
"../mod/$fromform->modulename/view.php?id=$fromform->coursemodule",
@@ -454,14 +450,7 @@
condition_info::update_cm_from_form((object)array('id'=>$fromform->coursemodule), $fromform, false);
}
- // Trigger mod_created event with information about this module.
- $eventdata = new stdClass();
- $eventdata->modulename = $fromform->modulename;
- $eventdata->name = $fromform->name;
- $eventdata->cmid = $fromform->coursemodule;
- $eventdata->courseid = $course->id;
- $eventdata->userid = $USER->id;
- events_trigger('mod_created', $eventdata);
+ $eventname = 'mod_created';
add_to_log($course->id, "course", "add mod",
"../mod/$fromform->modulename/view.php?id=$fromform->coursemodule",
@@ -473,6 +462,15 @@
print_error('invaliddata');
}
+ // Trigger mod_created/mod_updated event with information about this module.
+ $eventdata = new stdClass();
+ $eventdata->modulename = $fromform->modulename;
+ $eventdata->name = $fromform->name;
+ $eventdata->cmid = $fromform->coursemodule;
+ $eventdata->courseid = $course->id;
+ $eventdata->userid = $USER->id;
+ events_trigger($eventname, $eventdata);
+
// sync idnumber with grade_item
if ($grade_item = grade_item::fetch(array('itemtype'=>'mod', 'itemmodule'=>$fromform->modulename,
'iteminstance'=>$fromform->instance, 'itemnumber'=>0, 'courseid'=>$course->id))) {

0 comments on commit 21defa3

Please sign in to comment.
Something went wrong with that request. Please try again.