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,
"maxsize");
86 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getMaxSize());
87 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
88 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
89 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"allowedextensions");
90 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getAllowedExtensions());
91 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
92 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
93 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"externalID");
94 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->object->getExternalID());
95 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
96 $a_xml_writer->xmlEndTag(
"qtimetadata");
97 $a_xml_writer->xmlEndTag(
"itemmetadata");
101 "label" => $this->object->getTitle()
103 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
105 $a_xml_writer->xmlStartTag(
"flow");
107 $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
109 $a_xml_writer->xmlEndTag(
"flow");
110 $a_xml_writer->xmlEndTag(
"presentation");
114 $a_xml_writer->xmlEndTag(
"item");
115 $a_xml_writer->xmlEndTag(
"questestinterop");
117 $xml = $a_xml_writer->xmlDumpMem(FALSE);
118 if (!$a_include_header)
120 $pos = strpos($xml,
"?>");
121 $xml = substr($xml,
$pos + 2);