Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-29176_21' of git://github.com/timhunt/moodle into M…

…OODLE_21_STABLE
  • Loading branch information...
commit f158171c0bc6a49f8ea82bf43b9c7de649cfd506 2 parents dd98ec6 + 5c91aac
@samhemelryk samhemelryk authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 mod/quiz/edit.php
View
10 mod/quiz/edit.php
@@ -356,11 +356,19 @@ function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmo
//move to the end of the selected page
$pagebreakpositions = array_keys($questions, 0);
$numpages = count($pagebreakpositions);
+
// Ensure the target page number is in range.
- $moveselectedonpage = max(1, min($moveselectedonpage, $pagebreakpositions));
+ for ($i = $moveselectedonpage; $i > $numpages; $i--) {
+ $questions[] = 0;
+ $pagebreakpositions[] = count($questions) - 1;
+ }
$moveselectedpos = $pagebreakpositions[$moveselectedonpage - 1];
+
+ // Do the move.
array_splice($questions, $moveselectedpos, 0, $selectedquestionids);
$quiz->questions = implode(',', $questions);
+
+ // Update the database.
$DB->set_field('quiz', 'questions', $quiz->questions, array('id' => $quiz->id));
$deletepreviews = true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.