mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-52750 quiz reviewQ/comment: add page title & student name
This commit is contained in:
parent
e8d5100212
commit
a4100d4de3
@ -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'),
|
||||
|
@ -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';
|
||||
|
@ -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,
|
||||
|
@ -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)),
|
||||
|
@ -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'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user