diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 608e38e1027..1acb4424f4e 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -462,19 +462,16 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, $reordercheckboxlabel = ''; $reordercheckboxlabelclose = ''; - if ($qnum && empty($questions[$qnum])) { - continue; - } - // If the questiontype is missing change the question type if ($qnum && !array_key_exists($qnum, $questions)) { $fakequestion = new stdClass(); - $fakequestion->id = 0; + $fakequestion->id = $qnum; + $fakequestion->category = 0; $fakequestion->qtype = 'missingtype'; - $fakequestion->name = get_string('deletedquestion', 'qtype_missingtype'); - $fakequestion->questiontext = '
' . - get_string('deletedquestion', 'qtype_missing') . '
'; - $fakequestion->length = 0; + $fakequestion->name = get_string('missingquestion', 'quiz'); + $fakequestion->questiontext = ' '; + $fakequestion->questiontextformat = FORMAT_HTML; + $fakequestion->length = 1; $questions[$qnum] = $fakequestion; $quiz->grades[$qnum] = 0; @@ -581,7 +578,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, array('title' => $strmovedown)); } } - if ($allowdelete && (empty($question->id) || + if ($allowdelete && ($question->qtype == 'missingtype' || question_has_capability_on($question, 'use', $question->category))) { // remove from quiz, not question delete. if (!$hasattempts) { @@ -595,7 +592,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, } ?> qtype != 'description' && !$reordertool) { + if (!in_array($question->qtype, array('description', 'missingtype')) && !$reordertool) { ?>