* @author Martin Dougiamas, Tim Hunt and many others. * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package quiz */ require_once dirname(__FILE__) . '/../../config.php'; require_once 'locallib.php'; $attemptid = required_param('attempt', PARAM_INT); // attempt id $questionid = required_param('question', PARAM_INT); // question id $stateid = optional_param('state', 0, PARAM_INT); // state id $attemptobj = new quiz_attempt($attemptid); /// Check login. require_login($attemptobj->get_courseid(), false, $attemptobj->get_cm()); $attemptobj->check_review_capability(); /// Permissions checks for normal users who do not have quiz:viewreports capability. if (!$attemptobj->has_capability('mod/quiz:viewreports')) { /// Can't review during the attempt - send them back to the attempt page. if (!$attemptobj->is_finished()) { notify(get_string('cannotreviewopen', 'quiz')); close_window_button(); } /// Can't review other users' attempts. if (!$attemptobj->is_own_attempt()) { notify(get_string('notyourattempt', 'quiz')); close_window_button(); } /// Can't review unless Students may review -> Responses option is turned on. if (!$options->responses) { $accessmanager = $attemptobj->get_access_manager(time());