MDL-29920: grade.php in assignment now can show submission/feedback for a particular user (also when submission did not exist yet)

This commit is contained in:
Marina Glancy 2011-11-01 08:48:33 +08:00 committed by David Mudrak
parent bb17ac1e32
commit 63b9a6d07d

View File

@ -3,6 +3,7 @@
require_once("../../config.php");
$id = required_param('id', PARAM_INT); // Course module ID
$userid = optional_param('userid', 0, PARAM_INT); // Graded user ID (optional)
$PAGE->set_url('/mod/assignment/grade.php', array('id'=>$id));
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
@ -20,7 +21,12 @@ if (! $course = $DB->get_record("course", array("id"=>$assignment->course))) {
require_login($course, false, $cm);
if (has_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) {
redirect('submissions.php?id='.$cm->id);
if ($userid) {
redirect('submissions.php?id='.$cm->id.'&userid='.$userid.'&mode=single&filter=0&offset=0');
} else {
redirect('submissions.php?id='.$cm->id);
}
} else {
// user will view his own submission, parameter $userid is ignored
redirect('view.php?id='.$cm->id);
}