14 $correct_answers = $this->
object->getCorrectAnswers();
15 $answers = $this->
object->getAnswers();
17 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
21 $xml->xmlStartTag(
"questestinterop");
24 "ident" =>
"il_" . IL_INST_ID .
"_qst_" . $this->
object->getId(),
25 "title" => $this->
object->getTitle(),
26 "maxattempts" => $this->
object->getNrOfTries()
28 $xml->xmlStartTag(
"item", $attrs);
29 $xml->xmlElement(
"qticomment", null, $this->
object->getComment());
31 $workingtime = $this->
object->getEstimatedWorkingTime();
32 $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
33 $xml->xmlElement(
"duration", null, $duration);
35 $xml->xmlStartTag(
"itemmetadata");
36 $xml->xmlStartTag(
"qtimetadata");
37 $xml->xmlStartTag(
"qtimetadatafield");
38 $xml->xmlElement(
"fieldlabel", null,
"ILIAS_VERSION");
39 $xml->xmlElement(
"fieldentry", null, $ilias->getSetting(
"ilias_version"));
40 $xml->xmlEndTag(
"qtimetadatafield");
41 $xml->xmlStartTag(
"qtimetadatafield");
42 $xml->xmlElement(
"fieldlabel", null,
"QUESTIONTYPE");
44 $xml->xmlEndTag(
"qtimetadatafield");
45 $xml->xmlStartTag(
"qtimetadatafield");
46 $xml->xmlElement(
"fieldlabel", null,
"AUTHOR");
47 $xml->xmlElement(
"fieldentry", null, $this->
object->getAuthor());
48 $xml->xmlEndTag(
"qtimetadatafield");
50 $xml->xmlStartTag(
"qtimetadatafield");
51 $xml->xmlElement(
"fieldlabel", null,
"minAutoCompleteLength");
52 $xml->xmlElement(
"fieldentry", null, $this->
object->getMinAutoComplete());
53 $xml->xmlEndTag(
"qtimetadatafield");
55 $xml->xmlStartTag(
"qtimetadatafield");
56 $xml->xmlElement(
"fieldlabel", null,
"gapTypes");
58 if (is_array($correct_answers)) {
59 foreach ($correct_answers as
$key => $value) {
60 $gap_types[] = $value[2];
63 $xml->xmlElement(
"fieldentry", null, json_encode($gap_types));
64 $xml->xmlEndTag(
"qtimetadatafield");
70 $xml->xmlStartTag(
"qtimetadatafield");
71 $xml->xmlElement(
"fieldlabel", null,
"feedback_setting");
72 $xml->xmlElement(
"fieldentry", null, $this->
object->getSpecificFeedbackSetting());
73 $xml->xmlEndTag(
"qtimetadatafield");
75 $xml->xmlEndTag(
"qtimetadata");
76 $xml->xmlEndTag(
"itemmetadata");
77 $xml->xmlStartTag(
"presentation");
79 $xml->xmlStartTag(
"flow");
82 $this->
object->addQTIMaterial(
$xml, $this->
object->getQuestion());
83 $this->
object->addQTIMaterial(
$xml, $this->
object->getLongMenuTextValue());
85 foreach ($answers as
$key => $values) {
88 "ident" =>
"LongMenu_" . $real_id,
89 "rcardinality" =>
"Single" 91 $xml->xmlStartTag(
"response_str", $attrs);
92 foreach ($values as
$index => $value) {
94 $xml->xmlStartTag(
"material");
95 $xml->xmlElement(
"fieldentry", null, $value);
96 $xml->xmlEndTag(
"material");
97 $xml->xmlEndTag(
"response_label");
99 $xml->xmlEndTag(
"response_str");
101 $xml->xmlEndTag(
"flow");
102 $xml->xmlEndTag(
"presentation");
104 $xml->xmlStartTag(
"resprocessing");
105 $xml->xmlStartTag(
"outcomes");
106 $xml->xmlElement(
"decvar");
107 $xml->xmlEndTag(
"outcomes");
108 foreach ($answers as
$key => $values) {
110 foreach ($values as
$index => $value) {
111 $xml->xmlStartTag(
"respcondition",
array(
'continue' =>
'Yes'));
112 $xml->xmlStartTag(
"conditionvar");
113 $xml->xmlElement(
"varequal",
array(
'respident' =>
"LongMenu_" . $real_id), $value);
114 $xml->xmlEndTag(
"conditionvar");
116 if (in_array($value, $correct_answers[
$key][0])) {
117 $xml->xmlElement(
"setvar",
array(
'action' =>
"Add"), $correct_answers[$key][1]);
119 $xml->xmlElement(
"setvar",
array(
'action' =>
"Add"), 0);
121 $xml->xmlElement(
"displayfeedback",
array(
'feedbacktype' =>
"Response",
'linkrefid' => $key .
'_Response_' .
$index));
122 $xml->xmlEndTag(
"respcondition");
125 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
129 if (strlen($feedback_allcorrect) > 0) {
130 $xml->xmlStartTag(
"respcondition",
array(
'continue' =>
'Yes'));
131 $xml->xmlStartTag(
"conditionvar");
132 foreach ($correct_answers as $key => $values) {
135 $xml->xmlStartTag(
"and");
138 foreach ($values[0] as
$index => $value) {
140 $xml->xmlStartTag(
"or");
142 $xml->xmlElement(
"varequal",
array(
'respident' =>
"LongMenu_" . $real_id), $value);
144 $xml->xmlEndTag(
"or");
148 $xml->xmlEndTag(
"and");
151 $xml->xmlEndTag(
"conditionvar");
152 $xml->xmlElement(
"displayfeedback",
array(
'feedbacktype' =>
"Response",
'linkrefid' =>
'response_allcorrect'));
153 $xml->xmlEndTag(
"respcondition");
156 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
160 if (strlen($feedback_onenotcorrect)) {
161 $xml->xmlStartTag(
"respcondition",
array(
'continue' =>
'Yes'));
162 $xml->xmlStartTag(
"conditionvar");
163 $xml->xmlStartTag(
"not");
164 foreach ($correct_answers as $key => $values) {
167 $xml->xmlStartTag(
"and");
170 foreach ($values[0] as
$index => $value) {
172 $xml->xmlStartTag(
"or");
174 $xml->xmlElement(
"varequal",
array(
'respident' =>
"LongMenu_" . $real_id), $value);
176 $xml->xmlEndTag(
"or");
180 $xml->xmlEndTag(
"and");
183 $xml->xmlEndTag(
"not");
184 $xml->xmlEndTag(
"conditionvar");
185 $xml->xmlElement(
"displayfeedback",
array(
'feedbacktype' =>
"Response",
'linkrefid' =>
'response_onenotcorrect'));
186 $xml->xmlEndTag(
"respcondition");
189 $xml->xmlEndTag(
"resprocessing");
194 for (
$i = 0;
$i <
sizeof($correct_answers);
$i++) {
199 $xml->xmlStartTag(
"itemfeedback", $attrs);
201 $xml->xmlStartTag(
"flow_mat");
202 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
206 $this->
object->addQTIMaterial(
$xml, $fb);
207 $xml->xmlEndTag(
"flow_mat");
208 $xml->xmlEndTag(
"itemfeedback");
211 if (strlen($feedback_allcorrect) > 0) {
212 $xml->xmlStartTag(
"itemfeedback",
array(
'ident' =>
'response_allcorrect',
'view' =>
'All'));
213 $xml->xmlStartTag(
"flow_mat");
214 $xml->xmlStartTag(
"material");
215 $xml->xmlElement(
"mattext",
array(
'texttype' =>
'text/xhtml'), $feedback_allcorrect);
216 $xml->xmlEndTag(
"material");
217 $xml->xmlEndTag(
"flow_mat");
218 $xml->xmlEndTag(
"itemfeedback");
220 if (strlen($feedback_onenotcorrect) > 0) {
221 $xml->xmlStartTag(
"itemfeedback",
array(
'ident' =>
'response_onenotcorrect',
'view' =>
'All'));
222 $xml->xmlStartTag(
"flow_mat");
223 $xml->xmlStartTag(
"material");
224 $xml->xmlElement(
"mattext",
array(
'texttype' =>
'text/xhtml'), $feedback_onenotcorrect);
225 $xml->xmlEndTag(
"material");
226 $xml->xmlEndTag(
"flow_mat");
227 $xml->xmlEndTag(
"itemfeedback");
230 $xml->xmlEndTag(
"item");
231 $xml->xmlEndTag(
"questestinterop");
234 if (!$a_include_header) {
235 $pos = strpos(
$xml,
"?>");
const LONG_MENU_QUESTION_IDENTIFIER
addGeneralMetadata(ilXmlWriter $xmlwriter)
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