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
27 {
28 global $ilias;
29
30 include_once 'Services/Xml/classes/class.ilXmlWriter.php';
32
34 $a_xml_writer->xmlStartTag("questestinterop");
35 $attrs = array(
36 "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
37 "title" => $this->object->getTitle()
38 );
39 $a_xml_writer->xmlStartTag("item", $attrs);
40
41 $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
42
43 $workingtime = $this->object->getEstimatedWorkingTime();
44 $duration =
sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
45 $a_xml_writer->xmlElement("duration", null, $duration);
46
47 $a_xml_writer->xmlStartTag("itemmetadata");
48 $a_xml_writer->xmlStartTag("qtimetadata");
49 $a_xml_writer->xmlStartTag("qtimetadatafield");
50 $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
51 $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
52 $a_xml_writer->xmlEndTag("qtimetadatafield");
53 $a_xml_writer->xmlStartTag("qtimetadatafield");
54 $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
55 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getQuestionType());
56 $a_xml_writer->xmlEndTag("qtimetadatafield");
57 $a_xml_writer->xmlStartTag("qtimetadatafield");
58 $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
59 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
60 $a_xml_writer->xmlEndTag("qtimetadatafield");
61 $a_xml_writer->xmlStartTag("qtimetadatafield");
62 $a_xml_writer->xmlElement("fieldlabel", null, "points");
63 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
64 $a_xml_writer->xmlEndTag("qtimetadatafield");
65 foreach ($this->object->getVariables() as $variable) {
66 $var = array(
67 "precision" => $variable->getPrecision(),
68 "intprecision" => $variable->getIntprecision(),
69 "rangemin" => $variable->getRangeMin(),
70 "rangemax" => $variable->getRangeMax(),
71 "unit" => (is_object($variable->getUnit())) ? $variable->getUnit()->getUnit() : "",
72 "unitvalue" => (is_object($variable->getUnit())) ? $variable->getUnit()->getId() : ""
73 );
74 $a_xml_writer->xmlStartTag("qtimetadatafield");
75 $a_xml_writer->xmlElement("fieldlabel", null, $variable->getVariable());
76 $a_xml_writer->xmlElement("fieldentry", null, serialize($var));
77 $a_xml_writer->xmlEndTag("qtimetadatafield");
78 }
79 foreach ($this->object->getResults() as
$result) {
80 $resultunits = $this->object->getResultUnits($result);
81 $ru = array();
82 foreach ($resultunits as $unit) {
83 array_push($ru, array("unit" => $unit->getUnit(), "unitvalue" => $unit->getId()));
84 }
86 "precision" =>
$result->getPrecision(),
87 "tolerance" =>
$result->getTolerance(),
88 "rangemin" =>
$result->getRangeMin(),
89 "rangemax" =>
$result->getRangeMax(),
90 "points" =>
$result->getPoints(),
91 "formula" =>
$result->getFormula(),
92 "rating" => (
$result->getRatingSimple()) ?
"" : array(
"sign" =>
$result->getRatingSign(),
"value" =>
$result->getRatingValue(),
"unit" =>
$result->getRatingUnit()),
93 "unit" => (is_object(
$result->getUnit())) ?
$result->getUnit()->getUnit() :
"",
94 "unitvalue" => (is_object(
$result->getUnit())) ?
$result->getUnit()->getId() :
"",
95 "resultunits" => $ru
96 );
97 $a_xml_writer->xmlStartTag("qtimetadatafield");
98 $a_xml_writer->xmlElement(
"fieldlabel",
null,
$result->getResult());
99 $a_xml_writer->xmlElement(
"fieldentry",
null, serialize(
$res));
100 $a_xml_writer->xmlEndTag("qtimetadatafield");
101 }
102
103
106
107 $a_xml_writer->xmlEndTag("qtimetadata");
108 $a_xml_writer->xmlEndTag("itemmetadata");
109
110
111 $attrs = array(
112 "label" => $this->object->getTitle()
113 );
114 $a_xml_writer->xmlStartTag("presentation", $attrs);
115
116 $a_xml_writer->xmlStartTag("flow");
117
118 $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
119
120 $a_xml_writer->xmlEndTag("flow");
121 $a_xml_writer->xmlEndTag("presentation");
122
124
125 $a_xml_writer->xmlEndTag("item");
126 $a_xml_writer->xmlEndTag("questestinterop");
127
128 $xml = $a_xml_writer->xmlDumpMem(
false);
129 if (!$a_include_header) {
130 $pos = strpos(
$xml,
"?>");
132 }
134 }
sprintf('%.4f', $callTime)
addGeneralMetadata(ilXmlWriter $xmlwriter)
addGenericFeedback(ilXmlWriter $a_xml_writer)
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
xmlHeader()
Writes xml header @access public.
foreach($_POST as $key=> $value) $res