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.
35 : string
36 {
38 $ilias =
$DIC[
'ilias'];
39
41
42 $a_xml_writer->xmlHeader();
43 $a_xml_writer->xmlStartTag("questestinterop");
44 $attrs = [
45 "ident" =>
"il_" .
IL_INST_ID .
"_qst_" . $this->
object->getId(),
46 "title" => $this->object->getTitle(),
47 "maxattempts" => $this->object->getNrOfTries()
48 ];
49 $a_xml_writer->xmlStartTag("item", $attrs);
50
51 $a_xml_writer->xmlElement(
"qticomment",
null, $this->
object->getComment());
52 $a_xml_writer->xmlStartTag("itemmetadata");
53 $a_xml_writer->xmlStartTag("qtimetadata");
54 $a_xml_writer->xmlStartTag("qtimetadatafield");
55 $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
56 $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
57 $a_xml_writer->xmlEndTag("qtimetadatafield");
58 $a_xml_writer->xmlStartTag("qtimetadatafield");
59 $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
60 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getQuestionType());
61 $a_xml_writer->xmlEndTag("qtimetadatafield");
62 $a_xml_writer->xmlStartTag("qtimetadatafield");
63 $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
64 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getAuthor());
65 $a_xml_writer->xmlEndTag("qtimetadatafield");
66
67
70
71 $a_xml_writer->xmlStartTag("qtimetadatafield");
72 $a_xml_writer->xmlElement("fieldlabel", null, "textrating");
73 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getTextRating());
74 $a_xml_writer->xmlEndTag("qtimetadatafield");
75 $a_xml_writer->xmlStartTag("qtimetadatafield");
76 $a_xml_writer->xmlElement("fieldlabel", null, "correctanswers");
77 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getCorrectAnswers());
78 $a_xml_writer->xmlEndTag("qtimetadatafield");
79 $a_xml_writer->xmlStartTag("qtimetadatafield");
80 $a_xml_writer->xmlElement("fieldlabel", null, "points");
81 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getPoints());
82 $a_xml_writer->xmlEndTag("qtimetadatafield");
83 $a_xml_writer->xmlEndTag("qtimetadata");
84 $a_xml_writer->xmlEndTag("itemmetadata");
85
86
87 $attrs = [
88 "label" => $this->object->getTitle()
89 ];
90 $a_xml_writer->xmlStartTag("presentation", $attrs);
91
92 $a_xml_writer->xmlStartTag("flow");
93
95
97 $attrs = [
98 "ident" => "TEXTSUBSET_$counter",
99 "rcardinality" => "Single"
100 ];
101 $a_xml_writer->xmlStartTag("response_str", $attrs);
103
104 $attrs = [
105 "fibtype" => "String",
106 "columns" => $this->object->getMaxTextboxWidth()
107 ];
108 $a_xml_writer->xmlStartTag("render_fib", $attrs);
109 $a_xml_writer->xmlEndTag("render_fib");
110 $a_xml_writer->xmlEndTag("response_str");
111 }
112
113 $a_xml_writer->xmlEndTag("flow");
114 $a_xml_writer->xmlEndTag("presentation");
115
116
117 $a_xml_writer->xmlStartTag("resprocessing");
118 $a_xml_writer->xmlStartTag("outcomes");
119 $a_xml_writer->xmlStartTag("decvar");
120 $a_xml_writer->xmlEndTag("decvar");
121 $attribs = [
122 "varname" => "matches",
123 "defaultval" => "0"
124 ];
125 $a_xml_writer->xmlElement("decvar", $attribs, null);
126 $a_xml_writer->xmlEndTag("outcomes");
127
129 $scoregroups = &$this->object->joinAnswers();
130 foreach ($scoregroups as $points => $scoreanswers) {
131 $attrs = [
132 "continue" => "Yes"
133 ];
134 $a_xml_writer->xmlStartTag("respcondition", $attrs);
135
136 $a_xml_writer->xmlStartTag("conditionvar");
137 $attrs = [
138 "respident" => "TEXTSUBSET_$counter"
139 ];
140 $a_xml_writer->xmlElement("varsubset", $attrs, join(",", $scoreanswers));
141 $a_xml_writer->xmlEndTag("conditionvar");
142
143 $attrs = [
144 "varname" => "matches",
145 "action" => "Add"
146 ];
147 $a_xml_writer->xmlElement("setvar", $attrs, $points);
148
149 $attrs = [
150 "feedbacktype" => "Response",
151 "linkrefid" => "Matches_$counter"
152 ];
153 $a_xml_writer->xmlElement("displayfeedback", $attrs);
154 $a_xml_writer->xmlEndTag("respcondition");
155 }
156 }
157
158 $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
160 true
161 );
162 $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
164 false
165 );
166 if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
167 if (strlen($feedback_allcorrect)) {
168 $attrs = [
169 "continue" => "Yes"
170 ];
171 $a_xml_writer->xmlStartTag("respcondition", $attrs);
172
173 $a_xml_writer->xmlStartTag("conditionvar");
174 $attrs = [
175 "respident" => "points"
176 ];
177 $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->
object->getMaximumPoints());
178 $a_xml_writer->xmlEndTag("conditionvar");
179
180 $attrs = [
181 "feedbacktype" => "Response",
182 "linkrefid" => "response_allcorrect"
183 ];
184 $a_xml_writer->xmlElement("displayfeedback", $attrs);
185 $a_xml_writer->xmlEndTag("respcondition");
186 }
187
188 if (strlen($feedback_onenotcorrect)) {
189 $attrs = [
190 "continue" => "Yes"
191 ];
192 $a_xml_writer->xmlStartTag("respcondition", $attrs);
193
194 $a_xml_writer->xmlStartTag("conditionvar");
195 $a_xml_writer->xmlStartTag("not");
196
197 $attrs = [
198 "respident" => "points"
199 ];
200 $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->
object->getMaximumPoints());
201
202 $a_xml_writer->xmlEndTag("not");
203 $a_xml_writer->xmlEndTag("conditionvar");
204
205 $attrs = [
206 "feedbacktype" => "Response",
207 "linkrefid" => "response_onenotcorrect"
208 ];
209 $a_xml_writer->xmlElement("displayfeedback", $attrs);
210 $a_xml_writer->xmlEndTag("respcondition");
211 }
212 }
213
214 $a_xml_writer->xmlEndTag("resprocessing");
215
216
218 $attrs = [
219 "ident" => "Matches_$counter",
220 "view" => "All"
221 ];
222 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
223
224 $a_xml_writer->xmlStartTag("flow_mat");
225 $a_xml_writer->xmlStartTag("material");
226 $a_xml_writer->xmlElement("mattext");
227 $a_xml_writer->xmlEndTag("material");
228 $a_xml_writer->xmlEndTag("flow_mat");
229 $a_xml_writer->xmlEndTag("itemfeedback");
230 }
231
232 if (strlen($feedback_allcorrect)) {
233 $attrs = [
234 "ident" => "response_allcorrect",
235 "view" => "All"
236 ];
237 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
238
239 $a_xml_writer->xmlStartTag("flow_mat");
241 $a_xml_writer->xmlEndTag("flow_mat");
242 $a_xml_writer->xmlEndTag("itemfeedback");
243 }
244 if (strlen($feedback_onenotcorrect)) {
245 $attrs = [
246 "ident" => "response_onenotcorrect",
247 "view" => "All"
248 ];
249 $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
250
251 $a_xml_writer->xmlStartTag("flow_mat");
253 $a_xml_writer->xmlEndTag("flow_mat");
254 $a_xml_writer->xmlEndTag("itemfeedback");
255 }
256
257 $a_xml_writer->xmlEndTag("item");
258 $a_xml_writer->xmlEndTag("questestinterop");
259
260 $xml = $a_xml_writer->xmlDumpMem(false);
261 if (!$a_include_header) {
262 $pos = strpos($xml, "?>");
263 $xml = substr($xml, $pos + 2);
264 }
265 return $xml;
266 }
addGeneralMetadata(ilXmlWriter $xmlwriter)
addQTIMaterial(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
addSuggestedSolution(ilXmlWriter $writer)
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...