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
30 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
34 $a_xml_writer->xmlStartTag(
"questestinterop");
36 "ident" =>
"il_".IL_INST_ID.
"_qst_".$this->object->getId(),
37 "title" => $this->
object->getTitle(),
38 "maxattempts" => $this->
object->getNrOfTries()
40 $a_xml_writer->xmlStartTag(
"item", $attrs);
42 $a_xml_writer->xmlElement(
"qticomment", NULL, $this->
object->getComment());
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);
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");
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");
84 "label" => $this->
object->getTitle()
86 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
88 $a_xml_writer->xmlStartTag(
"flow");
90 $this->
object->addQTIMaterial($a_xml_writer, $this->
object->getQuestion());
95 "ident" =>
"TEXTSUBSET_" . sprintf(
"%02d",
$counter),
96 "rcardinality" =>
"Single" 98 $a_xml_writer->xmlStartTag(
"response_str", $attrs);
99 $solution = $this->
object->getSuggestedSolution(0);
100 if (count($solution))
102 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches))
104 $a_xml_writer->xmlStartTag(
"material");
105 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
106 if (strcmp($matches[1],
"") != 0)
108 $intlink = $solution[
"internal_link"];
111 "label" =>
"suggested_solution" 113 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
114 $a_xml_writer->xmlEndTag(
"material");
119 "fibtype" =>
"String",
120 "columns" => $this->
object->getMaxTextboxWidth()
122 $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
123 $a_xml_writer->xmlEndTag(
"render_fib");
124 $a_xml_writer->xmlEndTag(
"response_str");
127 $a_xml_writer->xmlEndTag(
"flow");
128 $a_xml_writer->xmlEndTag(
"presentation");
131 $a_xml_writer->xmlStartTag(
"resprocessing");
132 $a_xml_writer->xmlStartTag(
"outcomes");
133 $a_xml_writer->xmlStartTag(
"decvar");
134 $a_xml_writer->xmlEndTag(
"decvar");
136 "varname" =>
"matches",
139 $a_xml_writer->xmlElement(
"decvar", $attribs, NULL);
140 $a_xml_writer->xmlEndTag(
"outcomes");
144 $scoregroups =& $this->
object->joinAnswers();
145 foreach ($scoregroups as $points => $scoreanswers)
150 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
152 $a_xml_writer->xmlStartTag(
"conditionvar");
154 "respident" =>
"TEXTSUBSET_" . sprintf(
"%02d",
$counter)
156 $a_xml_writer->xmlElement(
"varsubset", $attrs, join(
",", $scoreanswers));
157 $a_xml_writer->xmlEndTag(
"conditionvar");
160 "varname" =>
"matches",
163 $a_xml_writer->xmlElement(
"setvar", $attrs, $points);
166 "feedbacktype" =>
"Response",
167 "linkrefid" =>
"Matches_" . sprintf(
"%02d",
$counter)
169 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
170 $a_xml_writer->xmlEndTag(
"respcondition");
174 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
175 $this->
object->getId(), true
177 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
178 $this->
object->getId(), false
180 if (strlen($feedback_allcorrect . $feedback_onenotcorrect))
182 if (strlen($feedback_allcorrect))
187 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
189 $a_xml_writer->xmlStartTag(
"conditionvar");
191 "respident" =>
"points" 193 $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->
object->getMaximumPoints());
194 $a_xml_writer->xmlEndTag(
"conditionvar");
197 "feedbacktype" =>
"Response",
198 "linkrefid" =>
"response_allcorrect" 200 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
201 $a_xml_writer->xmlEndTag(
"respcondition");
204 if (strlen($feedback_onenotcorrect))
209 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
211 $a_xml_writer->xmlStartTag(
"conditionvar");
212 $a_xml_writer->xmlStartTag(
"not");
215 "respident" =>
"points" 217 $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->
object->getMaximumPoints());
219 $a_xml_writer->xmlEndTag(
"not");
220 $a_xml_writer->xmlEndTag(
"conditionvar");
223 "feedbacktype" =>
"Response",
224 "linkrefid" =>
"response_onenotcorrect" 226 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
227 $a_xml_writer->xmlEndTag(
"respcondition");
231 $a_xml_writer->xmlEndTag(
"resprocessing");
237 "ident" =>
"Matches_" . sprintf(
"%02d",
$counter),
240 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
242 $a_xml_writer->xmlStartTag(
"flow_mat");
243 $a_xml_writer->xmlStartTag(
"material");
244 $a_xml_writer->xmlElement(
"mattext");
245 $a_xml_writer->xmlEndTag(
"material");
246 $a_xml_writer->xmlEndTag(
"flow_mat");
247 $a_xml_writer->xmlEndTag(
"itemfeedback");
250 if (strlen($feedback_allcorrect))
253 "ident" =>
"response_allcorrect",
256 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
258 $a_xml_writer->xmlStartTag(
"flow_mat");
259 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
260 $a_xml_writer->xmlEndTag(
"flow_mat");
261 $a_xml_writer->xmlEndTag(
"itemfeedback");
263 if (strlen($feedback_onenotcorrect))
266 "ident" =>
"response_onenotcorrect",
269 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
271 $a_xml_writer->xmlStartTag(
"flow_mat");
272 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
273 $a_xml_writer->xmlEndTag(
"flow_mat");
274 $a_xml_writer->xmlEndTag(
"itemfeedback");
277 $a_xml_writer->xmlEndTag(
"item");
278 $a_xml_writer->xmlEndTag(
"questestinterop");
280 $xml = $a_xml_writer->xmlDumpMem(FALSE);
281 if (!$a_include_header)
283 $pos = strpos($xml,
"?>");
284 $xml = substr($xml, $pos + 2);
const TEXTSUBSET_QUESTION_IDENTIFIER
addGeneralMetadata(ilXmlWriter $xmlwriter)
xmlHeader()
Writes xml header public.
Create styles array
The data for the language used.
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
Create new PHPExcel object
obj_idprivate