Returns a QTI xml representation of the question.
Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation
{
global $ilias;
include_once("./classes/class.ilXmlWriter.php");
$a_xml_writer->xmlStartTag("questestinterop");
$attrs = array(
"ident" => "il_".IL_INST_ID."_qst_".$this->object->getId(),
"title" => $this->object->getTitle()
);
$a_xml_writer->xmlStartTag("item", $attrs);
$a_xml_writer->xmlElement("qticomment", NULL, $this->object->getComment());
$workingtime = $this->object->getEstimatedWorkingTime();
$duration = sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]);
$a_xml_writer->xmlElement("duration", NULL, $duration);
$a_xml_writer->xmlStartTag("itemmetadata");
$a_xml_writer->xmlStartTag("qtimetadata");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
$a_xml_writer->xmlElement("fieldentry", NULL, $ilias->getSetting("ilias_version"));
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "QUESTIONTYPE");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getQuestionType());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "AUTHOR");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getAuthor());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "points");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getPoints());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "width");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getWidth());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "height");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getHeight());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "applet");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getApplet());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "swf");
$flashpath = $this->object->getFlashPath() . $this->object->getApplet();
$fh = @fopen($flashpath, "rb");
$base64 = "";
if ($fh != FALSE)
{
$flashfile = fread($fh, filesize($flashpath));
fclose($fh);
$base64 = base64_encode($flashfile);
}
$a_xml_writer->xmlElement("fieldentry", NULL, $base64);
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "params");
$a_xml_writer->xmlElement("fieldentry", NULL, serialize($this->object->getParameters()));
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlEndTag("qtimetadata");
$a_xml_writer->xmlEndTag("itemmetadata");
$attrs = array(
"label" => $this->object->getTitle()
);
$a_xml_writer->xmlStartTag("presentation", $attrs);
$a_xml_writer->xmlStartTag("flow");
$this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
$a_xml_writer->xmlEndTag("flow");
$a_xml_writer->xmlEndTag("presentation");
$a_xml_writer->xmlEndTag("item");
$a_xml_writer->xmlEndTag("questestinterop");
$xml = $a_xml_writer->xmlDumpMem(FALSE);
if (!$a_include_header)
{
$pos = strpos($xml, "?>");
$xml = substr($xml, $pos + 2);
}
return $xml;
}