24 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
44 function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
48 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
52 $a_xml_writer->xmlStartTag(
"questestinterop");
54 "ident" =>
"il_".IL_INST_ID.
"_qst_".$this->object->getId(),
55 "title" => $this->
object->getTitle(),
56 "maxattempts" => $this->
object->getNrOfTries()
58 $a_xml_writer->xmlStartTag(
"item", $attrs);
60 $a_xml_writer->xmlElement(
"qticomment", NULL, $this->object->getComment());
62 $workingtime = $this->
object->getEstimatedWorkingTime();
63 $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
64 $a_xml_writer->xmlElement(
"duration", NULL, $duration);
66 $a_xml_writer->xmlStartTag(
"itemmetadata");
67 $a_xml_writer->xmlStartTag(
"qtimetadata");
68 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
69 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"ILIAS_VERSION");
70 $a_xml_writer->xmlElement(
"fieldentry", NULL, $ilias->getSetting(
"ilias_version"));
71 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
72 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
73 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"QUESTIONTYPE");
74 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getQuestionType());
75 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
76 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
77 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"AUTHOR");
78 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getAuthor());
79 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
80 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
81 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"points");
82 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getPoints());
83 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
84 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
85 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"width");
86 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getWidth());
87 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
88 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
89 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"height");
90 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getHeight());
91 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
92 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
93 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"applet");
94 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getApplet());
95 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
96 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
97 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"swf");
98 $flashpath = $this->
object->getFlashPath() . $this->
object->getApplet();
99 $fh = @fopen($flashpath,
"rb");
103 $flashfile = fread($fh, filesize($flashpath));
105 $base64 = base64_encode($flashfile);
107 $a_xml_writer->xmlElement(
"fieldentry", NULL, $base64);
108 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
109 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
110 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"params");
111 $a_xml_writer->xmlElement(
"fieldentry", NULL, serialize($this->object->getParameters()));
112 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
113 $a_xml_writer->xmlEndTag(
"qtimetadata");
114 $a_xml_writer->xmlEndTag(
"itemmetadata");
118 "label" => $this->object->getTitle()
120 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
122 $a_xml_writer->xmlStartTag(
"flow");
124 $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
126 $a_xml_writer->xmlEndTag(
"flow");
127 $a_xml_writer->xmlEndTag(
"presentation");
131 $a_xml_writer->xmlEndTag(
"item");
132 $a_xml_writer->xmlEndTag(
"questestinterop");
134 $xml = $a_xml_writer->xmlDumpMem(FALSE);
135 if (!$a_include_header)
137 $pos = strpos($xml,
"?>");
138 $xml = substr($xml, $pos + 2);