You are here

function qformat_multianswer::readquestions in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/multianswer/format.php \qformat_multianswer::readquestions()

Parses an array of lines into an array of questions, where each item is a question object as defined by readquestion(). Questions are defined as anything between blank lines.

If your format does not use blank lines as a delimiter then you will need to override this method. Even then try to use readquestion for each question

Parameters

array lines array of lines from readdata:

Return value

array array of question objects

Overrides qformat_default::readquestions

File

includes/moodle/question/format/multianswer/format.php, line 21

Class

qformat_multianswer
@package questionbank @subpackage importexport

Code

function readquestions($lines) {

  // Parses an array of lines into an array of questions.
  // For this class the method has been simplified as
  // there can never be more than one question for a
  // multianswer import
  $questions = array();
  $thequestion = qtype_multianswer_extract_question(addslashes(implode('', $lines)));
  $thequestion->qtype = MULTIANSWER;
  $thequestion->course = $this->course;
  if (!empty($thequestion)) {
    $thequestion->name = addslashes($lines[0]);
    $questions[] = $thequestion;
  }
  return $questions;
}