$name = 'cloze';
break;
default:
- $name = '';
- error( "question type $type_id is not defined in get_qtype" );
+ $name = 'Unknown';
}
return $name;
}
return "<text>$raw</text>\n";
}
+function presave_process( $content ) {
+ // override method to allow us to add xml headers and footers
+
+ $content = "<?xml version=\"1.0\"?>\n" .
+ "<quiz>\n" .
+ $content . "\n" .
+ "</quiz>";
+
+ return $content;
+}
+
function writequestion( $question ) {
// turns question into string
// question reflects database fields for general question and specific to type
$expout = "";
// add comment
- $expout .= "\n\n<!-- question: $question->id name: $question->name -->\n";
+ $expout .= "\n\n<!-- question: $question->id -->\n";
// add opening tag
$question_type = $this->get_qtype( $question->qtype );
case NUMERICAL:
$expout .= "<min>$question->min</min>\n";
$expout .= "<max>$question->max</max>\n";
- $expout .= "<feedback>".$this->writetext( $answer->feedback )."</feedback>\n";
+ $expout .= "<feedback>".$this->writetext( $question->answer->feedback )."</feedback>\n";
break;
case MATCH:
foreach($question->subquestions as $subquestion) {
}
break;
case DESCRIPTION:
- $expout .= "<!-- DESCRIPTION type is not supported -->\n";
+ // nothing more to do for this type
break;
case MULTIANSWER:
$expout .= "<!-- CLOZE type is not supported -->\n";
break;
default:
- error( "No handler for qtype $question->qtype for GIFT export" );
+ $expout .= "<!-- Question type is unknown or not supported (Type=$question->qtype) -->\n";
}
// close the question tag
$expout .= "</question>\n";
+
// run through xml tidy function
- return $this->indent_xhtml( $expout, ' ' );
+ $tidy_expout = $this->indent_xhtml( $expout, ' ' ) . "\n\n";
+
+ return $tidy_expout;
}
}