You are here

function qformat_xml::import_essay in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/question/format/xml/format.php \qformat_xml::import_essay()

import essay type question

Parameters

array question question array from xml tree:

Return value

object question object

1 call to qformat_xml::import_essay()
qformat_xml::readquestions in includes/moodle/question/format/xml/format.php
parse the array of lines into an array of questions this *could* burn memory - but it won't happen that much so fingers crossed!

File

includes/moodle/question/format/xml/format.php, line 393

Class

qformat_xml

Code

function import_essay($question) {

  // get common parts
  $qo = $this
    ->import_headers($question);

  // header parts particular to essay
  $qo->qtype = ESSAY;

  // get feedback
  $qo->feedback = $this
    ->getpath($question, array(
    '#',
    'answer',
    0,
    '#',
    'feedback',
    0,
    '#',
    'text',
    0,
    '#',
  ), '', true);

  // get fraction - <fraction> tag is deprecated
  $qo->fraction = $this
    ->getpath($question, array(
    '@',
    'fraction',
  ), 0) / 100;
  $q0->fraction = $this
    ->getpath($question, array(
    '#',
    'fraction',
    0,
    '#',
  ), $qo->fraction);
  return $qo;
}