diff --git a/mod/quiz/accessrules.php b/mod/quiz/accessrules.php index 73f8f26f59e..34fcd96cfe0 100644 --- a/mod/quiz/accessrules.php +++ b/mod/quiz/accessrules.php @@ -607,11 +607,8 @@ class password_access_rule extends quiz_access_rule_base { * * @param boolean $canpreview used to enfore securewindow stuff. * @param object $accessmanager the accessmanager calling us. - * @param boolean $return if true, return the HTML for the form (if required), instead of - * outputting it at stopping - * @return mixed return null, unless $return is true, and a form needs to be displayed. */ - public function do_password_check($canpreview, $accessmanager, $return = false) { + public function do_password_check($canpreview, $accessmanager) { global $CFG, $SESSION, $OUTPUT, $PAGE; /// We have already checked the password for this quiz this session, so don't ask again. @@ -647,9 +644,7 @@ class password_access_rule extends quiz_access_rule_base { $output = ''; /// Start the page and print the quiz intro, if any. - if (!$return) { - echo $OUTPUT->header(); - } + echo $OUTPUT->header(); if (trim(strip_tags($this->_quiz->intro))) { $cm = get_coursemodule_from_id('quiz', $this->_quiz->id); $output .= $OUTPUT->box(format_module_intro('quiz', $this->_quiz, $cm->id), 'generalbox', 'intro'); @@ -681,13 +676,9 @@ class password_access_rule extends quiz_access_rule_base { $output .= $OUTPUT->box_end(); /// return or display form. - if ($return) { - return $output; - } else { - echo $output; - echo $OUTPUT->footer(); - exit; - } + echo $output; + echo $OUTPUT->footer(); + exit; } } diff --git a/mod/quiz/attemptlib.php b/mod/quiz/attemptlib.php index 2b17e1280e3..42c782c762d 100644 --- a/mod/quiz/attemptlib.php +++ b/mod/quiz/attemptlib.php @@ -95,7 +95,7 @@ class quiz { * * @param integer $quizid the the quiz id. * @param integer $userid the the userid. - * @return object the new quiz object + * @return quiz the new quiz object */ static public function create($quizid, $userid) { global $DB; diff --git a/mod/quiz/startattempt.php b/mod/quiz/startattempt.php index 6bb45b9a14b..aff98cd652e 100644 --- a/mod/quiz/startattempt.php +++ b/mod/quiz/startattempt.php @@ -29,12 +29,15 @@ if (!$quiz = $DB->get_record('quiz', array('id' => $cm->instance))) { } $quizobj = quiz::create($quiz->id, $USER->id); +// This script should only ever be posted to, so set page URL to the view page. +$PAGE->set_url($quizobj->view_url()); /// Check login and sesskey. require_login($quizobj->get_courseid(), false, $quizobj->get_cm()); if (!confirm_sesskey()) { throw new moodle_exception('confirmsesskeybad', 'error', $quizobj->view_url()); } +$PAGE->set_pagelayout('base'); /// if no questions have been set up yet redirect to edit.php if (!$quizobj->get_question_ids() && $quizobj->has_capability('mod/quiz:manage')) {