Update course cache when modules are moved up or down

This commit is contained in:
moodler
2002-11-10 14:45:11 +00:00
parent 76d6be7020
commit 7c0f298426
2 changed files with 11 additions and 7 deletions
+1 -5
View File
@@ -722,17 +722,13 @@ function delete_mod_from_section($mod, $section) {
}
function move_module($id, $move) {
function move_module($cm, $move) {
GLOBAL $db;
if (!$move) {
return true;
}
if (! $cm = get_record("course_modules", "id", $id)) {
error("This course module doesn't exist");
}
if (! $thissection = get_record("course_sections", "id", $cm->section)) {
error("This course section doesn't exist");
}
+10 -2
View File
@@ -87,7 +87,6 @@
}
$modinfo = serialize(get_array_of_activities($mod->course));
if (!set_field("course", "modinfo", $modinfo, "id", $mod->course)) {
error("Could not cache module information!");
}
@@ -108,7 +107,16 @@
require_variable($id);
move_module($id, $move);
if (! $cm = get_record("course_modules", "id", $id)) {
error("This course module doesn't exist");
}
move_module($cm, $move);
$modinfo = serialize(get_array_of_activities($cm->course));
if (!set_field("course", "modinfo", $modinfo, "id", $cm->course)) {
error("Could not cache module information!");
}
redirect($HTTP_REFERER);
exit;