ILIAS  release_8 Revision v8.24
assLongMenuExport Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assLongMenuExport:
+ Collaboration diagram for assLongMenuExport:

Public Member Functions

 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 Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 
- Public Member Functions inherited from assQuestionExport
 __construct ($a_object)
 assQuestionExport constructor More...
 
 exportFeedbackOnly ($a_xml_writer)
 
 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 Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 

Data Fields

 $object
 
- Data Fields inherited from assQuestionExport
 $object
 
const ITEM_SOLUTIONHINT = 'solutionhint'
 

Additional Inherited Members

- Protected Member Functions inherited from assQuestionExport
 addAnswerSpecificFeedback (ilXmlWriter $a_xml_writer, $answers)
 
 addGenericFeedback (ilXmlWriter $a_xml_writer)
 
 addQtiMetaDataField (ilXmlWriter $a_xml_writer, $fieldLabel, $fieldValue)
 adds a qti meta data field with given name and value to the passed xml writer (xml writer must be in context of opened "qtimetadata" tag) More...
 
 addAdditionalContentEditingModeInformation (ilXmlWriter $a_xml_writer)
 adds a qti meta data field for ilias specific information of "additional content editing mode" (xml writer must be in context of opened "qtimetadata" tag) More...
 
 addGeneralMetadata (ilXmlWriter $xmlwriter)
 
 addSolutionHints (ilXmlWriter $writer)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 18 of file class.assLongMenuExport.php.

Member Function Documentation

◆ toXML()

assLongMenuExport::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 Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation.

Reimplemented from assQuestionExport.

Definition at line 25 of file class.assLongMenuExport.php.

25 : string
26 {
27 global $DIC;
28 $ilias = $DIC['ilias'];
29
30 $correct_answers = $this->object->getCorrectAnswers();
31 $answers = $this->object->getAnswers();
32
33 include_once("./Services/Xml/classes/class.ilXmlWriter.php");
34 $xml = new ilXmlWriter();
35 // set xml header
36 $xml->xmlHeader();
37 $xml->xmlStartTag("questestinterop");
38 // add question description
39 $attrs = array(
40 "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
41 "title" => $this->object->getTitle(),
42 "maxattempts" => $this->object->getNrOfTries()
43 );
44 $xml->xmlStartTag("item", $attrs);
45 // add question description
46 $xml->xmlElement("qticomment", null, $this->object->getComment());
47 $xml->xmlStartTag("itemmetadata");
48 $xml->xmlStartTag("qtimetadata");
49 $xml->xmlStartTag("qtimetadatafield");
50 $xml->xmlElement("fieldlabel", null, "ILIAS_VERSION");
51 $xml->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
52 $xml->xmlEndTag("qtimetadatafield");
53 $xml->xmlStartTag("qtimetadatafield");
54 $xml->xmlElement("fieldlabel", null, "QUESTIONTYPE");
55 $xml->xmlElement("fieldentry", null, LONG_MENU_QUESTION_IDENTIFIER);
56 $xml->xmlEndTag("qtimetadatafield");
57 $xml->xmlStartTag("qtimetadatafield");
58 $xml->xmlElement("fieldlabel", null, "AUTHOR");
59 $xml->xmlElement("fieldentry", null, $this->object->getAuthor());
60 $xml->xmlEndTag("qtimetadatafield");
61
62 $xml->xmlStartTag("qtimetadatafield");
63 $xml->xmlElement("fieldlabel", null, "minAutoCompleteLength");
64 $xml->xmlElement("fieldentry", null, $this->object->getMinAutoComplete());
65 $xml->xmlEndTag("qtimetadatafield");
66 $xml->xmlStartTag("qtimetadatafield");
67 $xml->xmlElement("fieldlabel", null, "identical_scoring");
68 $xml->xmlElement("fieldentry", null, $this->object->getIdenticalScoring());
69 $xml->xmlEndTag("qtimetadatafield");
70
71 $xml->xmlStartTag("qtimetadatafield");
72 $xml->xmlElement("fieldlabel", null, "gapTypes");
73 $gap_types = array();
74 if (is_array($correct_answers)) {
75 foreach ($correct_answers as $key => $value) {
76 $gap_types[] = $value[2];
77 }
78 }
79 $xml->xmlElement("fieldentry", null, json_encode($gap_types));
80 $xml->xmlEndTag("qtimetadatafield");
81
82 // additional content editing information
85
86 $xml->xmlStartTag("qtimetadatafield");
87 $xml->xmlElement("fieldlabel", null, "feedback_setting");
88 $xml->xmlElement("fieldentry", null, $this->object->getSpecificFeedbackSetting());
89 $xml->xmlEndTag("qtimetadatafield");
90
91 $xml->xmlEndTag("qtimetadata");
92 $xml->xmlEndTag("itemmetadata");
93 $xml->xmlStartTag("presentation");
94 // add flow to presentation
95 $xml->xmlStartTag("flow");
96
97
98 $this->object->addQTIMaterial($xml, $this->object->getQuestion());
99 $this->object->addQTIMaterial($xml, $this->object->getLongMenuTextValue());
100
101 foreach ($answers as $key => $values) {
102 $real_id = $key + 1;
103 $attrs = array(
104 "ident" => "LongMenu_" . $real_id,
105 "rcardinality" => "Single"
106 );
107 $xml->xmlStartTag("response_str", $attrs);
108 foreach ($values as $index => $value) {
109 $xml->xmlStartTag("response_label", array('ident' => $index));
110 $xml->xmlStartTag("material");
111 $xml->xmlElement("fieldentry", null, $value);
112 $xml->xmlEndTag("material");
113 $xml->xmlEndTag("response_label");
114 }
115 $xml->xmlEndTag("response_str");
116 }
117 $xml->xmlEndTag("flow");
118 $xml->xmlEndTag("presentation");
119
120 $xml->xmlStartTag("resprocessing");
121 $xml->xmlStartTag("outcomes");
122 $xml->xmlElement("decvar");
123 $xml->xmlEndTag("outcomes");
124 foreach ($answers as $key => $values) {
125 $real_id = $key + 1;
126 foreach ($values as $index => $value) {
127 $xml->xmlStartTag("respcondition", array('continue' => 'Yes'));
128 $xml->xmlStartTag("conditionvar");
129 $xml->xmlElement("varequal", array('respident' => "LongMenu_" . $real_id), $value);
130 $xml->xmlEndTag("conditionvar");
131
132 if (in_array($value, $correct_answers[$key][0])) {
133 $xml->xmlElement("setvar", array('action' => "Add"), $correct_answers[$key][1]);
134 } else {
135 $xml->xmlElement("setvar", array('action' => "Add"), 0);
136 }
137 $xml->xmlElement("displayfeedback", array('feedbacktype' => "Response", 'linkrefid' => $key . '_Response_' . $index));
138 $xml->xmlEndTag("respcondition");
139 }
140 }
141 $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
142 $this->object->getId(),
143 true
144 );
145 if (strlen($feedback_allcorrect) > 0) {
146 $xml->xmlStartTag("respcondition", array('continue' => 'Yes'));
147 $xml->xmlStartTag("conditionvar");
148 foreach ($correct_answers as $key => $values) {
149 $real_id = $key + 1;
150 if ($key > 0) {
151 $xml->xmlStartTag("and");
152 }
153
154 foreach ($values[0] as $index => $value) {
155 if ($index > 0) {
156 $xml->xmlStartTag("or");
157 }
158 $xml->xmlElement("varequal", array('respident' => "LongMenu_" . $real_id), $value);
159 if ($index > 0) {
160 $xml->xmlEndTag("or");
161 }
162 }
163 if ($key > 0) {
164 $xml->xmlEndTag("and");
165 }
166 }
167 $xml->xmlEndTag("conditionvar");
168 $xml->xmlElement("displayfeedback", array('feedbacktype' => "Response", 'linkrefid' => 'response_allcorrect'));
169 $xml->xmlEndTag("respcondition");
170 }
171
172 $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
173 $this->object->getId(),
174 false
175 );
176 if (strlen($feedback_onenotcorrect)) {
177 $xml->xmlStartTag("respcondition", array('continue' => 'Yes'));
178 $xml->xmlStartTag("conditionvar");
179 $xml->xmlStartTag("not");
180 foreach ($correct_answers as $key => $values) {
181 $real_id = $key + 1;
182 if ($key > 0) {
183 $xml->xmlStartTag("and");
184 }
185
186 foreach ($values[0] as $index => $value) {
187 if ($index > 0) {
188 $xml->xmlStartTag("or");
189 }
190 $xml->xmlElement("varequal", array('respident' => "LongMenu_" . $real_id), $value);
191 if ($index > 0) {
192 $xml->xmlEndTag("or");
193 }
194 }
195 if ($key > 0) {
196 $xml->xmlEndTag("and");
197 }
198 }
199 $xml->xmlEndTag("not");
200 $xml->xmlEndTag("conditionvar");
201 $xml->xmlElement("displayfeedback", array('feedbacktype' => "Response", 'linkrefid' => 'response_onenotcorrect'));
202 $xml->xmlEndTag("respcondition");
203 }
204
205 $xml->xmlEndTag("resprocessing");
206
207
208
209
210 for ($i = 0; $i < sizeof($correct_answers); $i++) {
211 $attrs = array(
212 "ident" => $i,
213 "view" => "All"
214 );
215 $xml->xmlStartTag("itemfeedback", $attrs);
216 // qti flow_mat
217 $xml->xmlStartTag("flow_mat");
218 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
219 $this->object->getId(),
220 0,
221 $i
222 );
223 $this->object->addQTIMaterial($xml, $fb);
224 $xml->xmlEndTag("flow_mat");
225 $xml->xmlEndTag("itemfeedback");
226 }
227
228 if (strlen($feedback_allcorrect) > 0) {
229 $xml->xmlStartTag("itemfeedback", array('ident' => 'response_allcorrect','view' => 'All'));
230 $xml->xmlStartTag("flow_mat");
231 $xml->xmlStartTag("material");
232 $xml->xmlElement("mattext", array('texttype' => 'text/xhtml'), $feedback_allcorrect);
233 $xml->xmlEndTag("material");
234 $xml->xmlEndTag("flow_mat");
235 $xml->xmlEndTag("itemfeedback");
236 }
237 if (strlen($feedback_onenotcorrect) > 0) {
238 $xml->xmlStartTag("itemfeedback", array('ident' => 'response_onenotcorrect', 'view' => 'All'));
239 $xml->xmlStartTag("flow_mat");
240 $xml->xmlStartTag("material");
241 $xml->xmlElement("mattext", array('texttype' => 'text/xhtml'), $feedback_onenotcorrect);
242 $xml->xmlEndTag("material");
243 $xml->xmlEndTag("flow_mat");
244 $xml->xmlEndTag("itemfeedback");
245 }
246
247 $xml = $this->addSolutionHints($xml);
248
249 $xml->xmlEndTag("item");
250 $xml->xmlEndTag("questestinterop");
251
252 $xml = $xml->xmlDumpMem(false);
253 if (!$a_include_header) {
254 $pos = strpos($xml, "?>");
255 $xml = substr($xml, $pos + 2);
256 }
257 return $xml;
258 }
addGeneralMetadata(ilXmlWriter $xmlwriter)
addSolutionHints(ilXmlWriter $writer)
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_INST_ID
Definition: constants.php:40
global $DIC
Definition: feed.php:28
const LONG_MENU_QUESTION_IDENTIFIER
$index
Definition: metadata.php:145
$i
Definition: metadata.php:41
$xml
Definition: metadata.php:351
string $key
Consumer key/client ID value.
Definition: System.php:193

References $DIC, $i, $index, ILIAS\LTI\ToolProvider\$key, $xml, assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addGeneralMetadata(), assQuestionExport\addSolutionHints(), IL_INST_ID, LONG_MENU_QUESTION_IDENTIFIER, and ILIAS\Repository\object().

+ Here is the call graph for this function:

Field Documentation

◆ $object

assLongMenuExport::$object

Definition at line 23 of file class.assLongMenuExport.php.


The documentation for this class was generated from the following file: