Skip to content

Commit

Permalink
MDL-12934 temporary fix for grade items of activities without proper …
Browse files Browse the repository at this point in the history
…course module record; merged from MOODLE_19_STABLE
  • Loading branch information
skodak committed Feb 17, 2008
1 parent 2be2c4c commit 46d1af8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions grade/lib.php
Expand Up @@ -852,19 +852,18 @@ function get_element_header(&$element, $withlink=false, $icon=true, $spacerifnon
$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;
Expand Down

0 comments on commit 46d1af8

Please sign in to comment.