You are here

function qformat_blackboard::process_essay in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/blackboard/format.php \qformat_blackboard::process_essay()
1 call to qformat_blackboard::process_essay()
qformat_blackboard::readquestions in includes/moodle/question/format/blackboard/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/blackboard/format.php, line 83

Class

qformat_blackboard

Code

function process_essay($xml, &$questions) {
  if (isset($xml["POOL"]["#"]["QUESTION_ESSAY"])) {
    $essayquestions = $xml["POOL"]["#"]["QUESTION_ESSAY"];
  }
  else {
    return;
  }
  foreach ($essayquestions as $essayquestion) {
    $question = $this
      ->defaultquestion();
    $question->qtype = ESSAY;

    // determine if the question is already escaped html
    $ishtml = $essayquestion["#"]["BODY"][0]["#"]["FLAGS"][0]["#"]["ISHTML"][0]["@"]["value"];

    // put questiontext in question object
    if ($ishtml) {
      $question->questiontext = html_entity_decode_php4(trim($essayquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
    }
    $question->questiontext = addslashes($question->questiontext);

    // put name in question object
    $question->name = substr($question->questiontext, 0, 254);
    $question->answer = '';
    $question->feedback = '';
    $question->fraction = 0;
    $questions[] = $question;
  }
}