4 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
26 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
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());
94 "ident" =>
"TEXTSUBSET_" . sprintf(
"%02d",
$counter),
95 "rcardinality" =>
"Single" 97 $a_xml_writer->xmlStartTag(
"response_str", $attrs);
98 $solution = $this->
object->getSuggestedSolution(0);
99 if (count($solution)) {
100 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
101 $a_xml_writer->xmlStartTag(
"material");
102 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
103 if (strcmp($matches[1],
"") != 0) {
104 $intlink = $solution[
"internal_link"];
107 "label" =>
"suggested_solution" 109 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
110 $a_xml_writer->xmlEndTag(
"material");
115 "fibtype" =>
"String",
116 "columns" => $this->
object->getMaxTextboxWidth()
118 $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
119 $a_xml_writer->xmlEndTag(
"render_fib");
120 $a_xml_writer->xmlEndTag(
"response_str");
123 $a_xml_writer->xmlEndTag(
"flow");
124 $a_xml_writer->xmlEndTag(
"presentation");
127 $a_xml_writer->xmlStartTag(
"resprocessing");
128 $a_xml_writer->xmlStartTag(
"outcomes");
129 $a_xml_writer->xmlStartTag(
"decvar");
130 $a_xml_writer->xmlEndTag(
"decvar");
132 "varname" =>
"matches",
135 $a_xml_writer->xmlElement(
"decvar", $attribs, null);
136 $a_xml_writer->xmlEndTag(
"outcomes");
139 $scoregroups =&$this->
object->joinAnswers();
140 foreach ($scoregroups as $points => $scoreanswers) {
144 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
146 $a_xml_writer->xmlStartTag(
"conditionvar");
148 "respident" =>
"TEXTSUBSET_" . sprintf(
"%02d",
$counter)
150 $a_xml_writer->xmlElement(
"varsubset", $attrs, join(
",", $scoreanswers));
151 $a_xml_writer->xmlEndTag(
"conditionvar");
154 "varname" =>
"matches",
157 $a_xml_writer->xmlElement(
"setvar", $attrs, $points);
160 "feedbacktype" =>
"Response",
161 "linkrefid" =>
"Matches_" . sprintf(
"%02d",
$counter)
163 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
164 $a_xml_writer->xmlEndTag(
"respcondition");
168 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
172 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
176 if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
177 if (strlen($feedback_allcorrect)) {
181 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
183 $a_xml_writer->xmlStartTag(
"conditionvar");
185 "respident" =>
"points" 187 $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->
object->getMaximumPoints());
188 $a_xml_writer->xmlEndTag(
"conditionvar");
191 "feedbacktype" =>
"Response",
192 "linkrefid" =>
"response_allcorrect" 194 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
195 $a_xml_writer->xmlEndTag(
"respcondition");
198 if (strlen($feedback_onenotcorrect)) {
202 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
204 $a_xml_writer->xmlStartTag(
"conditionvar");
205 $a_xml_writer->xmlStartTag(
"not");
208 "respident" =>
"points" 210 $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->
object->getMaximumPoints());
212 $a_xml_writer->xmlEndTag(
"not");
213 $a_xml_writer->xmlEndTag(
"conditionvar");
216 "feedbacktype" =>
"Response",
217 "linkrefid" =>
"response_onenotcorrect" 219 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
220 $a_xml_writer->xmlEndTag(
"respcondition");
224 $a_xml_writer->xmlEndTag(
"resprocessing");
229 "ident" =>
"Matches_" . sprintf(
"%02d",
$counter),
232 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
234 $a_xml_writer->xmlStartTag(
"flow_mat");
235 $a_xml_writer->xmlStartTag(
"material");
236 $a_xml_writer->xmlElement(
"mattext");
237 $a_xml_writer->xmlEndTag(
"material");
238 $a_xml_writer->xmlEndTag(
"flow_mat");
239 $a_xml_writer->xmlEndTag(
"itemfeedback");
242 if (strlen($feedback_allcorrect)) {
244 "ident" =>
"response_allcorrect",
247 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
249 $a_xml_writer->xmlStartTag(
"flow_mat");
250 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
251 $a_xml_writer->xmlEndTag(
"flow_mat");
252 $a_xml_writer->xmlEndTag(
"itemfeedback");
254 if (strlen($feedback_onenotcorrect)) {
256 "ident" =>
"response_onenotcorrect",
259 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
261 $a_xml_writer->xmlStartTag(
"flow_mat");
262 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
263 $a_xml_writer->xmlEndTag(
"flow_mat");
264 $a_xml_writer->xmlEndTag(
"itemfeedback");
267 $a_xml_writer->xmlEndTag(
"item");
268 $a_xml_writer->xmlEndTag(
"questestinterop");
270 $xml = $a_xml_writer->xmlDumpMem(
false);
271 if (!$a_include_header) {
272 $pos = strpos(
$xml,
"?>");
const TEXTSUBSET_QUESTION_IDENTIFIER
Class for question exports.
Class for text subset question exports.
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
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.