You are here

function qformat_qti2::get_cloze_answers_array in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/qti2/format.php \qformat_qti2::get_cloze_answers_array()

gets a question's cloze answer objects as arrays containing only arrays and basic data types

Parameters

object $question:

Return value

array - an array of answer arrays

File

includes/moodle/question/format/qti2/format.php, line 716

Class

qformat_qti2

Code

function get_cloze_answers_array($question) {
  $answers = $this
    ->get_answers($question);
  $this
    ->xml_entitize($answers);
  foreach ($answers as $answerkey => $answer) {
    $answers[$answerkey]->subanswers = $this
      ->objects_to_array($answer->subanswers);
  }
  return $this
    ->objects_to_array($answers);
}