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