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
30 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
34 $a_xml_writer->xmlStartTag(
"questestinterop");
36 "ident" =>
"il_" . IL_INST_ID .
"_qst_" . $this->
object->getId(),
37 "title" => $this->
object->getTitle(),
38 "maxattempts" => $this->
object->getNrOfTries()
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");
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");
67 $a_xml_writer->xmlEndTag(
"qtimetadata");
68 $a_xml_writer->xmlEndTag(
"itemmetadata");
72 "label" => $this->
object->getTitle()
74 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
76 $a_xml_writer->xmlStartTag(
"flow");
78 $this->
object->addQTIMaterial($a_xml_writer, $this->
object->getQuestion());
82 "rcardinality" =>
"Single",
83 "numtype" =>
"Decimal" 85 $a_xml_writer->xmlStartTag(
"response_num", $attrs);
86 $solution = $this->
object->getSuggestedSolution(0);
87 if (count($solution)) {
88 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
89 $a_xml_writer->xmlStartTag(
"material");
90 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
91 if (strcmp($matches[1],
"") != 0) {
92 $intlink = $solution[
"internal_link"];
95 "label" =>
"suggested_solution" 97 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
98 $a_xml_writer->xmlEndTag(
"material");
103 "fibtype" =>
"Decimal",
104 "maxchars" => $this->
object->getMaxChars()
106 $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
107 $a_xml_writer->xmlEndTag(
"render_fib");
108 $a_xml_writer->xmlEndTag(
"response_num");
109 $a_xml_writer->xmlEndTag(
"flow");
110 $a_xml_writer->xmlEndTag(
"presentation");
113 $a_xml_writer->xmlStartTag(
"resprocessing");
114 $a_xml_writer->xmlStartTag(
"outcomes");
115 $a_xml_writer->xmlStartTag(
"decvar");
116 $a_xml_writer->xmlEndTag(
"decvar");
117 $a_xml_writer->xmlEndTag(
"outcomes");
119 $a_xml_writer->xmlStartTag(
"respcondition");
121 $a_xml_writer->xmlStartTag(
"conditionvar");
125 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->
object->getLowerLimit());
126 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->
object->getUpperLimit());
127 $a_xml_writer->xmlEndTag(
"conditionvar");
132 $a_xml_writer->xmlElement(
"setvar", $attrs, $this->
object->getPoints());
135 "feedbacktype" =>
"Response",
136 "linkrefid" =>
"Correct" 138 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
139 $a_xml_writer->xmlEndTag(
"respcondition");
141 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
145 if (strlen($feedback_allcorrect)) {
149 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
151 $a_xml_writer->xmlStartTag(
"conditionvar");
155 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->
object->getLowerLimit());
156 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->
object->getUpperLimit());
157 $a_xml_writer->xmlEndTag(
"conditionvar");
160 "feedbacktype" =>
"Response",
161 "linkrefid" =>
"response_allcorrect" 163 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
164 $a_xml_writer->xmlEndTag(
"respcondition");
167 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
171 if (strlen($feedback_onenotcorrect)) {
175 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
177 $a_xml_writer->xmlStartTag(
"conditionvar");
178 $a_xml_writer->xmlStartTag(
"not");
182 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->
object->getLowerLimit());
183 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->
object->getUpperLimit());
184 $a_xml_writer->xmlEndTag(
"not");
185 $a_xml_writer->xmlEndTag(
"conditionvar");
188 "feedbacktype" =>
"Response",
189 "linkrefid" =>
"response_onenotcorrect" 191 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
192 $a_xml_writer->xmlEndTag(
"respcondition");
195 $a_xml_writer->xmlEndTag(
"resprocessing");
199 "ident" =>
"Correct",
202 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
204 $a_xml_writer->xmlStartTag(
"flow_mat");
205 $a_xml_writer->xmlStartTag(
"material");
206 $a_xml_writer->xmlElement(
"mattext");
207 $a_xml_writer->xmlEndTag(
"material");
208 $a_xml_writer->xmlEndTag(
"flow_mat");
209 $a_xml_writer->xmlEndTag(
"itemfeedback");
210 if (strlen($feedback_allcorrect)) {
212 "ident" =>
"response_allcorrect",
215 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
217 $a_xml_writer->xmlStartTag(
"flow_mat");
218 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
219 $a_xml_writer->xmlEndTag(
"flow_mat");
220 $a_xml_writer->xmlEndTag(
"itemfeedback");
222 if (strlen($feedback_onenotcorrect)) {
224 "ident" =>
"response_onenotcorrect",
227 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
229 $a_xml_writer->xmlStartTag(
"flow_mat");
230 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
231 $a_xml_writer->xmlEndTag(
"flow_mat");
232 $a_xml_writer->xmlEndTag(
"itemfeedback");
235 $a_xml_writer->xmlEndTag(
"item");
236 $a_xml_writer->xmlEndTag(
"questestinterop");
238 $xml = $a_xml_writer->xmlDumpMem(
false);
239 if (!$a_include_header) {
240 $pos = strpos(
$xml,
"?>");
addGeneralMetadata(ilXmlWriter $xmlwriter)
const NUMERIC_QUESTION_IDENTIFIER
xmlHeader()
Writes xml header public.
Create styles array
The data for the language used.
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
Create new PHPExcel object
obj_idprivate