24 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
42 function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
46 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
50 $a_xml_writer->xmlStartTag(
"questestinterop");
52 "ident" =>
"il_".IL_INST_ID.
"_qst_".$this->object->getId(),
53 "title" => $this->
object->getTitle(),
54 "maxattempts" => $this->
object->getNrOfTries()
56 $a_xml_writer->xmlStartTag(
"item", $attrs);
58 $a_xml_writer->xmlElement(
"qticomment", NULL, $this->object->getComment());
60 $workingtime = $this->
object->getEstimatedWorkingTime();
61 $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
62 $a_xml_writer->xmlElement(
"duration", NULL, $duration);
64 $a_xml_writer->xmlStartTag(
"itemmetadata");
65 $a_xml_writer->xmlStartTag(
"qtimetadata");
66 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
67 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"ILIAS_VERSION");
68 $a_xml_writer->xmlElement(
"fieldentry", NULL, $ilias->getSetting(
"ilias_version"));
69 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
70 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
71 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"QUESTIONTYPE");
72 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getQuestionType());
73 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
74 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
75 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"AUTHOR");
76 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getAuthor());
77 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
78 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
79 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"points_wrong");
80 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getPointsWrong());
81 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
82 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
83 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"errortext");
84 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getErrorText());
85 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
86 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
87 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"textsize");
88 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getTextSize());
89 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
90 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
91 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"errordata");
92 $serialized = array();
93 foreach ($this->object->getErrorData() as
$data)
95 array_push($serialized, array(
$data->text_correct,
$data->text_wrong,
$data->points));
97 $a_xml_writer->xmlElement(
"fieldentry", NULL, serialize($serialized));
98 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
99 $a_xml_writer->xmlEndTag(
"qtimetadata");
100 $a_xml_writer->xmlEndTag(
"itemmetadata");
104 "label" => $this->object->getTitle()
106 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
108 $a_xml_writer->xmlStartTag(
"flow");
110 $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
112 $a_xml_writer->xmlEndTag(
"flow");
113 $a_xml_writer->xmlEndTag(
"presentation");
115 $a_xml_writer->xmlEndTag(
"item");
116 $a_xml_writer->xmlEndTag(
"questestinterop");
118 $xml = $a_xml_writer->xmlDumpMem(FALSE);
119 if (!$a_include_header)
121 $pos = strpos($xml,
"?>");
122 $xml = substr($xml, $pos + 2);