ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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...
 
 addQTIMaterial (ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
 

Data Fields

 $object
 
- Data Fields inherited from assQuestionExport
 $object
 

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)
 
 addSuggestedSolution (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 19 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 26 of file class.assLongMenuExport.php.

26 : string
27 {
28 global $DIC;
29 $ilias = $DIC['ilias'];
30
31 $correct_answers = $this->object->getCorrectAnswers();
32 $answers = $this->object->getAnswers();
33
34 $xml = new ilXmlWriter();
35 // set xml header
36 $xml->xmlHeader();
37 $xml->xmlStartTag("questestinterop");
38 // add question description
39 $attrs = [
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, $this->object->getQuestionType());
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 = [];
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
84 $this->addGeneralMetadata($xml);
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->addQTIMaterial($xml, $this->object->getQuestion());
99 $this->addQTIMaterial($xml, $this->object->getLongMenuTextValue());
100
101 foreach ($answers as $key => $values) {
102 $real_id = $key + 1;
103 $attrs = [
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", ['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 = $this->addSuggestedSolution($xml);
119 $xml->xmlEndTag("presentation");
120
121 $xml->xmlStartTag("resprocessing");
122 $xml->xmlStartTag("outcomes");
123 $xml->xmlElement("decvar");
124 $xml->xmlEndTag("outcomes");
125 foreach ($answers as $key => $values) {
126 $real_id = $key + 1;
127 foreach ($values as $index => $value) {
128 $xml->xmlStartTag("respcondition", ['continue' => 'Yes']);
129 $xml->xmlStartTag("conditionvar");
130 $xml->xmlElement("varequal", ['respident' => "LongMenu_" . $real_id], $value);
131 $xml->xmlEndTag("conditionvar");
132
133 if (in_array($value, $correct_answers[$key][0])) {
134 $xml->xmlElement("setvar", ['action' => "Add"], $correct_answers[$key][1]);
135 } else {
136 $xml->xmlElement("setvar", ['action' => "Add"], 0);
137 }
138 $xml->xmlElement("displayfeedback", ['feedbacktype' => "Response", 'linkrefid' => $key . '_Response_' . $index]);
139 $xml->xmlEndTag("respcondition");
140 }
141 }
142 $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
143 $this->object->getId(),
144 true
145 );
146 if (strlen($feedback_allcorrect) > 0) {
147 $xml->xmlStartTag("respcondition", ['continue' => 'Yes']);
148 $xml->xmlStartTag("conditionvar");
149 foreach ($correct_answers as $key => $values) {
150 $real_id = $key + 1;
151 if ($key > 0) {
152 $xml->xmlStartTag("and");
153 }
154
155 foreach ($values[0] as $index => $value) {
156 if ($index > 0) {
157 $xml->xmlStartTag("or");
158 }
159 $xml->xmlElement("varequal", ['respident' => "LongMenu_" . $real_id], $value);
160 if ($index > 0) {
161 $xml->xmlEndTag("or");
162 }
163 }
164 if ($key > 0) {
165 $xml->xmlEndTag("and");
166 }
167 }
168 $xml->xmlEndTag("conditionvar");
169 $xml->xmlElement("displayfeedback", ['feedbacktype' => "Response", 'linkrefid' => 'response_allcorrect']);
170 $xml->xmlEndTag("respcondition");
171 }
172
173 $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
174 $this->object->getId(),
175 false
176 );
177 if (strlen($feedback_onenotcorrect)) {
178 $xml->xmlStartTag("respcondition", ['continue' => 'Yes']);
179 $xml->xmlStartTag("conditionvar");
180 $xml->xmlStartTag("not");
181 foreach ($correct_answers as $key => $values) {
182 $real_id = $key + 1;
183 if ($key > 0) {
184 $xml->xmlStartTag("and");
185 }
186
187 foreach ($values[0] as $index => $value) {
188 if ($index > 0) {
189 $xml->xmlStartTag("or");
190 }
191 $xml->xmlElement("varequal", ['respident' => "LongMenu_" . $real_id], $value);
192 if ($index > 0) {
193 $xml->xmlEndTag("or");
194 }
195 }
196 if ($key > 0) {
197 $xml->xmlEndTag("and");
198 }
199 }
200 $xml->xmlEndTag("not");
201 $xml->xmlEndTag("conditionvar");
202 $xml->xmlElement("displayfeedback", ['feedbacktype' => "Response", 'linkrefid' => 'response_onenotcorrect']);
203 $xml->xmlEndTag("respcondition");
204 }
205
206 $xml->xmlEndTag("resprocessing");
207
208
209
210
211 for ($i = 0; $i < sizeof($correct_answers); $i++) {
212 $attrs = [
213 "ident" => $i,
214 "view" => "All"
215 ];
216 $xml->xmlStartTag("itemfeedback", $attrs);
217 // qti flow_mat
218 $xml->xmlStartTag("flow_mat");
219 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
220 $this->object->getId(),
221 0,
222 $i
223 );
224 $this->addQTIMaterial($xml, $fb);
225 $xml->xmlEndTag("flow_mat");
226 $xml->xmlEndTag("itemfeedback");
227 }
228
229 if (strlen($feedback_allcorrect) > 0) {
230 $xml->xmlStartTag("itemfeedback", ['ident' => 'response_allcorrect','view' => 'All']);
231 $xml->xmlStartTag("flow_mat");
232 $xml->xmlStartTag("material");
233 $xml->xmlElement("mattext", ['texttype' => 'text/xhtml'], $feedback_allcorrect);
234 $xml->xmlEndTag("material");
235 $xml->xmlEndTag("flow_mat");
236 $xml->xmlEndTag("itemfeedback");
237 }
238 if (strlen($feedback_onenotcorrect) > 0) {
239 $xml->xmlStartTag("itemfeedback", ['ident' => 'response_onenotcorrect', 'view' => 'All']);
240 $xml->xmlStartTag("flow_mat");
241 $xml->xmlStartTag("material");
242 $xml->xmlElement("mattext", ['texttype' => 'text/xhtml'], $feedback_onenotcorrect);
243 $xml->xmlEndTag("material");
244 $xml->xmlEndTag("flow_mat");
245 $xml->xmlEndTag("itemfeedback");
246 }
247
248 $xml->xmlEndTag("item");
249 $xml->xmlEndTag("questestinterop");
250
251 $xml = $xml->xmlDumpMem(false);
252 if (!$a_include_header) {
253 $pos = strpos($xml, "?>");
254 $xml = substr($xml, $pos + 2);
255 }
256 return $xml;
257 }
addGeneralMetadata(ilXmlWriter $xmlwriter)
addQTIMaterial(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
addSuggestedSolution(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: shib_login.php:26

References $DIC, assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addGeneralMetadata(), assQuestionExport\addQTIMaterial(), assQuestionExport\addSuggestedSolution(), IL_INST_ID, and ILIAS\Repository\object().

+ Here is the call graph for this function:

Field Documentation

◆ $object

assLongMenuExport::$object

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


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