Merge branch 'w30_MDL-39846_m26_event2' of https://github.com/skodak/moodle

This commit is contained in:
Damyon Wiese
2013-07-22 15:05:53 +08:00
22 changed files with 2440 additions and 166 deletions
+16 -4
View File
@@ -1685,7 +1685,11 @@ function role_assign($roleid, $userid, $contextid, $component = '', $itemid = 0,
reload_all_capabilities();
}
events_trigger('role_assigned', $ra);
$event = \core\event\role_assigned::create(
array('context'=>$context, 'objectid'=>$ra->roleid, 'relateduserid'=>$ra->userid,
'other'=>array('id'=>$ra->id, 'component'=>$ra->component, 'itemid'=>$ra->itemid)));
$event->add_record_snapshot('role_assignments', $ra);
$event->trigger();
return $ra->id;
}
@@ -1769,8 +1773,12 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual =
if (!empty($USER->id) && $USER->id == $ra->userid) {
reload_all_capabilities();
}
$event = \core\event\role_unassigned::create(
array('context'=>$context, 'objectid'=>$ra->roleid, 'relateduserid'=>$ra->userid,
'other'=>array('id'=>$ra->id, 'component'=>$ra->component, 'itemid'=>$ra->itemid)));
$event->add_record_snapshot('role_assignments', $ra);
$event->trigger();
}
events_trigger('role_unassigned', $ra);
}
unset($ras);
@@ -1796,7 +1804,11 @@ function role_unassign_all(array $params, $subcontexts = false, $includemanual =
if (!empty($USER->id) && $USER->id == $ra->userid) {
reload_all_capabilities();
}
events_trigger('role_unassigned', $ra);
$event = \core\event\role_unassigned::create(
array('context'=>$context, 'objectid'=>$ra->roleid, 'relateduserid'=>$ra->userid,
'other'=>array('id'=>$ra->id, 'component'=>$ra->component, 'itemid'=>$ra->itemid)));
$event->add_record_snapshot('role_assignments', $ra);
$event->trigger();
}
}
}
@@ -6901,7 +6913,7 @@ class context_module extends context {
* Is this context part of any course? If yes return course context.
*
* @param bool $strict true means throw exception if not found, false means return false if not found
* @return course_context context of the enclosing course, null if not found or exception
* @return context_course context of the enclosing course, null if not found or exception
*/
public function get_course_context($strict = true) {
return $this->get_parent_context();