mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-12934 temporary fix for grade items of activities without proper course module record; merged from MOODLE_19_STABLE
This commit is contained in:
parent
2be2c4c2cd
commit
46d1af82f7
@ -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;
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
$header = '<a href="'.$url.'">'.$header.'</a>';
|
||||
}
|
||||
|
||||
return $header;
|
||||
|
Loading…
x
Reference in New Issue
Block a user