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 "maxattempts" => $this->object->getNrOfTries()
39 );
40 $a_xml_writer->xmlStartTag("item", $attrs);
41
42 $a_xml_writer->xmlElement("qticomment", NULL, $this->object->getComment());
43
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);
47
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");
62
63
66
67 $a_xml_writer->xmlEndTag("qtimetadata");
68 $a_xml_writer->xmlEndTag("itemmetadata");
69
70
71 $attrs = array(
72 "label" => $this->object->getTitle()
73 );
74 $a_xml_writer->xmlStartTag("presentation", $attrs);
75
76 $a_xml_writer->xmlStartTag("flow");
77
78 $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
79
80 $attrs = array(
81 "ident" => "NUM",
82 "rcardinality" => "Single",
83 "numtype" => "Decimal"
84 );
85 $a_xml_writer->xmlStartTag("response_num", $attrs);
86 $solution = $this->object->getSuggestedSolution(0);
87 if (count($solution))
88 {
89 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches))
90 {
91 $a_xml_writer->xmlStartTag("material");
92 $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
93 if (strcmp($matches[1], "") != 0)
94 {
95 $intlink = $solution["internal_link"];
96 }
97 $attrs = array(
98 "label" => "suggested_solution"
99 );
100 $a_xml_writer->xmlElement("mattext", $attrs, $intlink);
101 $a_xml_writer->xmlEndTag("material");
102 }
103 }
104
105 $attrs = array(
106 "fibtype" => "Decimal",
107 "maxchars" => $this->object->getMaxChars()
108 );
109 $a_xml_writer->xmlStartTag("render_fib", $attrs);
110 $a_xml_writer->xmlEndTag("render_fib");
111 $a_xml_writer->xmlEndTag("response_num");
112 $a_xml_writer->xmlEndTag("flow");
113 $a_xml_writer->xmlEndTag("presentation");
114
115
116 $a_xml_writer->xmlStartTag("resprocessing");
117 $a_xml_writer->xmlStartTag("outcomes");
118 $a_xml_writer->xmlStartTag("decvar");
119 $a_xml_writer->xmlEndTag("decvar");
120 $a_xml_writer->xmlEndTag("outcomes");
121
122 $a_xml_writer->xmlStartTag("respcondition");
123
124 $a_xml_writer->xmlStartTag("conditionvar");
125 $attrs = array(
126 "respident" => "NUM"
127 );
128 $a_xml_writer->xmlElement("vargte", $attrs, $this->object->getLowerLimit());
129 $a_xml_writer->xmlElement("varlte", $attrs, $this->object->getUpperLimit());
130 $a_xml_writer->xmlEndTag("conditionvar");
131
132 $attrs = array(
133 "action" => "Add"
134 );
135 $a_xml_writer->xmlElement("setvar", $attrs, $this->object->getPoints());
136
137 $attrs = array(
138 "feedbacktype" => "Response",
139 "linkrefid" => "Correct"
140 );
141 $a_xml_writer->xmlElement("displayfeedback", $attrs);
142 $a_xml_writer->xmlEndTag("respcondition");
143
144 $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
145 $this->object->getId(), true
146 );
147 if (strlen($feedback_allcorrect))
148 {
149 $attrs = array(
150 "continue" => "Yes"
151 );
152 $a_xml_writer->xmlStartTag("respcondition", $attrs);
153
154 $a_xml_writer->xmlStartTag("conditionvar");
155 $attrs = array(
156 "respident" => "NUM"
157 );
158 $a_xml_writer->xmlElement("vargte", $attrs, $this->object->getLowerLimit());
159 $a_xml_writer->xmlElement("varlte", $attrs, $this->object->getUpperLimit());
160 $a_xml_writer->xmlEndTag("conditionvar");
161
162 $attrs = array(
163 "feedbacktype" => "Response",
164 "linkrefid" => "response_allcorrect"
165 );
166 $a_xml_writer->xmlElement("displayfeedback", $attrs);
167 $a_xml_writer->xmlEndTag("respcondition");
168 }
169
170 $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
171 $this->object->getId(), false
172 );
173 if (strlen($feedback_onenotcorrect))
174 {
175 $attrs = array(
176 "continue" => "Yes"
177 );
178 $a_xml_writer->xmlStartTag("respcondition", $attrs);
179
180 $a_xml_writer->xmlStartTag("conditionvar");
181 $a_xml_writer->xmlStartTag("not");
182 $attrs = array(
183 "respident" => "NUM"
184 );
185 $a_xml_writer->xmlElement("vargte", $attrs, $this->object->getLowerLimit());
186 $a_xml_writer->xmlElement("varlte", $attrs, $this->object->getUpperLimit());
187 $a_xml_writer->xmlEndTag("not");
188 $a_xml_writer->xmlEndTag("conditionvar");
189
190 $attrs = array(
191 "feedbacktype" => "Response",
192 "linkrefid" => "response_onenotcorrect"
193 );
194 $a_xml_writer->xmlElement("displayfeedback", $attrs);
195 $a_xml_writer->xmlEndTag("respcondition");
196 }
197
198 $a_xml_writer->xmlEndTag("resprocessing");
199
200
201 $attrs = array(
202 "ident" => "Correct",
203 "view" => "All"
204 );
205 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
206
207 $a_xml_writer->xmlStartTag("flow_mat");
208 $a_xml_writer->xmlStartTag("material");
209 $a_xml_writer->xmlElement("mattext");
210 $a_xml_writer->xmlEndTag("material");
211 $a_xml_writer->xmlEndTag("flow_mat");
212 $a_xml_writer->xmlEndTag("itemfeedback");
213 if (strlen($feedback_allcorrect))
214 {
215 $attrs = array(
216 "ident" => "response_allcorrect",
217 "view" => "All"
218 );
219 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
220
221 $a_xml_writer->xmlStartTag("flow_mat");
222 $this->object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
223 $a_xml_writer->xmlEndTag("flow_mat");
224 $a_xml_writer->xmlEndTag("itemfeedback");
225 }
226 if (strlen($feedback_onenotcorrect))
227 {
228 $attrs = array(
229 "ident" => "response_onenotcorrect",
230 "view" => "All"
231 );
232 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
233
234 $a_xml_writer->xmlStartTag("flow_mat");
235 $this->object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
236 $a_xml_writer->xmlEndTag("flow_mat");
237 $a_xml_writer->xmlEndTag("itemfeedback");
238 }
239
240 $a_xml_writer->xmlEndTag("item");
241 $a_xml_writer->xmlEndTag("questestinterop");
242
243 $xml = $a_xml_writer->xmlDumpMem(FALSE);
244 if (!$a_include_header)
245 {
246 $pos = strpos($xml, "?>");
247 $xml = substr($xml, $pos + 2);
248 }
249 return $xml;
250 }
addGeneralMetadata(ilXmlWriter $xmlwriter)
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.
const NUMERIC_QUESTION_IDENTIFIER