34 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false): string
37 $ilias = $DIC[
'ilias'];
41 $a_xml_writer->xmlHeader();
42 $a_xml_writer->xmlStartTag(
"questestinterop");
44 "ident" =>
"il_" .
IL_INST_ID .
"_qst_" . $this->
object->getId(),
45 "title" => $this->
object->getTitle(),
46 "maxattempts" => $this->
object->getNrOfTries()
48 $a_xml_writer->xmlStartTag(
"item", $attrs);
50 $a_xml_writer->xmlElement(
"qticomment",
null, $this->
object->getComment());
51 $a_xml_writer->xmlStartTag(
"itemmetadata");
52 $a_xml_writer->xmlStartTag(
"qtimetadata");
53 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
54 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"ILIAS_VERSION");
55 $a_xml_writer->xmlElement(
"fieldentry",
null, $ilias->getSetting(
"ilias_version"));
56 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
57 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
58 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"QUESTIONTYPE");
59 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getQuestionType());
60 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
61 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
62 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"AUTHOR");
63 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getAuthor());
64 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
70 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
71 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"textrating");
72 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getTextRating());
73 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
74 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
75 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"correctanswers");
76 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getCorrectAnswers());
77 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
78 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
79 $a_xml_writer->xmlElement(
"fieldlabel",
null,
"points");
80 $a_xml_writer->xmlElement(
"fieldentry",
null, $this->
object->getPoints());
81 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
82 $a_xml_writer->xmlEndTag(
"qtimetadata");
83 $a_xml_writer->xmlEndTag(
"itemmetadata");
87 "label" => $this->
object->getTitle()
89 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
91 $a_xml_writer->xmlStartTag(
"flow");
95 for ($counter = 1; $counter <= $this->
object->getCorrectAnswers(); $counter++) {
97 "ident" =>
"TEXTSUBSET_$counter",
98 "rcardinality" =>
"Single" 100 $a_xml_writer->xmlStartTag(
"response_str", $attrs);
104 "fibtype" =>
"String",
105 "columns" => $this->
object->getMaxTextboxWidth()
107 $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
108 $a_xml_writer->xmlEndTag(
"render_fib");
109 $a_xml_writer->xmlEndTag(
"response_str");
112 $a_xml_writer->xmlEndTag(
"flow");
113 $a_xml_writer->xmlEndTag(
"presentation");
116 $a_xml_writer->xmlStartTag(
"resprocessing");
117 $a_xml_writer->xmlStartTag(
"outcomes");
118 $a_xml_writer->xmlStartTag(
"decvar");
119 $a_xml_writer->xmlEndTag(
"decvar");
121 "varname" =>
"matches",
124 $a_xml_writer->xmlElement(
"decvar", $attribs,
null);
125 $a_xml_writer->xmlEndTag(
"outcomes");
127 for ($counter = 1; $counter <= $this->
object->getCorrectAnswers(); $counter++) {
128 $scoregroups = &$this->
object->joinAnswers();
129 foreach ($scoregroups as $points => $scoreanswers) {
133 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
135 $a_xml_writer->xmlStartTag(
"conditionvar");
137 "respident" =>
"TEXTSUBSET_$counter" 139 $a_xml_writer->xmlElement(
"varsubset", $attrs, join(
",", $scoreanswers));
140 $a_xml_writer->xmlEndTag(
"conditionvar");
143 "varname" =>
"matches",
146 $a_xml_writer->xmlElement(
"setvar", $attrs, $points);
149 "feedbacktype" =>
"Response",
150 "linkrefid" =>
"Matches_$counter" 152 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
153 $a_xml_writer->xmlEndTag(
"respcondition");
157 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
161 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
165 if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
166 if (strlen($feedback_allcorrect)) {
170 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
172 $a_xml_writer->xmlStartTag(
"conditionvar");
174 "respident" =>
"points" 176 $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->
object->getMaximumPoints());
177 $a_xml_writer->xmlEndTag(
"conditionvar");
180 "feedbacktype" =>
"Response",
181 "linkrefid" =>
"response_allcorrect" 183 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
184 $a_xml_writer->xmlEndTag(
"respcondition");
187 if (strlen($feedback_onenotcorrect)) {
191 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
193 $a_xml_writer->xmlStartTag(
"conditionvar");
194 $a_xml_writer->xmlStartTag(
"not");
197 "respident" =>
"points" 199 $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->
object->getMaximumPoints());
201 $a_xml_writer->xmlEndTag(
"not");
202 $a_xml_writer->xmlEndTag(
"conditionvar");
205 "feedbacktype" =>
"Response",
206 "linkrefid" =>
"response_onenotcorrect" 208 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
209 $a_xml_writer->xmlEndTag(
"respcondition");
213 $a_xml_writer->xmlEndTag(
"resprocessing");
216 for ($counter = 1; $counter <= $this->
object->getCorrectAnswers(); $counter++) {
218 "ident" =>
"Matches_$counter",
221 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
223 $a_xml_writer->xmlStartTag(
"flow_mat");
224 $a_xml_writer->xmlStartTag(
"material");
225 $a_xml_writer->xmlElement(
"mattext");
226 $a_xml_writer->xmlEndTag(
"material");
227 $a_xml_writer->xmlEndTag(
"flow_mat");
228 $a_xml_writer->xmlEndTag(
"itemfeedback");
231 if (strlen($feedback_allcorrect)) {
233 "ident" =>
"response_allcorrect",
236 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
238 $a_xml_writer->xmlStartTag(
"flow_mat");
240 $a_xml_writer->xmlEndTag(
"flow_mat");
241 $a_xml_writer->xmlEndTag(
"itemfeedback");
243 if (strlen($feedback_onenotcorrect)) {
245 "ident" =>
"response_onenotcorrect",
248 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
250 $a_xml_writer->xmlStartTag(
"flow_mat");
252 $a_xml_writer->xmlEndTag(
"flow_mat");
253 $a_xml_writer->xmlEndTag(
"itemfeedback");
258 $a_xml_writer->xmlEndTag(
"item");
259 $a_xml_writer->xmlEndTag(
"questestinterop");
261 $xml = $a_xml_writer->xmlDumpMem(
false);
262 if (!$a_include_header) {
263 $pos = strpos($xml,
"?>");
264 $xml = substr($xml, $pos + 2);
addQTIMaterial(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
Class for question exports.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addGeneralMetadata(ilXmlWriter $xmlwriter)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
addSuggestedSolution(ilXmlWriter $writer)
addSolutionHints(ilXmlWriter $writer)
toXML($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
Returns a QTI xml representation of the question Returns a QTI xml representation of the question and...