diff --git a/question/format/xml/format.php b/question/format/xml/format.php index 76c80d72e83..0426b0ea36c 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -132,6 +132,9 @@ class qformat_xml extends qformat_default { $qo->name = $this->getpath( $question, array('#','name',0,'#','text',0,'#'), '', true, $error_noname ); $qo->questiontext = $this->getpath( $question, array('#','questiontext',0,'#','text',0,'#'), '', true ); $qo->questiontextformat = $this->getpath( $question, array('#','questiontext',0,'@','format'), '' ); + if (!is_numeric($qo->questiontextformat)) { + $qo->questiontextformat = text_format_name($qo->questiontextformat); + } $qo->image = $this->getpath( $question, array('#','image',0,'#'), $qo->image ); $image_base64 = $this->getpath( $question, array('#','image_base64','0','#'),'' ); if (!empty($image_base64)) { @@ -408,14 +411,27 @@ class qformat_xml extends qformat_default { } function import_calculated( $question ) { - // import numerical question + // import calculated question // get common parts $qo = $this->import_headers( $question ); - // header parts particular to numerical + // header parts particular to calculated $qo->qtype = CALCULATED ;//CALCULATED; $qo->synchronize = $this->getpath( $question, array( '#','synchronize',0,'#' ), 0 ); + $single = $this->getpath( $question, array('#','single',0,'#'), 'true' ); + $qo->single = $this->trans_single( $single ); + $shuffleanswers = $this->getpath( $question, array('#','shuffleanswers',0,'#'), 'false' ); + $qo->answernumbering = $this->getpath( $question, array('#','answernumbering',0,'#'), 'abc' ); + $qo->shuffleanswers = $this->trans_single($shuffleanswers); + $qo->correctfeedback = $this->getpath( $question, array('#','correctfeedback',0,'#','text',0,'#'), '', true ); + $qo->partiallycorrectfeedback = $this->getpath( $question, array('#','partiallycorrectfeedback',0,'#','text',0,'#'), '', true ); + $qo->incorrectfeedback = $this->getpath( $question, array('#','incorrectfeedback',0,'#','text',0,'#'), '', true ); + $qo->unitgradingtype = $this->getpath( $question, array('#','unitgradingtype',0,'#'), 0 ); + $qo->unitpenalty = $this->getpath( $question, array('#','unitpenalty',0,'#'), 0 ); + $qo->showunits = $this->getpath( $question, array('#','showunits',0,'#'), 0 ); + $qo->unitsleft = $this->getpath( $question, array('#','unitsleft',0,'#'), 0 ); + $qo->instructions = $this->getpath( $question, array('#','instructions',0,'#','text',0,'#'), '', true ); // get answers array // echo "
question";print_r($question);echo ""; $answers = $question['#']['answer']; @@ -566,6 +582,10 @@ class qformat_xml extends qformat_default { $qo = $this->import_calculated( $question ); $qo->qtype = CALCULATEDSIMPLE ; } + elseif ($question_type=='calculatedmulti') { + $qo = $this->import_calculated( $question ); + $qo->qtype = CALCULATEDMULTI ; + } elseif ($question_type=='category') { $qo = $this->import_category( $question ); } @@ -636,6 +656,9 @@ class qformat_xml extends qformat_default { case CALCULATEDSIMPLE: $name = 'calculatedsimple'; break; + case CALCULATEDMULTI: + $name = 'calculatedmulti'; + break; default: $name = false; } @@ -866,7 +889,7 @@ class qformat_xml extends qformat_default { $expout .= "