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->xmlStartTag("qtimetadatafield");
68 $a_xml_writer->xmlElement("fieldlabel", null, "textrating");
69 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getTextRating());
70 $a_xml_writer->xmlEndTag("qtimetadatafield");
71 $a_xml_writer->xmlStartTag("qtimetadatafield");
72 $a_xml_writer->xmlElement("fieldlabel", null, "correctanswers");
73 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getCorrectAnswers());
74 $a_xml_writer->xmlEndTag("qtimetadatafield");
75 $a_xml_writer->xmlStartTag("qtimetadatafield");
76 $a_xml_writer->xmlElement("fieldlabel", null, "points");
77 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
78 $a_xml_writer->xmlEndTag("qtimetadatafield");
79 $a_xml_writer->xmlEndTag("qtimetadata");
80 $a_xml_writer->xmlEndTag("itemmetadata");
81
82
83 $attrs = array(
84 "label" => $this->object->getTitle()
85 );
86 $a_xml_writer->xmlStartTag("presentation", $attrs);
87
88 $a_xml_writer->xmlStartTag("flow");
89
90 $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
91
93 $attrs = array(
95 "rcardinality" => "Single"
96 );
97 $a_xml_writer->xmlStartTag("response_str", $attrs);
98 $solution = $this->object->getSuggestedSolution(0);
99 if (count($solution)) {
100 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches)) {
101 $a_xml_writer->xmlStartTag("material");
102 $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
103 if (strcmp($matches[1], "") != 0) {
104 $intlink = $solution["internal_link"];
105 }
106 $attrs = array(
107 "label" => "suggested_solution"
108 );
109 $a_xml_writer->xmlElement("mattext", $attrs, $intlink);
110 $a_xml_writer->xmlEndTag("material");
111 }
112 }
113
114 $attrs = array(
115 "fibtype" => "String",
116 "columns" => $this->object->getMaxTextboxWidth()
117 );
118 $a_xml_writer->xmlStartTag("render_fib", $attrs);
119 $a_xml_writer->xmlEndTag("render_fib");
120 $a_xml_writer->xmlEndTag("response_str");
121 }
122
123 $a_xml_writer->xmlEndTag("flow");
124 $a_xml_writer->xmlEndTag("presentation");
125
126
127 $a_xml_writer->xmlStartTag("resprocessing");
128 $a_xml_writer->xmlStartTag("outcomes");
129 $a_xml_writer->xmlStartTag("decvar");
130 $a_xml_writer->xmlEndTag("decvar");
131 $attribs = array(
132 "varname" => "matches",
133 "defaultval" => "0"
134 );
135 $a_xml_writer->xmlElement("decvar", $attribs, null);
136 $a_xml_writer->xmlEndTag("outcomes");
137
139 $scoregroups =&$this->object->joinAnswers();
140 foreach ($scoregroups as $points => $scoreanswers) {
141 $attrs = array(
142 "continue" => "Yes"
143 );
144 $a_xml_writer->xmlStartTag("respcondition", $attrs);
145
146 $a_xml_writer->xmlStartTag("conditionvar");
147 $attrs = array(
149 );
150 $a_xml_writer->xmlElement("varsubset", $attrs, join(",", $scoreanswers));
151 $a_xml_writer->xmlEndTag("conditionvar");
152
153 $attrs = array(
154 "varname" => "matches",
155 "action" => "Add"
156 );
157 $a_xml_writer->xmlElement("setvar", $attrs, $points);
158
159 $attrs = array(
160 "feedbacktype" => "Response",
162 );
163 $a_xml_writer->xmlElement("displayfeedback", $attrs);
164 $a_xml_writer->xmlEndTag("respcondition");
165 }
166 }
167
168 $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
169 $this->object->getId(),
170 true
171 );
172 $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
173 $this->object->getId(),
174 false
175 );
176 if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
177 if (strlen($feedback_allcorrect)) {
178 $attrs = array(
179 "continue" => "Yes"
180 );
181 $a_xml_writer->xmlStartTag("respcondition", $attrs);
182
183 $a_xml_writer->xmlStartTag("conditionvar");
184 $attrs = array(
185 "respident" => "points"
186 );
187 $a_xml_writer->xmlElement("varsubset", $attrs, $this->object->getMaximumPoints());
188 $a_xml_writer->xmlEndTag("conditionvar");
189
190 $attrs = array(
191 "feedbacktype" => "Response",
192 "linkrefid" => "response_allcorrect"
193 );
194 $a_xml_writer->xmlElement("displayfeedback", $attrs);
195 $a_xml_writer->xmlEndTag("respcondition");
196 }
197
198 if (strlen($feedback_onenotcorrect)) {
199 $attrs = array(
200 "continue" => "Yes"
201 );
202 $a_xml_writer->xmlStartTag("respcondition", $attrs);
203
204 $a_xml_writer->xmlStartTag("conditionvar");
205 $a_xml_writer->xmlStartTag("not");
206
207 $attrs = array(
208 "respident" => "points"
209 );
210 $a_xml_writer->xmlElement("varsubset", $attrs, $this->object->getMaximumPoints());
211
212 $a_xml_writer->xmlEndTag("not");
213 $a_xml_writer->xmlEndTag("conditionvar");
214
215 $attrs = array(
216 "feedbacktype" => "Response",
217 "linkrefid" => "response_onenotcorrect"
218 );
219 $a_xml_writer->xmlElement("displayfeedback", $attrs);
220 $a_xml_writer->xmlEndTag("respcondition");
221 }
222 }
223
224 $a_xml_writer->xmlEndTag("resprocessing");
225
226
228 $attrs = array(
230 "view" => "All"
231 );
232 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
233
234 $a_xml_writer->xmlStartTag("flow_mat");
235 $a_xml_writer->xmlStartTag("material");
236 $a_xml_writer->xmlElement("mattext");
237 $a_xml_writer->xmlEndTag("material");
238 $a_xml_writer->xmlEndTag("flow_mat");
239 $a_xml_writer->xmlEndTag("itemfeedback");
240 }
241
242 if (strlen($feedback_allcorrect)) {
243 $attrs = array(
244 "ident" => "response_allcorrect",
245 "view" => "All"
246 );
247 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
248
249 $a_xml_writer->xmlStartTag("flow_mat");
250 $this->object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
251 $a_xml_writer->xmlEndTag("flow_mat");
252 $a_xml_writer->xmlEndTag("itemfeedback");
253 }
254 if (strlen($feedback_onenotcorrect)) {
255 $attrs = array(
256 "ident" => "response_onenotcorrect",
257 "view" => "All"
258 );
259 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
260
261 $a_xml_writer->xmlStartTag("flow_mat");
262 $this->object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
263 $a_xml_writer->xmlEndTag("flow_mat");
264 $a_xml_writer->xmlEndTag("itemfeedback");
265 }
266
267 $a_xml_writer->xmlEndTag("item");
268 $a_xml_writer->xmlEndTag("questestinterop");
269
270 $xml = $a_xml_writer->xmlDumpMem(
false);
271 if (!$a_include_header) {
272 $pos = strpos(
$xml,
"?>");
274 }
276 }
sprintf('%.4f', $callTime)
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 TEXTSUBSET_QUESTION_IDENTIFIER