/**
  * Build questions using moodle serialized data. Used for reimport, i.e. from Moodle to Moodle.
  * Used to process data not supported by QTI and to improve performances.
  *
  * @param QtiImportSettings $data
  * @return object|null
  */
 public function build_moodle(QtiImportSettings $settings)
 {
     $data = $settings->get_data();
     $result = parent::build_moodle($settings);
     $a = reset($data->options->answers);
     $result->feedback = $this->format_text($a->feedback);
     return $result;
 }
 /**
  * Build questions using moodle serialized data. Used for reimport, i.e. from Moodle to Moodle.
  * Used to process data not supported by QTI and to improve performances.
  *
  * @param QtiImportSettings $data
  * @return object|null
  */
 public function build_moodle(QtiImportSettings $settings)
 {
     $result = parent::build_moodle($settings);
     $data = $settings->get_data();
     $text = $data->questiontext;
     foreach ($data->options->questions as $key => $q) {
         $text = str_replace('{#' . $key . '}', $q->questiontext, $text);
     }
     $result = qtype_multianswer_extract_question($text);
     $result->resources = array();
     $result->questiontextformat = FORMAT_HTML;
     $result->name = $data->name;
     $result->generalfeedback = $data->generalfeedback;
     $result->penalty = $data->penalty;
     return $result;
 }
 protected function create_builder($settings)
 {
     return QuestionBuilder::factory($settings);
 }
 /**
  * Build questions using moodle serialized data. Used for reimport, i.e. from Moodle to Moodle.
  * Used to process data not supported by QTI and to improve performances.
  *
  * @param QtiImportSettings $data
  * @return object|null
  */
 public function build_moodle(QtiImportSettings $settings)
 {
     $data = $settings->get_data();
     $result = parent::build_moodle($settings);
     $true_answer = $data->options->answers[$data->options->trueanswer];
     $false_answer = $data->options->answers[$data->options->falseanswer];
     $result->feedbacktrue = $this->format_text($true_answer->feedback);
     $result->feedbackfalse = $this->format_text($false_answer->feedback);
     $result->correctanswer = intval($true_answer->fraction) == 1;
     return $result;
 }
 /**
  * Build questions using moodle serialized data. Used for reimport, i.e. from Moodle to Moodle.
  * Used to process data not supported by QTI and to improve performances.
  *
  * @param QtiImportSettings $data
  * @return object|null
  */
 public function build_moodle(QtiImportSettings $settings)
 {
     $data = $settings->get_data();
     $result = parent::build_moodle($settings);
     return $result;
 }
 /**
  * Build questions using moodle serialized data. Used for reimport, i.e. from Moodle to Moodle.
  * Used to process data not supported by QTI and to improve performances.
  *
  * @param QtiImportSettings $data
  * @return object|null
  */
 public function build_moodle(QtiImportSettings $settings)
 {
     $data = $settings->get_data();
     $result = parent::build_moodle($settings);
     $result->single = $data->options->single;
     $result->shuffleanswers = $data->options->shuffleanswers;
     $result->answernumbering = $data->options->layout;
     $answers = $data->options->answers;
     foreach ($answers as $a) {
         $result->answer[] = $a->answer;
         $result->feedback[] = $this->format_text($a->feedback);
         $result->fraction[] = $a->fraction;
     }
     return $result;
 }
 /**
  * Build questions using moodle serialized data. Used for reimport, i.e. from Moodle to Moodle.
  * Used to process data not supported by QTI and to improve performances.
  *
  * @param QtiImportSettings $data
  * @return object|null
  */
 public function build_moodle(QtiImportSettings $settings)
 {
     $data = $settings->get_data();
     $result = parent::build_moodle($settings);
     $result->usecase = $data->options->usecase;
     foreach ($data->options->answers as $a) {
         $result->answer[] = $a->answer;
         $result->feedback[] = $this->format_text($a->feedback);
         $result->fraction[] = $a->fraction;
     }
     return $result;
 }
 /**
  * Build questions using moodle serialized data. Used for reimport, i.e. from Moodle to Moodle.
  * Used to process data not supported by QTI and to improve performances.
  *
  * @param QtiImportSettings $data
  * @return object|null
  */
 public function build_moodle(QtiImportSettings $settings)
 {
     $data = $settings->get_data();
     $result = parent::build_moodle($settings);
     $result->shuffleanswers = $data->options->shuffleanswers;
     $result->subquestions = array();
     $result->subanswers = array();
     foreach ($data->options->subquestions as $q) {
         $result->subquestions[] = $this->format_text($q->questiontext);
         $result->subanswers[] = $q->answertext;
     }
     return $result;
 }