Permalink
Browse files

Merge branch 'MDL-36757_hidden_23' of git://github.com/andyjdavis/moo…

…dle into MOODLE_23_STABLE
  • Loading branch information...
2 parents e61f96c + f86473c commit cfdc33bf08f6991fbe6174f88d436735eeae0692 Sam Hemelryk committed Jan 20, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 course/lib.php
View
@@ -2879,6 +2879,13 @@ function set_coursemodule_visible($id, $visible, $prevstateoverrides=false) {
if (!$cm = $DB->get_record('course_modules', array('id'=>$id))) {
return false;
}
+
+ // Create events and propagate visibility to associated grade items if the value has changed.
+ // Only do this if it's changed to avoid accidently overwriting manual showing/hiding of student grades.
+ if ($cm->visible == $visible) {
+ return true;
+ }
+
if (!$modulename = $DB->get_field('modules', 'name', array('id'=>$cm->module))) {
return false;
}
@@ -2892,7 +2899,7 @@ function set_coursemodule_visible($id, $visible, $prevstateoverrides=false) {
}
}
- // hide the associated grade items so the teacher doesn't also have to go to the gradebook and hide them there
+ // Hide the associated grade items so the teacher doesn't also have to go to the gradebook and hide them there.
$grade_items = grade_item::fetch_all(array('itemtype'=>'mod', 'itemmodule'=>$modulename, 'iteminstance'=>$cm->instance, 'courseid'=>$cm->course));
if ($grade_items) {
foreach ($grade_items as $grade_item) {

0 comments on commit cfdc33b

Please sign in to comment.