Returns a QTI xml representation of the question.
Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation
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) {
123 $attrs[
"maxchars"] = $this->
object->getMaxNumOfChars();
125 $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
129 $a_xml_writer->xmlStartTag(
"response_label", $attrs);
130 $a_xml_writer->xmlEndTag(
"response_label");
131 $a_xml_writer->xmlEndTag(
"render_fib");
133 $solution = $this->
object->getSuggestedSolution(0);
134 if (count($solution)) {
135 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
136 $a_xml_writer->xmlStartTag(
"material");
137 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
138 if (strcmp($matches[1],
"") != 0) {
139 $intlink = $solution[
"internal_link"];
142 "label" =>
"suggested_solution" 144 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
145 $a_xml_writer->xmlEndTag(
"material");
148 $a_xml_writer->xmlEndTag(
"response_str");
149 $a_xml_writer->xmlEndTag(
"flow");
150 $a_xml_writer->xmlEndTag(
"presentation");
154 "scoremodel" =>
"HumanRater" 156 $a_xml_writer->xmlStartTag(
"resprocessing", $attrs);
157 $a_xml_writer->xmlStartTag(
"outcomes");
159 "varname" =>
"WritingScore",
160 "vartype" =>
"Integer",
162 "maxvalue" => $this->
object->getPoints()
164 $a_xml_writer->xmlStartTag(
"decvar", $attrs);
165 $a_xml_writer->xmlEndTag(
"decvar");
166 $a_xml_writer->xmlEndTag(
"outcomes");
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(
"varequal", $attrs, $this->
object->getPoints());
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");
207 "respident" =>
"points" 209 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
210 $a_xml_writer->xmlEndTag(
"not");
211 $a_xml_writer->xmlEndTag(
"conditionvar");
214 "feedbacktype" =>
"Response",
215 "linkrefid" =>
"response_onenotcorrect" 217 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
218 $a_xml_writer->xmlEndTag(
"respcondition");
222 $a_xml_writer->xmlStartTag(
"respcondition");
223 $a_xml_writer->xmlStartTag(
"conditionvar");
224 $a_xml_writer->xmlElement(
"other", null,
"tutor_rated");
225 $a_xml_writer->xmlEndTag(
"conditionvar");
226 $a_xml_writer->xmlEndTag(
"respcondition");
227 $a_xml_writer->xmlEndTag(
"resprocessing");
231 if (strlen($feedback_allcorrect)) {
233 "ident" =>
"response_allcorrect",
236 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
238 $a_xml_writer->xmlStartTag(
"flow_mat");
239 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
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");
251 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
252 $a_xml_writer->xmlEndTag(
"flow_mat");
253 $a_xml_writer->xmlEndTag(
"itemfeedback");
256 $a_xml_writer->xmlEndTag(
"item");
257 $a_xml_writer->xmlEndTag(
"questestinterop");
259 $xml = $a_xml_writer->xmlDumpMem(
false);
260 if (!$a_include_header) {
261 $pos = strpos(
$xml,
"?>");
addAnswerSpecificFeedback(ilXmlWriter $a_xml_writer, $answers)
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