MDL-9983, adding triggers for certain events, no handler implemented

This commit is contained in:
toyomoyo 2007-07-09 06:43:33 +00:00
parent 52bb13dc9f
commit e513826187
9 changed files with 45 additions and 5 deletions

View File

@ -87,6 +87,9 @@
fix_course_sortorder($category->id);
}
}
// MDL-9983
events_trigger('category_updated', $category);
}

View File

@ -71,6 +71,9 @@
delete_course($course->id);
fix_course_sortorder(); //update course count in catagories
// MDL-9983
events_trigger('course_deleted', $course);
print_heading( get_string("deletedcourse", "", format_string($course->shortname)) );
print_continue("category.php?id=$course->category");

View File

@ -106,11 +106,12 @@
redirect($CFG->wwwroot."/$CFG->admin/roles/assign.php?contextid=$context->id");
}
} else {
} else {
if (!update_course($data)) {
print_error('coursenotupdated');
}
// MDL-9983
events_trigger('course_updated', $data);
redirect($CFG->wwwroot."/course/view.php?id=$course->id");
}
}

View File

@ -149,7 +149,9 @@
/// Finally delete the category itself
if (delete_records('course_categories', 'id', $deletecat->id)) {
notify(get_string('categorydeleted', '', format_string($deletecat->name)));
}
// MLD-9983
events_trigger('category_deleted', $deletecat);
}
}
else {
$strdeletecategorycheck = get_string('deletecategorycheck','', format_string($deletecat->name));

View File

@ -67,6 +67,12 @@ if ($success) {
if (! $success) {
print_error('erroraddremoveuser', 'group', groups_home_url($courseid));
}
// MDL-9983
$eventdata = new object();
$eventdata -> groupid = $groupid;
$eventdata -> userid = $userid;
events_trigger('group_user_removed', $eventdata);
}
}
}

View File

@ -83,6 +83,8 @@ if ($delete) {
error('Sesskey error');
}
if (groups_delete_group($id)) {
// MDL-9983
events_trigger('group_deleted', $id);
redirect(groups_home_url($course->id, null, $groupingid, false));
} else {
print_error('erroreditgroup', 'group', groups_home_url($course->id));
@ -108,8 +110,12 @@ if ($editform->is_cancelled()) {
$data->id = $id;
if ($groupingid) {
$success = $success && groups_add_group_to_grouping($id, $groupingid);
}
}
}
// MDL-9983
if ($success) {
events_trigger('group_created', $data);
}
}
} elseif ($groupingid != $newgrouping) { // Moving group to new grouping
$success = $success && groups_remove_group_from_grouping($id, $groupingid);
$success = $success && groups_add_group_to_grouping($id, $newgrouping);
@ -121,6 +127,10 @@ if ($editform->is_cancelled()) {
} elseif (!groups_update_group($data, $course->id)) {
print_error('groupnotupdated');
}
// MDL-9983
if ($success) {
events_trigger('group_updated', $data);
}
}
// Handle file upload
if ($success) {

View File

@ -346,6 +346,12 @@ function groups_add_member($groupid, $userid) {
$useradded = groups_db_add_member($groupid, $userid);
}
if ($useradded) {
// MDL-9983
$eventdata = new object();
$eventdata -> groupid = $groupid;
$eventdata -> userid = $userid;
events_trigger('group_user_added', $eventdata);
$useradded = groups_db_set_group_modified($groupid);
}
return $useradded;

View File

@ -113,6 +113,12 @@
}
}
// MDL-9983
$eventdata = new object();
$eventdata -> user = $USER;
$eventdata -> newpassword = $data -> newpassword1;
events_trigger('password_changed', $eventdata);
redirect("$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id");
}

View File

@ -100,6 +100,9 @@
}
}
}
// MDL-9983
events_trigger('user_updated', $usernew);
}
//update preferences