4 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
26 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->xmlEndTag(
"qtimetadata");
68 $a_xml_writer->xmlEndTag(
"itemmetadata");
72 "label" => $this->
object->getTitle()
74 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
76 $a_xml_writer->xmlStartTag(
"flow");
78 $this->
object->addQTIMaterial($a_xml_writer, $this->
object->getQuestion());
82 "rcardinality" =>
"Single",
83 "numtype" =>
"Decimal" 85 $a_xml_writer->xmlStartTag(
"response_num", $attrs);
86 $solution = $this->
object->getSuggestedSolution(0);
89 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches))
91 $a_xml_writer->xmlStartTag(
"material");
92 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
93 if (strcmp($matches[1],
"") != 0)
95 $intlink = $solution[
"internal_link"];
98 "label" =>
"suggested_solution" 100 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
101 $a_xml_writer->xmlEndTag(
"material");
106 "fibtype" =>
"Decimal",
107 "maxchars" => $this->
object->getMaxChars()
109 $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
110 $a_xml_writer->xmlEndTag(
"render_fib");
111 $a_xml_writer->xmlEndTag(
"response_num");
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");
120 $a_xml_writer->xmlEndTag(
"outcomes");
122 $a_xml_writer->xmlStartTag(
"respcondition");
124 $a_xml_writer->xmlStartTag(
"conditionvar");
128 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->
object->getLowerLimit());
129 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->
object->getUpperLimit());
130 $a_xml_writer->xmlEndTag(
"conditionvar");
135 $a_xml_writer->xmlElement(
"setvar", $attrs, $this->
object->getPoints());
138 "feedbacktype" =>
"Response",
139 "linkrefid" =>
"Correct" 141 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
142 $a_xml_writer->xmlEndTag(
"respcondition");
144 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
145 $this->
object->getId(), true
147 if (strlen($feedback_allcorrect))
152 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
154 $a_xml_writer->xmlStartTag(
"conditionvar");
158 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->
object->getLowerLimit());
159 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->
object->getUpperLimit());
160 $a_xml_writer->xmlEndTag(
"conditionvar");
163 "feedbacktype" =>
"Response",
164 "linkrefid" =>
"response_allcorrect" 166 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
167 $a_xml_writer->xmlEndTag(
"respcondition");
170 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
171 $this->
object->getId(), false
173 if (strlen($feedback_onenotcorrect))
178 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
180 $a_xml_writer->xmlStartTag(
"conditionvar");
181 $a_xml_writer->xmlStartTag(
"not");
185 $a_xml_writer->xmlElement(
"vargte", $attrs, $this->
object->getLowerLimit());
186 $a_xml_writer->xmlElement(
"varlte", $attrs, $this->
object->getUpperLimit());
187 $a_xml_writer->xmlEndTag(
"not");
188 $a_xml_writer->xmlEndTag(
"conditionvar");
191 "feedbacktype" =>
"Response",
192 "linkrefid" =>
"response_onenotcorrect" 194 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
195 $a_xml_writer->xmlEndTag(
"respcondition");
198 $a_xml_writer->xmlEndTag(
"resprocessing");
202 "ident" =>
"Correct",
205 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
207 $a_xml_writer->xmlStartTag(
"flow_mat");
208 $a_xml_writer->xmlStartTag(
"material");
209 $a_xml_writer->xmlElement(
"mattext");
210 $a_xml_writer->xmlEndTag(
"material");
211 $a_xml_writer->xmlEndTag(
"flow_mat");
212 $a_xml_writer->xmlEndTag(
"itemfeedback");
213 if (strlen($feedback_allcorrect))
216 "ident" =>
"response_allcorrect",
219 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
221 $a_xml_writer->xmlStartTag(
"flow_mat");
222 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
223 $a_xml_writer->xmlEndTag(
"flow_mat");
224 $a_xml_writer->xmlEndTag(
"itemfeedback");
226 if (strlen($feedback_onenotcorrect))
229 "ident" =>
"response_onenotcorrect",
232 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
234 $a_xml_writer->xmlStartTag(
"flow_mat");
235 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
236 $a_xml_writer->xmlEndTag(
"flow_mat");
237 $a_xml_writer->xmlEndTag(
"itemfeedback");
240 $a_xml_writer->xmlEndTag(
"item");
241 $a_xml_writer->xmlEndTag(
"questestinterop");
243 $xml = $a_xml_writer->xmlDumpMem(FALSE);
244 if (!$a_include_header)
246 $pos = strpos($xml,
"?>");
247 $xml = substr($xml, $pos + 2);
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
const NUMERIC_QUESTION_IDENTIFIER
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.
xmlHeader()
Writes xml header public.
Create styles array
The data for the language used.
Class for numeric question exports.
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