Skip to content

Commit

Permalink
MDL-38700 course: only change visibility if a module moves to a diffe…
Browse files Browse the repository at this point in the history
…rent section
  • Loading branch information
mackensen authored and danpoltawski committed Mar 26, 2013
1 parent 1fff1b8 commit bb1592c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions course/lib.php
Expand Up @@ -2467,17 +2467,19 @@ function moveto_module($mod, $section, $beforemod=NULL) {
} }


// if moving to a hidden section then hide module // if moving to a hidden section then hide module
if (!$section->visible && $mod->visible) { if ($mod->section != $section->id) {
// Set this in the object because it is sent as a response to ajax calls. if (!$section->visible && $mod->visible) {
$mod->visible = 0; // Set this in the object because it is sent as a response to ajax calls.
set_coursemodule_visible($mod->id, 0); $mod->visible = 0;
// Set visibleold to 1 so module will be visible when section is made visible. set_coursemodule_visible($mod->id, 0);
$DB->set_field('course_modules', 'visibleold', 1, array('id' => $mod->id)); // Set visibleold to 1 so module will be visible when section is made visible.
} $DB->set_field('course_modules', 'visibleold', 1, array('id' => $mod->id));
if ($section->visible && !$mod->visible) { }
set_coursemodule_visible($mod->id, $mod->visibleold); 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, $mod->visibleold);
$mod->visible = $mod->visibleold; // 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 /// Add the module into the new section
Expand Down

0 comments on commit bb1592c

Please sign in to comment.