From 46d1af82f7d8c0376dda4e1c23212d13aaec780b Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 17 Feb 2008 19:04:01 +0000 Subject: [PATCH] MDL-12934 temporary fix for grade items of activities without proper course module record; merged from MOODLE_19_STABLE --- grade/lib.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/grade/lib.php b/grade/lib.php index 2a3becfbee..2dd51eeb32 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -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 = ''.$header.''; + $header = ''.$header.''; + } } return $header; -- 2.39.5