]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12934 temporary fix for grade items of activities without proper course module...
authorskodak <skodak>
Sun, 17 Feb 2008 19:04:01 +0000 (19:04 +0000)
committerskodak <skodak>
Sun, 17 Feb 2008 19:04:01 +0000 (19:04 +0000)
grade/lib.php

index 2a3becfbeec2ffc1d0a769a1c7421e6043a3f7dd..2dd51eeb3214a28698483dc6d156b6a1f58751bc 100644 (file)
@@ -852,19 +852,18 @@ class grade_structure {
         $iteminstance = $element['object']->iteminstance;
 
         if ($withlink and $itemtype=='mod' and $iteminstance and $itemmodule) {
-            if (!$cm = get_coursemodule_from_instance($itemmodule, $iteminstance, $this->courseid)) {
-                continue;
-            }
+            if ($cm = get_coursemodule_from_instance($itemmodule, $iteminstance, $this->courseid)) {
 
-            $dir = $CFG->dirroot.'/mod/'.$itemmodule;
+                $dir = $CFG->dirroot.'/mod/'.$itemmodule;
 
-            if (file_exists($dir.'/grade.php')) {
-                $url = $CFG->wwwroot.'/mod/'.$itemmodule.'/grade.php?id='.$cm->id;
-            } else {
-                $url = $CFG->wwwroot.'/mod/'.$itemmodule.'/view.php?id='.$cm->id;
-            }
+                if (file_exists($dir.'/grade.php')) {
+                    $url = $CFG->wwwroot.'/mod/'.$itemmodule.'/grade.php?id='.$cm->id;
+                } else {
+                    $url = $CFG->wwwroot.'/mod/'.$itemmodule.'/view.php?id='.$cm->id;
+                }
 
-            $header = '<a href="'.$url.'">'.$header.'</a>';
+                $header = '<a href="'.$url.'">'.$header.'</a>';
+            }
         }
 
         return $header;