diff --git a/mod/quiz/comment.php b/mod/quiz/comment.php index c1961ab2a8d..08942de22db 100644 --- a/mod/quiz/comment.php +++ b/mod/quiz/comment.php @@ -32,6 +32,7 @@ $slot = required_param('slot', PARAM_INT); // The question number in the attempt $PAGE->set_url('/mod/quiz/comment.php', array('attempt' => $attemptid, 'slot' => $slot)); $attemptobj = quiz_attempt::create($attemptid); +$student = $DB->get_record('user', array('id' => $attemptobj->get_userid())); // Can only grade finished attempts. if (!$attemptobj->is_finished()) { @@ -44,6 +45,9 @@ $attemptobj->require_capability('mod/quiz:grade'); // Print the page header. $PAGE->set_pagelayout('popup'); +$PAGE->set_title(get_string('manualgradequestion', 'quiz', array( + 'question' => format_string($attemptobj->get_question_name($slot)), + 'quiz' => format_string($attemptobj->get_quiz_name()), 'user' => fullname($student)))); $PAGE->set_heading($attemptobj->get_course()->fullname); $output = $PAGE->get_renderer('mod_quiz'); echo $output->header(); @@ -51,6 +55,16 @@ echo $output->header(); // Prepare summary information about this question attempt. $summarydata = array(); +// Student name. +$userpicture = new user_picture($student); +$userpicture->courseid = $attemptobj->get_courseid(); +$summarydata['user'] = array( + 'title' => $userpicture, + 'content' => new action_link(new moodle_url('/user/view.php', array( + 'id' => $student->id, 'course' => $attemptobj->get_courseid())), + fullname($student, true)), +); + // Quiz name. $summarydata['quizname'] = array( 'title' => get_string('modulename', 'quiz'), diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index 7f5f0844474..bf8cf68f543 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -458,6 +458,7 @@ $string['loadingquestionsfailed'] = 'Loading questions failed: {$a}'; $string['makecopy'] = 'Save as new question'; $string['managetypes'] = 'Manage question types and servers'; $string['manualgrading'] = 'Grading'; +$string['manualgradequestion'] = 'Manually grade question {$a->question} in {$a->quiz} by {$a->user}'; $string['mark'] = 'Submit'; $string['markall'] = 'Submit page'; $string['marks'] = 'Marks'; @@ -771,6 +772,7 @@ $string['reviewimmediately'] = 'Immediately after the attempt'; $string['reviewnever'] = 'Never allow review'; $string['reviewofattempt'] = 'Review of attempt {$a}'; $string['reviewofpreview'] = 'Review of preview'; +$string['reviewofquestion'] = 'Review of question {$a->question} in {$a->quiz} by {$a->user}'; $string['reviewopen'] = 'Later, while the quiz is still open'; $string['reviewoptions'] = 'Students may review'; $string['reviewoptionsheading'] = 'Review options'; diff --git a/mod/quiz/renderer.php b/mod/quiz/renderer.php index b11ed81803e..55417311ad3 100644 --- a/mod/quiz/renderer.php +++ b/mod/quiz/renderer.php @@ -92,10 +92,11 @@ class mod_quiz_renderer extends plugin_renderer_base { /** * Renders the review question pop-up. * + * @param quiz_attempt $attemptobj an instance of quiz_attempt. * @param string $message Why the review is not allowed. * @return string html to output. */ - public function review_question_not_allowed($message) { + public function review_question_not_allowed(quiz_attempt $attemptobj, $message) { $output = ''; $output .= $this->header(); $output .= $this->heading(format_string($attemptobj->get_quiz_name(), true, diff --git a/mod/quiz/review.php b/mod/quiz/review.php index eebab6b5460..be91bd64b6a 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -134,10 +134,10 @@ $summarydata = array(); if (!$attemptobj->get_quiz()->showuserpicture && $attemptobj->get_userid() != $USER->id) { // If showuserpicture is true, the picture is shown elsewhere, so don't repeat it. $student = $DB->get_record('user', array('id' => $attemptobj->get_userid())); - $usrepicture = new user_picture($student); - $usrepicture->courseid = $attemptobj->get_courseid(); + $userpicture = new user_picture($student); + $userpicture->courseid = $attemptobj->get_courseid(); $summarydata['user'] = array( - 'title' => $usrepicture, + 'title' => $userpicture, 'content' => new action_link(new moodle_url('/user/view.php', array( 'id' => $student->id, 'course' => $attemptobj->get_courseid())), fullname($student, true)), diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php index e7bcf91f275..7a6e2a189e4 100644 --- a/mod/quiz/reviewquestion.php +++ b/mod/quiz/reviewquestion.php @@ -44,11 +44,15 @@ $attemptobj = quiz_attempt::create($attemptid); // Check login. require_login($attemptobj->get_course(), false, $attemptobj->get_cm()); $attemptobj->check_review_capability(); +$student = $DB->get_record('user', array('id' => $attemptobj->get_userid())); $accessmanager = $attemptobj->get_access_manager(time()); $options = $attemptobj->get_display_options(true); $PAGE->set_pagelayout('popup'); +$PAGE->set_title(get_string('reviewofquestion', 'quiz', array( + 'question' => format_string($attemptobj->get_question_name($slot)), + 'quiz' => format_string($attemptobj->get_quiz_name()), 'user' => fullname($student)))); $PAGE->set_heading($attemptobj->get_course()->fullname); $output = $PAGE->get_renderer('mod_quiz'); @@ -56,10 +60,10 @@ $output = $PAGE->get_renderer('mod_quiz'); // quiz_attempt::check_file_access. If you change on, change them all. if ($attemptobj->is_own_attempt()) { if (!$attemptobj->is_finished()) { - echo $output->review_question_not_allowed(get_string('cannotreviewopen', 'quiz')); + echo $output->review_question_not_allowed($attemptobj, get_string('cannotreviewopen', 'quiz')); die(); } else if (!$options->attempt) { - echo $output->review_question_not_allowed( + echo $output->review_question_not_allowed($attemptobj, $attemptobj->cannot_review_message()); die(); } @@ -71,6 +75,16 @@ if ($attemptobj->is_own_attempt()) { // Prepare summary informat about this question attempt. $summarydata = array(); +// Student name. +$userpicture = new user_picture($student); +$userpicture->courseid = $attemptobj->get_courseid(); +$summarydata['user'] = array( + 'title' => $userpicture, + 'content' => new action_link(new moodle_url('/user/view.php', array( + 'id' => $student->id, 'course' => $attemptobj->get_courseid())), + fullname($student, true)), +); + // Quiz name. $summarydata['quizname'] = array( 'title' => get_string('modulename', 'quiz'),