Update course cache when modules are moved up or down
This commit is contained in:
+1
-5
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user