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->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");
79 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
80 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"matchcondition");
81 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
object->matchcondition);
82 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
84 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
85 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"termscoring");
86 $scores = base64_encode(serialize($this->
object->getAnswers()));
87 $a_xml_writer->xmlElement(
"fieldentry", NULL, $scores);
88 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
90 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
91 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"termrelation");
92 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
object->getKeywordRelation());
93 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
95 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
96 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"specificfeedback");
97 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
object->getKeywordRelation());
98 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
100 $a_xml_writer->xmlEndTag(
"qtimetadata");
101 $a_xml_writer->xmlEndTag(
"itemmetadata");
105 "label" => $this->
object->getTitle()
107 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
109 $a_xml_writer->xmlStartTag(
"flow");
111 $this->
object->addQTIMaterial($a_xml_writer, $this->
object->getQuestion());
115 "rcardinality" =>
"Ordered" 117 $a_xml_writer->xmlStartTag(
"response_str", $attrs);
119 "fibtype" =>
"String",
122 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))
137 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches))
139 $a_xml_writer->xmlStartTag(
"material");
140 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
141 if (strcmp($matches[1],
"") != 0)
143 $intlink = $solution[
"internal_link"];
146 "label" =>
"suggested_solution" 148 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
149 $a_xml_writer->xmlEndTag(
"material");
152 $a_xml_writer->xmlEndTag(
"response_str");
153 $a_xml_writer->xmlEndTag(
"flow");
154 $a_xml_writer->xmlEndTag(
"presentation");
158 "scoremodel" =>
"HumanRater" 160 $a_xml_writer->xmlStartTag(
"resprocessing", $attrs);
161 $a_xml_writer->xmlStartTag(
"outcomes");
163 "varname" =>
"WritingScore",
164 "vartype" =>
"Integer",
166 "maxvalue" => $this->
object->getPoints()
168 $a_xml_writer->xmlStartTag(
"decvar", $attrs);
169 $a_xml_writer->xmlEndTag(
"decvar");
170 $a_xml_writer->xmlEndTag(
"outcomes");
172 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
173 $this->
object->getId(), true
175 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
176 $this->
object->getId(), false
178 if (strlen($feedback_allcorrect . $feedback_onenotcorrect))
180 if (strlen($feedback_allcorrect))
185 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
187 $a_xml_writer->xmlStartTag(
"conditionvar");
189 "respident" =>
"points" 191 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
192 $a_xml_writer->xmlEndTag(
"conditionvar");
195 "feedbacktype" =>
"Response",
196 "linkrefid" =>
"response_allcorrect" 198 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
199 $a_xml_writer->xmlEndTag(
"respcondition");
202 if (strlen($feedback_onenotcorrect))
207 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
209 $a_xml_writer->xmlStartTag(
"conditionvar");
210 $a_xml_writer->xmlStartTag(
"not");
212 "respident" =>
"points" 214 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
215 $a_xml_writer->xmlEndTag(
"not");
216 $a_xml_writer->xmlEndTag(
"conditionvar");
219 "feedbacktype" =>
"Response",
220 "linkrefid" =>
"response_onenotcorrect" 222 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
223 $a_xml_writer->xmlEndTag(
"respcondition");
227 $a_xml_writer->xmlStartTag(
"respcondition");
228 $a_xml_writer->xmlStartTag(
"conditionvar");
229 $a_xml_writer->xmlElement(
"other", NULL,
"tutor_rated");
230 $a_xml_writer->xmlEndTag(
"conditionvar");
231 $a_xml_writer->xmlEndTag(
"respcondition");
232 $a_xml_writer->xmlEndTag(
"resprocessing");
236 if (strlen($feedback_allcorrect))
239 "ident" =>
"response_allcorrect",
242 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
244 $a_xml_writer->xmlStartTag(
"flow_mat");
245 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
246 $a_xml_writer->xmlEndTag(
"flow_mat");
247 $a_xml_writer->xmlEndTag(
"itemfeedback");
249 if (strlen($feedback_onenotcorrect))
252 "ident" =>
"response_onenotcorrect",
255 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
257 $a_xml_writer->xmlStartTag(
"flow_mat");
258 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
259 $a_xml_writer->xmlEndTag(
"flow_mat");
260 $a_xml_writer->xmlEndTag(
"itemfeedback");
263 $a_xml_writer->xmlEndTag(
"item");
264 $a_xml_writer->xmlEndTag(
"questestinterop");
266 $xml = $a_xml_writer->xmlDumpMem(FALSE);
267 if (!$a_include_header)
269 $pos = strpos($xml,
"?>");
270 $xml = substr($xml, $pos + 2);
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
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