[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * This page prints a review of a particular question attempt. 19 * This page is expected to only be used in a popup window. 20 * 21 * @package mod_quiz 22 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 27 require_once(__DIR__ . '/../../config.php'); 28 require_once ('locallib.php'); 29 30 $attemptid = required_param('attempt', PARAM_INT); 31 $slot = required_param('slot', PARAM_INT); 32 $seq = optional_param('step', null, PARAM_INT); 33 34 $baseurl = new moodle_url('/mod/quiz/reviewquestion.php', 35 array('attempt' => $attemptid, 'slot' => $slot)); 36 $currenturl = new moodle_url($baseurl); 37 if (!is_null($seq)) { 38 $currenturl->param('step', $seq); 39 } 40 $PAGE->set_url($currenturl); 41 42 $attemptobj = quiz_attempt::create($attemptid); 43 44 // Check login. 45 require_login($attemptobj->get_course(), false, $attemptobj->get_cm()); 46 $attemptobj->check_review_capability(); 47 $student = $DB->get_record('user', array('id' => $attemptobj->get_userid())); 48 49 $accessmanager = $attemptobj->get_access_manager(time()); 50 $options = $attemptobj->get_display_options(true); 51 52 $PAGE->set_pagelayout('popup'); 53 $PAGE->set_title(get_string('reviewofquestion', 'quiz', array( 54 'question' => format_string($attemptobj->get_question_name($slot)), 55 'quiz' => format_string($attemptobj->get_quiz_name()), 'user' => fullname($student)))); 56 $PAGE->set_heading($attemptobj->get_course()->fullname); 57 $output = $PAGE->get_renderer('mod_quiz'); 58 59 // Check permissions - warning there is similar code in review.php and 60 // quiz_attempt::check_file_access. If you change on, change them all. 61 if ($attemptobj->is_own_attempt()) { 62 if (!$attemptobj->is_finished()) { 63 echo $output->review_question_not_allowed($attemptobj, get_string('cannotreviewopen', 'quiz')); 64 die(); 65 } else if (!$options->attempt) { 66 echo $output->review_question_not_allowed($attemptobj, 67 $attemptobj->cannot_review_message()); 68 die(); 69 } 70 71 } else if (!$attemptobj->is_review_allowed()) { 72 throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'noreviewattempt'); 73 } 74 75 // Prepare summary informat about this question attempt. 76 $summarydata = array(); 77 78 // Student name. 79 $userpicture = new user_picture($student); 80 $userpicture->courseid = $attemptobj->get_courseid(); 81 $summarydata['user'] = array( 82 'title' => $userpicture, 83 'content' => new action_link(new moodle_url('/user/view.php', array( 84 'id' => $student->id, 'course' => $attemptobj->get_courseid())), 85 fullname($student, true)), 86 ); 87 88 // Quiz name. 89 $summarydata['quizname'] = array( 90 'title' => get_string('modulename', 'quiz'), 91 'content' => format_string($attemptobj->get_quiz_name()), 92 ); 93 94 // Question name. 95 $summarydata['questionname'] = array( 96 'title' => get_string('question', 'quiz'), 97 'content' => $attemptobj->get_question_name($slot), 98 ); 99 100 // Other attempts at the quiz. 101 if ($attemptobj->has_capability('mod/quiz:viewreports')) { 102 $attemptlist = $attemptobj->links_to_other_attempts($baseurl); 103 if ($attemptlist) { 104 $summarydata['attemptlist'] = array( 105 'title' => get_string('attempts', 'quiz'), 106 'content' => $attemptlist, 107 ); 108 } 109 } 110 111 // Timestamp of this action. 112 $timestamp = $attemptobj->get_question_action_time($slot); 113 if ($timestamp) { 114 $summarydata['timestamp'] = array( 115 'title' => get_string('completedon', 'quiz'), 116 'content' => userdate($timestamp), 117 ); 118 } 119 120 echo $output->review_question_page($attemptobj, $slot, $seq, 121 $attemptobj->get_display_options(true), $summarydata);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |