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