You are here

function qformat_examview::process_matches in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/examview/format.php \qformat_examview::process_matches()
1 call to qformat_examview::process_matches()
qformat_examview::readquestions in includes/moodle/question/format/examview/format.php
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.

File

includes/moodle/question/format/examview/format.php, line 97

Class

qformat_examview

Code

function process_matches(&$questions) {
  if (empty($this->matching_questions)) {
    return;
  }
  foreach ($this->matching_questions as $match_group) {
    $question = $this
      ->defaultquestion();
    $htmltext = s(addslashes($match_group->questiontext));
    $question->questiontext = $htmltext;
    $question->name = $question->questiontext;
    $question->qtype = MATCH;
    $question->subquestions = array();
    $question->subanswers = array();
    foreach ($match_group->subquestions as $key => $value) {
      $htmltext = s(addslashes($value));
      $question->subquestions[] = $htmltext;
      $htmltext = s(addslashes($match_group->subanswers[$key]));
      $question->subanswers[] = $htmltext;
    }
    $questions[] = $question;
  }
}