Skip to content

Commit

Permalink
Merge branch 'MDL-27483' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jul 11, 2011
2 parents 97c5f85 + 7bf53cf commit cf5b3da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion mod/quiz/lib.php
Expand Up @@ -101,7 +101,8 @@ function quiz_update_instance($quiz, $mform) {
// Repaginate, if asked to.
if (!$quiz->shufflequestions && !empty($quiz->repaginatenow)) {
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
$quiz->questions = quiz_repaginate($oldquiz->questions, $quiz->questionsperpage);
$quiz->questions = quiz_repaginate(quiz_clean_layout($oldquiz->questions, true),
$quiz->questionsperpage);
}
unset($quiz->repaginatenow);

Expand Down
10 changes: 5 additions & 5 deletions mod/quiz/locallib.php
Expand Up @@ -84,11 +84,9 @@ function quiz_create_attempt($quiz, $attemptnumber, $lastattempt, $timenow, $isp
$attempt->quiz = $quiz->id;
$attempt->userid = $USER->id;
$attempt->preview = 0;
$attempt->layout = quiz_clean_layout($quiz->questions, true);
if ($quiz->shufflequestions) {
$attempt->layout = quiz_clean_layout(quiz_repaginate(
$quiz->questions, $quiz->questionsperpage, true), true);
} else {
$attempt->layout = quiz_clean_layout($quiz->questions, true);
$attempt->layout = quiz_repaginate($attempt->layout, $quiz->questionsperpage, true);
}
} else {
// Build on last attempt.
Expand Down Expand Up @@ -240,7 +238,9 @@ function quiz_number_of_questions_in_quiz($layout) {
/**
* Re-paginates the quiz layout
*
* @param string $layout The string representing the quiz layout.
* @param string $layout The string representing the quiz layout. If there is
* if there is any doubt about the quality of the input data, call
* quiz_clean_layout before you call this function.
* @param int $perpage The number of questions per page
* @param bool $shuffle Should the questions be reordered randomly?
* @return string the new layout string
Expand Down

0 comments on commit cf5b3da

Please sign in to comment.