Skip to content

Commit

Permalink
mod_quiz MDL-26178 it let you try to preview a quiz with several empt…
Browse files Browse the repository at this point in the history
…y pages.

You should not be allowed to preview an empty quiz, to make it correctly detect this case.
  • Loading branch information
timhunt committed Jan 29, 2011
1 parent 8cdc85a commit 2cb01c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mod/quiz/attemptlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,14 @@ protected function determine_layout() {
$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) == '') {
Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2cb01c9

Please sign in to comment.