MDL-38700 course: only change visibility if a module moves to a different section
This commit is contained in:
committed by
Dan Poltawski
parent
1a5d5334bf
commit
ba7c052171
+11
-9
@@ -3166,15 +3166,17 @@ function moveto_module($mod, $section, $beforemod=NULL) {
|
||||
/// Update module itself if necessary
|
||||
|
||||
// If moving to a hidden section then hide module.
|
||||
if (!$section->visible && $mod->visible) {
|
||||
// Set this in the object because it is sent as a response to ajax calls.
|
||||
set_coursemodule_visible($mod->id, 0, true);
|
||||
$mod->visible = 0;
|
||||
}
|
||||
if ($section->visible && !$mod->visible) {
|
||||
set_coursemodule_visible($mod->id, 1, true);
|
||||
// Set this in the object because it is sent as a response to ajax calls.
|
||||
$mod->visible = $mod->visibleold;
|
||||
if ($mod->section != $section->id) {
|
||||
if (!$section->visible && $mod->visible) {
|
||||
// Set this in the object because it is sent as a response to ajax calls.
|
||||
set_coursemodule_visible($mod->id, 0, true);
|
||||
$mod->visible = 0;
|
||||
}
|
||||
if ($section->visible && !$mod->visible) {
|
||||
set_coursemodule_visible($mod->id, 1, true);
|
||||
// Set this in the object because it is sent as a response to ajax calls.
|
||||
$mod->visible = $mod->visibleold;
|
||||
}
|
||||
}
|
||||
|
||||
/// Add the module into the new section
|
||||
|
||||
Reference in New Issue
Block a user