MDL-29920 The link from gradebook back to the activity contains itemnumber

The activity module must have a chance to display appropriate grades
report per itemnumber. Most activity modules have just one grade items
si they can ignore the param. Complex modules like the Workshop need this.
This commit is contained in:
David Mudrak 2011-11-01 18:18:45 +01:00
parent 49a537b356
commit 25ab1d50e2

View File

@ -1145,6 +1145,7 @@ class grade_structure {
$itemtype = $element['object']->itemtype; $itemtype = $element['object']->itemtype;
$itemmodule = $element['object']->itemmodule; $itemmodule = $element['object']->itemmodule;
$iteminstance = $element['object']->iteminstance; $iteminstance = $element['object']->iteminstance;
$itemnumber = $element['object']->itemnumber;
// Links only for module items that have valid instance, module and are // Links only for module items that have valid instance, module and are
// called from grade_tree with valid modinfo // called from grade_tree with valid modinfo
@ -1167,7 +1168,7 @@ class grade_structure {
// If module has grade.php, link to that, otherwise view.php // If module has grade.php, link to that, otherwise view.php
$dir = $CFG->dirroot . '/mod/' . $itemmodule; $dir = $CFG->dirroot . '/mod/' . $itemmodule;
if (file_exists($dir.'/grade.php')) { if (file_exists($dir.'/grade.php')) {
return new moodle_url('/mod/' . $itemmodule . '/grade.php', array('id' => $cm->id)); return new moodle_url('/mod/' . $itemmodule . '/grade.php', array('id' => $cm->id, 'itemnumber' => $itemnumber));
} else { } else {
return new moodle_url('/mod/' . $itemmodule . '/view.php', array('id' => $cm->id)); return new moodle_url('/mod/' . $itemmodule . '/view.php', array('id' => $cm->id));
} }