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)
29 $ilias = $DIC[
'ilias'];
31 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
35 $a_xml_writer->xmlStartTag(
"questestinterop");
37 "ident" =>
"il_" . IL_INST_ID .
"_qst_" . $this->object->getId(),
38 "title" => $this->
object->getTitle(),
39 "maxattempts" => $this->
object->getNrOfTries()
41 $a_xml_writer->xmlStartTag(
"item", $attrs);
43 $a_xml_writer->xmlElement(
"qticomment", null, $this->object->getComment());
45 $workingtime = $this->
object->getEstimatedWorkingTime();
46 $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
47 $a_xml_writer->xmlElement(
"duration", null, $duration);
49 $a_xml_writer->xmlStartTag(
"itemmetadata");
50 $a_xml_writer->xmlStartTag(
"qtimetadata");
51 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
52 $a_xml_writer->xmlElement(
"fieldlabel", null,
"ILIAS_VERSION");
53 $a_xml_writer->xmlElement(
"fieldentry", null, $ilias->getSetting(
"ilias_version"));
54 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
55 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
56 $a_xml_writer->xmlElement(
"fieldlabel", null,
"QUESTIONTYPE");
58 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
59 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
60 $a_xml_writer->xmlElement(
"fieldlabel", null,
"AUTHOR");
61 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->getAuthor());
62 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
68 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
69 $a_xml_writer->xmlElement(
"fieldlabel", null,
"textrating");
70 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->getTextRating());
71 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
80 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
81 $a_xml_writer->xmlElement(
"fieldlabel", null,
"matchcondition");
82 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->matchcondition);
83 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
85 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
86 $a_xml_writer->xmlElement(
"fieldlabel", null,
"termscoring");
87 $scores = base64_encode(serialize($this->object->getAnswers()));
88 $a_xml_writer->xmlElement(
"fieldentry", null, $scores);
89 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
91 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
92 $a_xml_writer->xmlElement(
"fieldlabel", null,
"termrelation");
93 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->getKeywordRelation());
94 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
96 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
97 $a_xml_writer->xmlElement(
"fieldlabel", null,
"specificfeedback");
98 $a_xml_writer->xmlElement(
"fieldentry", null, $this->object->getKeywordRelation());
99 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
101 $a_xml_writer->xmlEndTag(
"qtimetadata");
102 $a_xml_writer->xmlEndTag(
"itemmetadata");
106 "label" => $this->object->getTitle()
108 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
110 $a_xml_writer->xmlStartTag(
"flow");
112 $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
116 "rcardinality" =>
"Ordered" 118 $a_xml_writer->xmlStartTag(
"response_str", $attrs);
120 "fibtype" =>
"String",
123 if ($this->object->getMaxNumOfChars() > 0) {
124 $attrs[
"maxchars"] = $this->
object->getMaxNumOfChars();
126 $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
130 $a_xml_writer->xmlStartTag(
"response_label", $attrs);
131 $a_xml_writer->xmlEndTag(
"response_label");
132 $a_xml_writer->xmlEndTag(
"render_fib");
134 $solution = $this->
object->getSuggestedSolution(0);
135 if (count($solution)) {
136 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
137 $a_xml_writer->xmlStartTag(
"material");
138 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
139 if (strcmp($matches[1],
"") != 0) {
140 $intlink = $solution[
"internal_link"];
143 "label" =>
"suggested_solution" 145 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
146 $a_xml_writer->xmlEndTag(
"material");
149 $a_xml_writer->xmlEndTag(
"response_str");
150 $a_xml_writer->xmlEndTag(
"flow");
151 $a_xml_writer->xmlEndTag(
"presentation");
155 "scoremodel" =>
"HumanRater" 157 $a_xml_writer->xmlStartTag(
"resprocessing", $attrs);
158 $a_xml_writer->xmlStartTag(
"outcomes");
160 "varname" =>
"WritingScore",
161 "vartype" =>
"Integer",
163 "maxvalue" => $this->object->getPoints()
165 $a_xml_writer->xmlStartTag(
"decvar", $attrs);
166 $a_xml_writer->xmlEndTag(
"decvar");
167 $a_xml_writer->xmlEndTag(
"outcomes");
169 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
170 $this->object->getId(),
173 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
174 $this->object->getId(),
177 if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
178 if (strlen($feedback_allcorrect)) {
182 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
184 $a_xml_writer->xmlStartTag(
"conditionvar");
186 "respident" =>
"points" 188 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->object->getPoints());
189 $a_xml_writer->xmlEndTag(
"conditionvar");
192 "feedbacktype" =>
"Response",
193 "linkrefid" =>
"response_allcorrect" 195 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
196 $a_xml_writer->xmlEndTag(
"respcondition");
199 if (strlen($feedback_onenotcorrect)) {
203 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
205 $a_xml_writer->xmlStartTag(
"conditionvar");
206 $a_xml_writer->xmlStartTag(
"not");
208 "respident" =>
"points" 210 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->object->getPoints());
211 $a_xml_writer->xmlEndTag(
"not");
212 $a_xml_writer->xmlEndTag(
"conditionvar");
215 "feedbacktype" =>
"Response",
216 "linkrefid" =>
"response_onenotcorrect" 218 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
219 $a_xml_writer->xmlEndTag(
"respcondition");
223 $a_xml_writer->xmlStartTag(
"respcondition");
224 $a_xml_writer->xmlStartTag(
"conditionvar");
225 $a_xml_writer->xmlElement(
"other", null,
"tutor_rated");
226 $a_xml_writer->xmlEndTag(
"conditionvar");
227 $a_xml_writer->xmlEndTag(
"respcondition");
228 $a_xml_writer->xmlEndTag(
"resprocessing");
232 if (strlen($feedback_allcorrect)) {
234 "ident" =>
"response_allcorrect",
237 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
239 $a_xml_writer->xmlStartTag(
"flow_mat");
240 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
241 $a_xml_writer->xmlEndTag(
"flow_mat");
242 $a_xml_writer->xmlEndTag(
"itemfeedback");
244 if (strlen($feedback_onenotcorrect)) {
246 "ident" =>
"response_onenotcorrect",
249 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
251 $a_xml_writer->xmlStartTag(
"flow_mat");
252 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
253 $a_xml_writer->xmlEndTag(
"flow_mat");
254 $a_xml_writer->xmlEndTag(
"itemfeedback");
257 $a_xml_writer->xmlEndTag(
"item");
258 $a_xml_writer->xmlEndTag(
"questestinterop");
260 $xml = $a_xml_writer->xmlDumpMem(
false);
261 if (!$a_include_header) {
262 $pos = strpos(
$xml,
"?>");
Class for question exports.
addAnswerSpecificFeedback(ilXmlWriter $a_xml_writer, $answers)
Class for essay question exports.
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.
addGeneralMetadata(ilXmlWriter $xmlwriter)
xmlHeader()
Writes xml header public.
const TEXT_QUESTION_IDENTIFIER
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...