mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
quiz editing MDL-25391 creating a new question and adding it directly to the quiz was broken.
Thanks to Chad Outten for finding this before it was too late, and skodak for the review.
This commit is contained in:
parent
ad85f2629d
commit
f2956c9813
@ -515,7 +515,7 @@ if ($quiz_reordertool) {
|
||||
}
|
||||
|
||||
quiz_print_question_list($quiz, $thispageurl, true,
|
||||
$quiz_reordertool, $quiz_qbanktool, $quizhasattempts);
|
||||
$quiz_reordertool, $quiz_qbanktool, $quizhasattempts, $defaultcategoryobj);
|
||||
echo '</div>';
|
||||
|
||||
// Close <div class="quizcontents">:
|
||||
|
@ -328,9 +328,8 @@ function quiz_move_question_down($layout, $questionid) {
|
||||
* @param boolean $quiz_qbanktool Indicates whether the question bank should be displayed
|
||||
* @param boolean $hasattempts Indicates whether the quiz has attempts
|
||||
*/
|
||||
function quiz_print_question_list($quiz, $pageurl, $allowdelete = true,
|
||||
$reordertool = false, $quiz_qbanktool = false,
|
||||
$hasattempts = false) {
|
||||
function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool,
|
||||
$quiz_qbanktool, $hasattempts, $defaultcategoryobj) {
|
||||
global $USER, $CFG, $QTYPES, $DB, $OUTPUT;
|
||||
$strorder = get_string('order');
|
||||
$strquestionname = get_string('questionname', 'quiz');
|
||||
@ -637,7 +636,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete = true,
|
||||
if ($pageopen) {
|
||||
if (!$reordertool && !($quiz->shufflequestions && $i < $questiontotalcount - 1)) {
|
||||
quiz_print_pagecontrols($quiz, $pageurl, $pagecount,
|
||||
$hasattempts);
|
||||
$hasattempts, $defaultcategoryobj);
|
||||
} else if ($i < $questiontotalcount - 1) {
|
||||
//do not include the last page break for reordering
|
||||
//to avoid creating a new extra page in the end
|
||||
@ -675,7 +674,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete = true,
|
||||
* @param unknown_type $page
|
||||
* @param unknown_type $hasattempts
|
||||
*/
|
||||
function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts) {
|
||||
function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts, $defaultcategoryobj) {
|
||||
global $CFG, $OUTPUT;
|
||||
static $randombuttoncount = 0;
|
||||
$randombuttoncount++;
|
||||
@ -687,6 +686,9 @@ function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts) {
|
||||
|
||||
// Get the default category.
|
||||
list($defaultcategoryid) = explode(',', $pageurl->param('cat'));
|
||||
if (empty($defaultcategoryid)) {
|
||||
$defaultcategoryid = $defaultcategoryobj->id;
|
||||
}
|
||||
|
||||
// Create the url the question page will return to
|
||||
$returnurladdtoquiz = new moodle_url($pageurl, array('addonpage' => $page));
|
||||
|
Loading…
x
Reference in New Issue
Block a user