4 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
26 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
29 $ilias = $DIC[
'ilias'];
31 include_once
'Services/Xml/classes/class.ilXmlWriter.php';
35 $a_xml_writer->xmlStartTag(
"questestinterop");
37 "ident" =>
"il_" . IL_INST_ID .
"_qst_" . $this->object->getId(),
38 "title" => $this->
object->getTitle()
40 $a_xml_writer->xmlStartTag(
"item", $attrs);
42 $a_xml_writer->xmlElement(
"qticomment", null, $this->object->getComment());
44 $workingtime = $this->
object->getEstimatedWorkingTime();
45 $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
46 $a_xml_writer->xmlElement(
"duration", null, $duration);
48 $a_xml_writer->xmlStartTag(
"itemmetadata");
49 $a_xml_writer->xmlStartTag(
"qtimetadata");
50 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
51 $a_xml_writer->xmlElement(
"fieldlabel", null,
"ILIAS_VERSION");
52 $a_xml_writer->xmlElement(
"fieldentry", null, $ilias->getSetting(
"ilias_version"));
53 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
54 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
55 $a_xml_writer->xmlElement(
"fieldlabel", null,
"QUESTIONTYPE");
56 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->getQuestionType());
57 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
58 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
59 $a_xml_writer->xmlElement(
"fieldlabel", null,
"AUTHOR");
60 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->getAuthor());
61 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
62 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
63 $a_xml_writer->xmlElement(
"fieldlabel", null,
"points");
64 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->getPoints());
65 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
66 foreach ($this->object->getVariables() as $variable) {
68 "precision" => $variable->getPrecision(),
69 "intprecision" => $variable->getIntprecision(),
70 "rangemin" => $variable->getRangeMin(),
71 "rangemax" => $variable->getRangeMax(),
72 "unit" => (is_object($variable->getUnit())) ? $variable->getUnit()->getUnit() :
"",
73 "unitvalue" => (is_object($variable->getUnit())) ? $variable->getUnit()->getId() :
"" 75 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
76 $a_xml_writer->xmlElement(
"fieldlabel", null, $variable->getVariable());
77 $a_xml_writer->xmlElement(
"fieldentry", null, serialize($var));
78 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
80 foreach ($this->object->getResults() as
$result) {
81 $resultunits = $this->
object->getResultUnits(
$result);
83 foreach ($resultunits as $unit) {
84 array_push($ru, array(
"unit" => $unit->getUnit(),
"unitvalue" => $unit->getId()));
87 "precision" =>
$result->getPrecision(),
88 "tolerance" =>
$result->getTolerance(),
89 "rangemin" =>
$result->getRangeMin(),
90 "rangemax" =>
$result->getRangeMax(),
91 "points" =>
$result->getPoints(),
92 "formula" =>
$result->getFormula(),
93 "rating" => (
$result->getRatingSimple()) ?
"" : array(
"sign" =>
$result->getRatingSign(),
"value" =>
$result->getRatingValue(),
"unit" =>
$result->getRatingUnit()),
94 "unit" => (is_object(
$result->getUnit())) ?
$result->getUnit()->getUnit() :
"",
95 "unitvalue" => (is_object(
$result->getUnit())) ?
$result->getUnit()->getId() :
"",
98 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
99 $a_xml_writer->xmlElement(
"fieldlabel", null,
$result->getResult());
100 $a_xml_writer->xmlElement(
"fieldentry", null, serialize(
$res));
101 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
108 $a_xml_writer->xmlEndTag(
"qtimetadata");
109 $a_xml_writer->xmlEndTag(
"itemmetadata");
113 "label" => $this->object->getTitle()
115 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
117 $a_xml_writer->xmlStartTag(
"flow");
119 $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
121 $a_xml_writer->xmlEndTag(
"flow");
122 $a_xml_writer->xmlEndTag(
"presentation");
126 $a_xml_writer->xmlEndTag(
"item");
127 $a_xml_writer->xmlEndTag(
"questestinterop");
129 $xml = $a_xml_writer->xmlDumpMem(
false);
130 if (!$a_include_header) {
131 $pos = strpos(
$xml,
"?>");
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
foreach($_POST as $key=> $value) $res
xmlHeader()
Writes xml header public.
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
addGenericFeedback(ilXmlWriter $a_xml_writer)