From 2cb01c9205044e67ed8431b023898a7d5ca22912 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Sat, 29 Jan 2011 12:11:10 +0000 Subject: [PATCH] mod_quiz MDL-26178 it let you try to preview a quiz with several empty pages. You should not be allowed to preview an empty quiz, to make it correctly detect this case. --- mod/quiz/attemptlib.php | 4 ++-- mod/quiz/view.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/quiz/attemptlib.php b/mod/quiz/attemptlib.php index 7580482a41d..adf3a44ae84 100644 --- a/mod/quiz/attemptlib.php +++ b/mod/quiz/attemptlib.php @@ -375,14 +375,14 @@ class quiz { $this->pagequestionids = array(); // Get the appropriate layout string (from quiz or attempt). - $layout = $this->get_layout_string(); + $layout = quiz_clean_layout($this->get_layout_string(), true); if (empty($layout)) { // Nothing to do. return; } // Break up the layout string into pages. - $pagelayouts = explode(',0', quiz_clean_layout($layout, true)); + $pagelayouts = explode(',0', $layout); // Strip off any empty last page (normally there is one). if (end($pagelayouts) == '') { diff --git a/mod/quiz/view.php b/mod/quiz/view.php index 36e1d94ca3f..7b816bc672a 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -339,7 +339,7 @@ /// or a button to go back to the course page. echo $OUTPUT->box_start('quizattempt'); $buttontext = ''; // This will be set something if as start/continue attempt button should appear. - if (!$quiz->questions) { + if (!quiz_clean_layout($quiz->questions, true)) { echo $OUTPUT->heading(get_string("noquestions", "quiz")); } else { if ($unfinished) { -- 2.43.0