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
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(),
39 "maxattempts" => $this->
object->getNrOfTries()
41 $a_xml_writer->xmlStartTag(
"item", $attrs);
43 $a_xml_writer->xmlElement(
"qticomment", null, $this->object->getComment());
45 $workingtime = $this->
object->getEstimatedWorkingTime();
46 $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
47 $a_xml_writer->xmlElement(
"duration", null, $duration);
49 $a_xml_writer->xmlStartTag(
"itemmetadata");
50 $a_xml_writer->xmlStartTag(
"qtimetadata");
51 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
52 $a_xml_writer->xmlElement(
"fieldlabel", null,
"ILIAS_VERSION");
53 $a_xml_writer->xmlElement(
"fieldentry", null, $ilias->getSetting(
"ilias_version"));
54 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
55 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
56 $a_xml_writer->xmlElement(
"fieldlabel", null,
"QUESTIONTYPE");
58 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
59 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
60 $a_xml_writer->xmlElement(
"fieldlabel", null,
"AUTHOR");
61 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->getAuthor());
62 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
68 $a_xml_writer->xmlEndTag(
"qtimetadata");
69 $a_xml_writer->xmlEndTag(
"itemmetadata");
73 "label" => $this->object->getTitle()
75 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
77 $a_xml_writer->xmlStartTag(
"flow");
79 $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
83 "rcardinality" =>
"Single",
84 "numtype" =>
"Decimal" 86 $a_xml_writer->xmlStartTag(
"response_num", $attrs);
87 $solution = $this->
object->getSuggestedSolution(0);
88 if (count($solution)) {
89 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
90 $a_xml_writer->xmlStartTag(
"material");
91 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
92 if (strcmp($matches[1],
"") != 0) {
93 $intlink = $solution[
"internal_link"];
96 "label" =>
"suggested_solution" 98 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
99 $a_xml_writer->xmlEndTag(
"material");
104 "fibtype" =>
"Decimal",
105 "maxchars" => $this->object->getMaxChars()
107 $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
108 $a_xml_writer->xmlEndTag(
"render_fib");
109 $a_xml_writer->xmlEndTag(
"response_num");
110 $a_xml_writer->xmlEndTag(
"flow");
111 $a_xml_writer->xmlEndTag(
"presentation");
114 $a_xml_writer->xmlStartTag(
"resprocessing");
115 $a_xml_writer->xmlStartTag(
"outcomes");
116 $a_xml_writer->xmlStartTag(
"decvar");
117 $a_xml_writer->xmlEndTag(
"decvar");
118 $a_xml_writer->xmlEndTag(
"outcomes");
120 $a_xml_writer->xmlStartTag(
"respcondition");
122 $a_xml_writer->xmlStartTag(
"conditionvar");
126 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->object->getLowerLimit());
127 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->object->getUpperLimit());
128 $a_xml_writer->xmlEndTag(
"conditionvar");
133 $a_xml_writer->xmlElement(
"setvar", $attrs, $this->object->getPoints());
136 "feedbacktype" =>
"Response",
137 "linkrefid" =>
"Correct" 139 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
140 $a_xml_writer->xmlEndTag(
"respcondition");
142 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
143 $this->object->getId(),
146 if (strlen($feedback_allcorrect)) {
150 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
152 $a_xml_writer->xmlStartTag(
"conditionvar");
156 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->object->getLowerLimit());
157 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->object->getUpperLimit());
158 $a_xml_writer->xmlEndTag(
"conditionvar");
161 "feedbacktype" =>
"Response",
162 "linkrefid" =>
"response_allcorrect" 164 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
165 $a_xml_writer->xmlEndTag(
"respcondition");
168 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
169 $this->object->getId(),
172 if (strlen($feedback_onenotcorrect)) {
176 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
178 $a_xml_writer->xmlStartTag(
"conditionvar");
179 $a_xml_writer->xmlStartTag(
"not");
183 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->object->getLowerLimit());
184 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->object->getUpperLimit());
185 $a_xml_writer->xmlEndTag(
"not");
186 $a_xml_writer->xmlEndTag(
"conditionvar");
189 "feedbacktype" =>
"Response",
190 "linkrefid" =>
"response_onenotcorrect" 192 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
193 $a_xml_writer->xmlEndTag(
"respcondition");
196 $a_xml_writer->xmlEndTag(
"resprocessing");
200 "ident" =>
"Correct",
203 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
205 $a_xml_writer->xmlStartTag(
"flow_mat");
206 $a_xml_writer->xmlStartTag(
"material");
207 $a_xml_writer->xmlElement(
"mattext");
208 $a_xml_writer->xmlEndTag(
"material");
209 $a_xml_writer->xmlEndTag(
"flow_mat");
210 $a_xml_writer->xmlEndTag(
"itemfeedback");
211 if (strlen($feedback_allcorrect)) {
213 "ident" =>
"response_allcorrect",
216 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
218 $a_xml_writer->xmlStartTag(
"flow_mat");
219 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
220 $a_xml_writer->xmlEndTag(
"flow_mat");
221 $a_xml_writer->xmlEndTag(
"itemfeedback");
223 if (strlen($feedback_onenotcorrect)) {
225 "ident" =>
"response_onenotcorrect",
228 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
230 $a_xml_writer->xmlStartTag(
"flow_mat");
231 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
232 $a_xml_writer->xmlEndTag(
"flow_mat");
233 $a_xml_writer->xmlEndTag(
"itemfeedback");
236 $a_xml_writer->xmlEndTag(
"item");
237 $a_xml_writer->xmlEndTag(
"questestinterop");
239 $xml = $a_xml_writer->xmlDumpMem(
false);
240 if (!$a_include_header) {
241 $pos = strpos(
$xml,
"?>");
addGeneralMetadata(ilXmlWriter $xmlwriter)
const NUMERIC_QUESTION_IDENTIFIER
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...