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