// question name
$qo->name = $this->getpath( $question, array('#','name',0,'#','text',0,'#'), '', true, $error_noname );
- $qo->questiontext = $this->getpath( $question, array('#','questiontext',0,'#','text',0,'#'), '', true, $error_noquestion );
+ $qo->questiontext = $this->getpath( $question, array('#','questiontext',0,'#','text',0,'#'), '', true );
$qo->questiontextformat = $this->getpath( $question, array('#','questiontext',0,'@','format'), '' );
$image = $this->getpath( $question, array('#','image',0,'#'), $qo->image );
$image_base64 = $this->getpath( $question, array('#','image_base64','0','#'),'' );
* @return object answer object
*/
function import_answer( $answer ) {
- $fraction = $answer['@']['fraction'];
- $text = $this->import_text( $answer['#']['text']);
+ $fraction = $this->getpath($answer, array('@','fraction'), 0);
+ $text = $this->getpath( $answer, array('#','text',0,'#'),'',true);
$feedback = $this->import_text( $answer['#']['feedback'][0]['#']['text'] );
$ans = null;
$answer = $question['#']['answer'][0];
// get fraction - <fraction> tag is deprecated
- if (!empty($answer['#']['fraction'][0]['#'])) {
- $qo->fraction = $answer['#']['fraction'][0]['#'];
- }
- else {
- $qo->fraction = $answer['@']['fraction'] / 100;
- }
+ $qo->fraction = $this->getpath( $question, array('@','fraction'), 0 ) / 100;
+ $q0->fraction = $this->getpath( $question, array('#','fraction',0,'#'), $qo->fraction );
return $qo;
}