### Eclipse Workspace Patch 1.0
#P moodle
Index: course/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/course/lib.php,v
retrieving revision 1.538.2.56
diff -u -r1.538.2.56 lib.php
--- course/lib.php	13 Nov 2008 08:21:47 -0000	1.538.2.56
+++ course/lib.php	15 Nov 2008 12:57:09 -0000
@@ -2215,6 +2215,8 @@
 * the course module back to what it was originally.
 */
 function set_coursemodule_visible($id, $visible, $prevstateoverrides=false) {
+    global $CFG;
+    
     if (!$cm = get_record('course_modules', 'id', $id)) {
         return false;
     }
@@ -2230,6 +2232,13 @@
             }
         }
     }
+    
+    require_once($CFG->libdir.'/gradelib.php');
+    $grade_item = grade_item::fetch(array('itemtype'=>'mod', 'itemmodule'=>$modulename, 'iteminstance'=>$cm->instance, 'courseid'=>$cm->course));
+    if ($grade_item !== false) {
+        $grade_item->set_hidden(!$visible);
+    }
+    
     if ($prevstateoverrides) {
         if ($visible == '0') {
             // Remember the current visible state so we can toggle this back.
