13 $ilias = $DIC[
'ilias'];
15 $correct_answers = $this->
object->getCorrectAnswers();
16 $answers = $this->
object->getAnswers();
18 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
22 $xml->xmlStartTag(
"questestinterop");
25 "ident" =>
"il_" . IL_INST_ID .
"_qst_" . $this->object->getId(),
26 "title" => $this->
object->getTitle(),
27 "maxattempts" => $this->
object->getNrOfTries()
29 $xml->xmlStartTag(
"item", $attrs);
30 $xml->xmlElement(
"qticomment", null, $this->object->getComment());
32 $workingtime = $this->
object->getEstimatedWorkingTime();
33 $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
34 $xml->xmlElement(
"duration", null, $duration);
36 $xml->xmlStartTag(
"itemmetadata");
37 $xml->xmlStartTag(
"qtimetadata");
38 $xml->xmlStartTag(
"qtimetadatafield");
39 $xml->xmlElement(
"fieldlabel", null,
"ILIAS_VERSION");
40 $xml->xmlElement(
"fieldentry", null, $ilias->getSetting(
"ilias_version"));
41 $xml->xmlEndTag(
"qtimetadatafield");
42 $xml->xmlStartTag(
"qtimetadatafield");
43 $xml->xmlElement(
"fieldlabel", null,
"QUESTIONTYPE");
45 $xml->xmlEndTag(
"qtimetadatafield");
46 $xml->xmlStartTag(
"qtimetadatafield");
47 $xml->xmlElement(
"fieldlabel", null,
"AUTHOR");
48 $xml->xmlElement(
"fieldentry", null, $this->object->getAuthor());
49 $xml->xmlEndTag(
"qtimetadatafield");
51 $xml->xmlStartTag(
"qtimetadatafield");
52 $xml->xmlElement(
"fieldlabel", null,
"minAutoCompleteLength");
53 $xml->xmlElement(
"fieldentry", null, $this->object->getMinAutoComplete());
54 $xml->xmlEndTag(
"qtimetadatafield");
55 $xml->xmlStartTag(
"qtimetadatafield");
56 $xml->xmlElement(
"fieldlabel", null,
"identical_scoring");
57 $xml->xmlElement(
"fieldentry", null, $this->object->getIdenticalScoring());
58 $xml->xmlEndTag(
"qtimetadatafield");
60 $xml->xmlStartTag(
"qtimetadatafield");
61 $xml->xmlElement(
"fieldlabel", null,
"gapTypes");
63 if (is_array($correct_answers)) {
64 foreach ($correct_answers as
$key => $value) {
65 $gap_types[] = $value[2];
68 $xml->xmlElement(
"fieldentry", null, json_encode($gap_types));
69 $xml->xmlEndTag(
"qtimetadatafield");
75 $xml->xmlStartTag(
"qtimetadatafield");
76 $xml->xmlElement(
"fieldlabel", null,
"feedback_setting");
77 $xml->xmlElement(
"fieldentry", null, $this->object->getSpecificFeedbackSetting());
78 $xml->xmlEndTag(
"qtimetadatafield");
80 $xml->xmlEndTag(
"qtimetadata");
81 $xml->xmlEndTag(
"itemmetadata");
82 $xml->xmlStartTag(
"presentation");
84 $xml->xmlStartTag(
"flow");
87 $this->
object->addQTIMaterial(
$xml, $this->object->getQuestion());
88 $this->
object->addQTIMaterial(
$xml, $this->object->getLongMenuTextValue());
93 "ident" =>
"LongMenu_" . $real_id,
94 "rcardinality" =>
"Single" 96 $xml->xmlStartTag(
"response_str", $attrs);
98 $xml->xmlStartTag(
"response_label", array(
'ident' =>
$index));
99 $xml->xmlStartTag(
"material");
100 $xml->xmlElement(
"fieldentry", null, $value);
101 $xml->xmlEndTag(
"material");
102 $xml->xmlEndTag(
"response_label");
104 $xml->xmlEndTag(
"response_str");
106 $xml->xmlEndTag(
"flow");
107 $xml->xmlEndTag(
"presentation");
109 $xml->xmlStartTag(
"resprocessing");
110 $xml->xmlStartTag(
"outcomes");
111 $xml->xmlElement(
"decvar");
112 $xml->xmlEndTag(
"outcomes");
116 $xml->xmlStartTag(
"respcondition", array(
'continue' =>
'Yes'));
117 $xml->xmlStartTag(
"conditionvar");
118 $xml->xmlElement(
"varequal", array(
'respident' =>
"LongMenu_" . $real_id), $value);
119 $xml->xmlEndTag(
"conditionvar");
121 if (in_array($value, $correct_answers[
$key][0])) {
122 $xml->xmlElement(
"setvar", array(
'action' =>
"Add"), $correct_answers[$key][1]);
124 $xml->xmlElement(
"setvar", array(
'action' =>
"Add"), 0);
126 $xml->xmlElement(
"displayfeedback", array(
'feedbacktype' =>
"Response",
'linkrefid' => $key .
'_Response_' .
$index));
127 $xml->xmlEndTag(
"respcondition");
130 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
131 $this->object->getId(),
134 if (strlen($feedback_allcorrect) > 0) {
135 $xml->xmlStartTag(
"respcondition", array(
'continue' =>
'Yes'));
136 $xml->xmlStartTag(
"conditionvar");
137 foreach ($correct_answers as $key =>
$values) {
140 $xml->xmlStartTag(
"and");
145 $xml->xmlStartTag(
"or");
147 $xml->xmlElement(
"varequal", array(
'respident' =>
"LongMenu_" . $real_id), $value);
149 $xml->xmlEndTag(
"or");
153 $xml->xmlEndTag(
"and");
156 $xml->xmlEndTag(
"conditionvar");
157 $xml->xmlElement(
"displayfeedback", array(
'feedbacktype' =>
"Response",
'linkrefid' =>
'response_allcorrect'));
158 $xml->xmlEndTag(
"respcondition");
161 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
162 $this->object->getId(),
165 if (strlen($feedback_onenotcorrect)) {
166 $xml->xmlStartTag(
"respcondition", array(
'continue' =>
'Yes'));
167 $xml->xmlStartTag(
"conditionvar");
168 $xml->xmlStartTag(
"not");
169 foreach ($correct_answers as $key =>
$values) {
172 $xml->xmlStartTag(
"and");
177 $xml->xmlStartTag(
"or");
179 $xml->xmlElement(
"varequal", array(
'respident' =>
"LongMenu_" . $real_id), $value);
181 $xml->xmlEndTag(
"or");
185 $xml->xmlEndTag(
"and");
188 $xml->xmlEndTag(
"not");
189 $xml->xmlEndTag(
"conditionvar");
190 $xml->xmlElement(
"displayfeedback", array(
'feedbacktype' =>
"Response",
'linkrefid' =>
'response_onenotcorrect'));
191 $xml->xmlEndTag(
"respcondition");
194 $xml->xmlEndTag(
"resprocessing");
199 for (
$i = 0;
$i <
sizeof($correct_answers);
$i++) {
204 $xml->xmlStartTag(
"itemfeedback", $attrs);
206 $xml->xmlStartTag(
"flow_mat");
207 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
208 $this->object->getId(),
212 $this->
object->addQTIMaterial(
$xml, $fb);
213 $xml->xmlEndTag(
"flow_mat");
214 $xml->xmlEndTag(
"itemfeedback");
217 if (strlen($feedback_allcorrect) > 0) {
218 $xml->xmlStartTag(
"itemfeedback", array(
'ident' =>
'response_allcorrect',
'view' =>
'All'));
219 $xml->xmlStartTag(
"flow_mat");
220 $xml->xmlStartTag(
"material");
221 $xml->xmlElement(
"mattext", array(
'texttype' =>
'text/xhtml'), $feedback_allcorrect);
222 $xml->xmlEndTag(
"material");
223 $xml->xmlEndTag(
"flow_mat");
224 $xml->xmlEndTag(
"itemfeedback");
226 if (strlen($feedback_onenotcorrect) > 0) {
227 $xml->xmlStartTag(
"itemfeedback", array(
'ident' =>
'response_onenotcorrect',
'view' =>
'All'));
228 $xml->xmlStartTag(
"flow_mat");
229 $xml->xmlStartTag(
"material");
230 $xml->xmlElement(
"mattext", array(
'texttype' =>
'text/xhtml'), $feedback_onenotcorrect);
231 $xml->xmlEndTag(
"material");
232 $xml->xmlEndTag(
"flow_mat");
233 $xml->xmlEndTag(
"itemfeedback");
236 $xml->xmlEndTag(
"item");
237 $xml->xmlEndTag(
"questestinterop");
240 if (!$a_include_header) {
241 $pos = strpos(
$xml,
"?>");
const LONG_MENU_QUESTION_IDENTIFIER
addGeneralMetadata(ilXmlWriter $xmlwriter)
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...