ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assClozeTestExport Class Reference

Class for cloze question exports. More...

+ Inheritance diagram for assClozeTestExport:
+ Collaboration diagram for assClozeTestExport:

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. More...
 
 buildQtiExportIdent (ilAssSpecificFeedbackIdentifier $fbIdentifier)
 
- 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. More...
 

Protected Member Functions

 exportAnswerSpecificFeedbacks (ilXmlWriter $xmlWriter)
 
- 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)
 

Additional Inherited Members

- Data Fields inherited from assQuestionExport
 $object
 

Detailed Description

Class for cloze question exports.

assClozeTestExport is a class for cloze question exports

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 15 of file class.assClozeTestExport.php.

Member Function Documentation

◆ buildQtiExportIdent()

assClozeTestExport::buildQtiExportIdent ( ilAssSpecificFeedbackIdentifier  $fbIdentifier)
Parameters
ilAssSpecificFeedbackIdentifier$fbIdentifier
Returns
string

Definition at line 633 of file class.assClozeTestExport.php.

Referenced by exportAnswerSpecificFeedbacks().

634  {
635  return "{$fbIdentifier->getQuestionIndex()}_{$fbIdentifier->getAnswerIndex()}";
636  }
+ Here is the caller graph for this function:

◆ exportAnswerSpecificFeedbacks()

assClozeTestExport::exportAnswerSpecificFeedbacks ( ilXmlWriter  $xmlWriter)
protected
Parameters
ilXmlWriter$xmlWriter

Definition at line 604 of file class.assClozeTestExport.php.

References buildQtiExportIdent(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by toXML().

605  {
606  require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssSpecificFeedbackIdentifierList.php';
607  $feedbackIdentifierList = new ilAssSpecificFeedbackIdentifierList();
608  $feedbackIdentifierList->load($this->object->getId());
609 
610  foreach ($feedbackIdentifierList as $fbIdentifier) {
611  $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
612  $this->object->getId(),
613  $fbIdentifier->getQuestionIndex(),
614  $fbIdentifier->getAnswerIndex()
615  );
616 
617  $xmlWriter->xmlStartTag("itemfeedback", array(
618  "ident" => $this->buildQtiExportIdent($fbIdentifier), "view" => "All"
619  ));
620 
621  $xmlWriter->xmlStartTag("flow_mat");
622  $this->object->addQTIMaterial($xmlWriter, $feedback);
623  $xmlWriter->xmlEndTag("flow_mat");
624 
625  $xmlWriter->xmlEndTag("itemfeedback");
626  }
627  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
buildQtiExportIdent(ilAssSpecificFeedbackIdentifier $fbIdentifier)
xmlEndTag($tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

assClozeTestExport::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

Returns
string The QTI xml representation of the question public

Definition at line 26 of file class.assClozeTestExport.php.

References $DIC, $i, $key, $xml, assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addGeneralMetadata(), CLOZE_NUMERIC, CLOZE_SELECT, CLOZE_TEST_IDENTIFIER, CLOZE_TEXT, exportAnswerSpecificFeedbacks(), and ilXmlWriter\xmlHeader().

27  {
28  global $DIC;
29  $ilias = $DIC['ilias'];
30 
31  include_once "./Services/Math/classes/class.EvalMath.php";
32  $eval = new EvalMath();
33  $eval->suppress_errors = true;
34  include_once("./Services/Xml/classes/class.ilXmlWriter.php");
35  $a_xml_writer = new ilXmlWriter;
36  // set xml header
37  $a_xml_writer->xmlHeader();
38  $a_xml_writer->xmlStartTag("questestinterop");
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  $a_xml_writer->xmlStartTag("item", $attrs);
45  // add question description
46  $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
47  // add estimated working time
48  $workingtime = $this->object->getEstimatedWorkingTime();
49  $duration = sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]);
50  $a_xml_writer->xmlElement("duration", null, $duration);
51  // add ILIAS specific metadata
52  $a_xml_writer->xmlStartTag("itemmetadata");
53  $a_xml_writer->xmlStartTag("qtimetadata");
54  $a_xml_writer->xmlStartTag("qtimetadatafield");
55  $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
56  $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
57  $a_xml_writer->xmlEndTag("qtimetadatafield");
58  $a_xml_writer->xmlStartTag("qtimetadatafield");
59  $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
60  $a_xml_writer->xmlElement("fieldentry", null, CLOZE_TEST_IDENTIFIER);
61  $a_xml_writer->xmlEndTag("qtimetadatafield");
62  $a_xml_writer->xmlStartTag("qtimetadatafield");
63  $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
64  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
65  $a_xml_writer->xmlEndTag("qtimetadatafield");
66 
67  // additional content editing information
68  $this->addAdditionalContentEditingModeInformation($a_xml_writer);
69  $this->addGeneralMetadata($a_xml_writer);
70 
71  $a_xml_writer->xmlStartTag("qtimetadatafield");
72  $a_xml_writer->xmlElement("fieldlabel", null, "textgaprating");
73  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getTextgapRating());
74  $a_xml_writer->xmlEndTag("qtimetadatafield");
75 
76  $a_xml_writer->xmlStartTag("qtimetadatafield");
77  $a_xml_writer->xmlElement("fieldlabel", null, "fixedTextLength");
78  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getFixedTextLength());
79  $a_xml_writer->xmlEndTag("qtimetadatafield");
80 
81  $a_xml_writer->xmlStartTag("qtimetadatafield");
82  $a_xml_writer->xmlElement("fieldlabel", null, "identicalScoring");
83  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getIdenticalScoring());
84  $a_xml_writer->xmlEndTag("qtimetadatafield");
85 
86  $a_xml_writer->xmlStartTag("qtimetadatafield");
87  $a_xml_writer->xmlElement("fieldlabel", null, "feedback_mode");
88  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getFeedbackMode());
89  $a_xml_writer->xmlEndTag("qtimetadatafield");
90 
91  $a_xml_writer->xmlStartTag("qtimetadatafield");
92  $a_xml_writer->xmlElement("fieldlabel", null, "combinations");
93  $a_xml_writer->xmlElement("fieldentry", null, base64_encode(json_encode($this->object->getGapCombinations())));
94  $a_xml_writer->xmlEndTag("qtimetadatafield");
95 
96  $a_xml_writer->xmlEndTag("qtimetadata");
97  $a_xml_writer->xmlEndTag("itemmetadata");
98 
99  // PART I: qti presentation
100  $attrs = array(
101  "label" => $this->object->getTitle()
102  );
103  $a_xml_writer->xmlStartTag("presentation", $attrs);
104  // add flow to presentation
105  $a_xml_writer->xmlStartTag("flow");
106 
107  $questionText = $this->object->getQuestion() ? $this->object->getQuestion() : ' ';
108  $this->object->addQTIMaterial($a_xml_writer, $questionText);
109 
110  $text_parts = preg_split("/\[gap.*?\[\/gap\]/", $this->object->getClozeText());
111 
112  // add material with question text to presentation
113  for ($i = 0; $i <= $this->object->getGapCount(); $i++) {
114  $this->object->addQTIMaterial($a_xml_writer, $text_parts[$i]);
115 
116  if ($i < $this->object->getGapCount()) {
117  // add gap
118  $gap = $this->object->getGap($i);
119  switch ($gap->getType()) {
120  case CLOZE_SELECT:
121  // comboboxes
122  $attrs = array(
123  "ident" => "gap_$i",
124  "rcardinality" => "Single"
125  );
126  $a_xml_writer->xmlStartTag("response_str", $attrs);
127  $solution = $this->object->getSuggestedSolution($i);
128  if (count($solution)) {
129  if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches)) {
130  $attrs = array(
131  "label" => "suggested_solution"
132  );
133  $a_xml_writer->xmlStartTag("material", $attrs);
134  $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
135  if (strcmp($matches[1], "") != 0) {
136  $intlink = $solution["internal_link"];
137  }
138  $a_xml_writer->xmlElement("mattext", null, $intlink);
139  $a_xml_writer->xmlEndTag("material");
140  }
141  }
142 
143  $attrs = array("shuffle" => ($gap->getShuffle() ? "Yes" : "No"));
144  $a_xml_writer->xmlStartTag("render_choice", $attrs);
145 
146  // add answers
147  foreach ($gap->getItems(new ilArrayElementOrderKeeper()) as $answeritem) {
148  $attrs = array(
149  "ident" => $answeritem->getOrder()
150  );
151  $a_xml_writer->xmlStartTag("response_label", $attrs);
152  $a_xml_writer->xmlStartTag("material");
153  $a_xml_writer->xmlElement("mattext", null, $answeritem->getAnswertext());
154  $a_xml_writer->xmlEndTag("material");
155  $a_xml_writer->xmlEndTag("response_label");
156  }
157  $a_xml_writer->xmlEndTag("render_choice");
158  $a_xml_writer->xmlEndTag("response_str");
159  break;
160  case CLOZE_TEXT:
161  // text fields
162  $attrs = array(
163  "ident" => "gap_$i",
164  "rcardinality" => "Single"
165  );
166  $a_xml_writer->xmlStartTag("response_str", $attrs);
167  $solution = $this->object->getSuggestedSolution($i);
168  if (count($solution)) {
169  if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches)) {
170  $attrs = array(
171  "label" => "suggested_solution"
172  );
173  $a_xml_writer->xmlStartTag("material", $attrs);
174  $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
175  if (strcmp($matches[1], "") != 0) {
176  $intlink = $solution["internal_link"];
177  }
178  $a_xml_writer->xmlElement("mattext", null, $intlink);
179  $a_xml_writer->xmlEndTag("material");
180  }
181  }
182  $attrs = array(
183  "fibtype" => "String",
184  "prompt" => "Box",
185  "columns" => $gap->getMaxWidth(),
186  "maxchars" => $gap->getGapSize()
187  );
188  $a_xml_writer->xmlStartTag("render_fib", $attrs);
189  $a_xml_writer->xmlEndTag("render_fib");
190  $a_xml_writer->xmlEndTag("response_str");
191  break;
192  case CLOZE_NUMERIC:
193  // numeric fields
194  $attrs = array(
195  "ident" => "gap_$i",
196  "numtype" => "Decimal",
197  "rcardinality" => "Single"
198  );
199  $a_xml_writer->xmlStartTag("response_num", $attrs);
200  $solution = $this->object->getSuggestedSolution($i);
201  if (count($solution)) {
202  if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $solution["internal_link"], $matches)) {
203  $attrs = array(
204  "label" => "suggested_solution"
205  );
206  $a_xml_writer->xmlStartTag("material", $attrs);
207  $intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
208  if (strcmp($matches[1], "") != 0) {
209  $intlink = $solution["internal_link"];
210  }
211  $a_xml_writer->xmlElement("mattext", null, $intlink);
212  $a_xml_writer->xmlEndTag("material");
213  }
214  }
215  $answeritem = $gap->getItem(0);
216  $attrs = array(
217  "fibtype" => "Decimal",
218  "prompt" => "Box",
219  "columns" => $gap->getMaxWidth(),
220  "maxchars" => $gap->getGapSize()
221  );
222  if (is_object($answeritem)) {
223  if ($eval->e($answeritem->getLowerBound()) !== false) {
224  $attrs["minnumber"] = $answeritem->getLowerBound();
225  }
226  if ($eval->e($answeritem->getUpperBound()) !== false) {
227  $attrs["maxnumber"] = $answeritem->getUpperBound();
228  }
229  }
230  $a_xml_writer->xmlStartTag("render_fib", $attrs);
231  $a_xml_writer->xmlEndTag("render_fib");
232  $a_xml_writer->xmlEndTag("response_num");
233  break;
234  }
235  }
236  }
237  $a_xml_writer->xmlEndTag("flow");
238  $a_xml_writer->xmlEndTag("presentation");
239 
240  // PART II: qti resprocessing
241  $a_xml_writer->xmlStartTag("resprocessing");
242  $a_xml_writer->xmlStartTag("outcomes");
243  $a_xml_writer->xmlStartTag("decvar");
244  $a_xml_writer->xmlEndTag("decvar");
245  $a_xml_writer->xmlEndTag("outcomes");
246 
247  // add response conditions
248  for ($i = 0; $i < $this->object->getGapCount(); $i++) {
249  $gap = $this->object->getGap($i);
250  switch ($gap->getType()) {
251  case CLOZE_SELECT:
252  foreach ($gap->getItems(new ilArrayElementOrderKeeper()) as $answer) {
253  $attrs = array(
254  "continue" => "Yes"
255  );
256  $a_xml_writer->xmlStartTag("respcondition", $attrs);
257  // qti conditionvar
258  $a_xml_writer->xmlStartTag("conditionvar");
259 
260  $attrs = array(
261  "respident" => "gap_$i"
262  );
263  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
264  $a_xml_writer->xmlEndTag("conditionvar");
265  // qti setvar
266  $attrs = array(
267  "action" => "Add"
268  );
269  $a_xml_writer->xmlElement("setvar", $attrs, $answer->getPoints());
270  // qti displayfeedback
271  $linkrefid = "";
272  $linkrefid = "$i" . "_Response_" . $answer->getOrder();
273  $attrs = array(
274  "feedbacktype" => "Response",
275  "linkrefid" => $linkrefid
276  );
277  $a_xml_writer->xmlElement("displayfeedback", $attrs);
278  $a_xml_writer->xmlEndTag("respcondition");
279  }
280  break;
281  case CLOZE_TEXT:
282  foreach ($gap->getItems(new ilArrayElementOrderKeeper()) as $answer) {
283  $attrs = array(
284  "continue" => "Yes"
285  );
286  $a_xml_writer->xmlStartTag("respcondition", $attrs);
287  // qti conditionvar
288  $a_xml_writer->xmlStartTag("conditionvar");
289  $attrs = array(
290  "respident" => "gap_$i"
291  );
292  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
293  $a_xml_writer->xmlEndTag("conditionvar");
294  // qti setvar
295  $attrs = array(
296  "action" => "Add"
297  );
298  $a_xml_writer->xmlElement("setvar", $attrs, $answer->getPoints());
299  // qti displayfeedback
300  $linkrefid = "$i" . "_Response_" . $answer->getOrder();
301  $attrs = array(
302  "feedbacktype" => "Response",
303  "linkrefid" => $linkrefid
304  );
305  $a_xml_writer->xmlElement("displayfeedback", $attrs);
306  $a_xml_writer->xmlEndTag("respcondition");
307  }
308  break;
309  case CLOZE_NUMERIC:
310  foreach ($gap->getItems(new ilArrayElementOrderKeeper()) as $answer) {
311  $attrs = array(
312  "continue" => "Yes"
313  );
314  $a_xml_writer->xmlStartTag("respcondition", $attrs);
315  // qti conditionvar
316  $a_xml_writer->xmlStartTag("conditionvar");
317  $attrs = array(
318  "respident" => "gap_$i"
319  );
320  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
321  $a_xml_writer->xmlEndTag("conditionvar");
322  // qti setvar
323  $attrs = array(
324  "action" => "Add"
325  );
326  $a_xml_writer->xmlElement("setvar", $attrs, $answer->getPoints());
327  // qti displayfeedback
328  $linkrefid = "$i" . "_Response_" . $answer->getOrder();
329  $attrs = array(
330  "feedbacktype" => "Response",
331  "linkrefid" => $linkrefid
332  );
333  $a_xml_writer->xmlElement("displayfeedback", $attrs);
334  $a_xml_writer->xmlEndTag("respcondition");
335  }
336  break;
337  }
338  }
339 
340  $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
341  $this->object->getId(),
342  true
343  );
344  if (strlen($feedback_allcorrect)) {
345  $attrs = array(
346  "continue" => "Yes"
347  );
348  $a_xml_writer->xmlStartTag("respcondition", $attrs);
349  // qti conditionvar
350  $a_xml_writer->xmlStartTag("conditionvar");
351 
352  for ($i = 0; $i < $this->object->getGapCount(); $i++) {
353  $gap = $this->object->getGap($i);
354  $indexes = $gap->getBestSolutionIndexes();
355  if ($i > 0) {
356  $a_xml_writer->xmlStartTag("and");
357  }
358  switch ($gap->getType()) {
359  case CLOZE_SELECT:
360  $k = 0;
361  foreach ($indexes as $key) {
362  if ($k > 0) {
363  $a_xml_writer->xmlStartTag("or");
364  }
365  $attrs = array(
366  "respident" => "gap_$i"
367  );
368  $answer = $gap->getItem($key);
369  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
370  if ($k > 0) {
371  $a_xml_writer->xmlEndTag("or");
372  }
373  $k++;
374  }
375  break;
376  case CLOZE_TEXT:
377  $k = 0;
378  foreach ($indexes as $key) {
379  if ($k > 0) {
380  $a_xml_writer->xmlStartTag("or");
381  }
382  $attrs = array(
383  "respident" => "gap_$i"
384  );
385  $answer = $gap->getItem($key);
386  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
387  if ($k > 0) {
388  $a_xml_writer->xmlEndTag("or");
389  }
390  $k++;
391  }
392  break;
393  case CLOZE_NUMERIC:
394  $k = 0;
395  foreach ($indexes as $key) {
396  if ($k > 0) {
397  $a_xml_writer->xmlStartTag("or");
398  }
399  $attrs = array(
400  "respident" => "gap_$i"
401  );
402  $answer = $gap->getItem($key);
403  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
404  if ($k > 0) {
405  $a_xml_writer->xmlEndTag("or");
406  }
407  $k++;
408  }
409  break;
410  }
411  if ($i > 0) {
412  $a_xml_writer->xmlEndTag("and");
413  }
414  }
415  $a_xml_writer->xmlEndTag("conditionvar");
416  // qti displayfeedback
417  $attrs = array(
418  "feedbacktype" => "Response",
419  "linkrefid" => "response_allcorrect"
420  );
421  $a_xml_writer->xmlElement("displayfeedback", $attrs);
422  $a_xml_writer->xmlEndTag("respcondition");
423  }
424  $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
425  $this->object->getId(),
426  false
427  );
428  if (strlen($feedback_onenotcorrect)) {
429  $attrs = array(
430  "continue" => "Yes"
431  );
432  $a_xml_writer->xmlStartTag("respcondition", $attrs);
433  // qti conditionvar
434  $a_xml_writer->xmlStartTag("conditionvar");
435 
436  $a_xml_writer->xmlStartTag("not");
437  for ($i = 0; $i < $this->object->getGapCount(); $i++) {
438  $gap = $this->object->getGap($i);
439  $indexes = $gap->getBestSolutionIndexes();
440  if ($i > 0) {
441  $a_xml_writer->xmlStartTag("and");
442  }
443  switch ($gap->getType()) {
444  case CLOZE_SELECT:
445  $k = 0;
446  foreach ($indexes as $key) {
447  if ($k > 0) {
448  $a_xml_writer->xmlStartTag("or");
449  }
450  $attrs = array(
451  "respident" => "gap_$i"
452  );
453  $answer = $gap->getItem($key);
454  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
455  if ($k > 0) {
456  $a_xml_writer->xmlEndTag("or");
457  }
458  $k++;
459  }
460  break;
461  case CLOZE_TEXT:
462  $k = 0;
463  foreach ($indexes as $key) {
464  if ($k > 0) {
465  $a_xml_writer->xmlStartTag("or");
466  }
467  $attrs = array(
468  "respident" => "gap_$i"
469  );
470  $answer = $gap->getItem($key);
471  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
472  if ($k > 0) {
473  $a_xml_writer->xmlEndTag("or");
474  }
475  $k++;
476  }
477  break;
478  case CLOZE_NUMERIC:
479  $k = 0;
480  foreach ($indexes as $key) {
481  if ($k > 0) {
482  $a_xml_writer->xmlStartTag("or");
483  }
484  $attrs = array(
485  "respident" => "gap_$i"
486  );
487  $answer = $gap->getItem($key);
488  $a_xml_writer->xmlElement("varequal", $attrs, $answer->getAnswertext());
489  if ($k > 0) {
490  $a_xml_writer->xmlEndTag("or");
491  }
492  $k++;
493  }
494  break;
495  }
496  if ($i > 0) {
497  $a_xml_writer->xmlEndTag("and");
498  }
499  }
500  $a_xml_writer->xmlEndTag("not");
501  $a_xml_writer->xmlEndTag("conditionvar");
502  // qti displayfeedback
503  $attrs = array(
504  "feedbacktype" => "Response",
505  "linkrefid" => "response_onenotcorrect"
506  );
507  $a_xml_writer->xmlElement("displayfeedback", $attrs);
508  $a_xml_writer->xmlEndTag("respcondition");
509  }
510 
511  $a_xml_writer->xmlEndTag("resprocessing");
512 
513  // PART III: qti itemfeedback
514  for ($i = 0; $i < $this->object->getGapCount(); $i++) {
515  $gap = $this->object->getGap($i);
516  switch ($gap->getType()) {
517  case CLOZE_SELECT:
518  break;
519  case CLOZE_TEXT:
520  break;
521  case CLOZE_NUMERIC:
522  break;
523  }
524  /*foreach ($gap->getItems() as $answer)
525  {
526  $linkrefid = "$i" . "_Response_" . $answer->getOrder();
527  $attrs = array(
528  "ident" => $linkrefid,
529  "view" => "All"
530  );
531  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
532  // qti flow_mat
533  $a_xml_writer->xmlStartTag("flow_mat");
534 // $a_xml_writer->xmlStartTag("material");
535 // $a_xml_writer->xmlElement("mattext");
536 // $a_xml_writer->xmlEndTag("material");
537  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
538  $this->object->getId(), $index
539  );
540  $this->object->addQTIMaterial($a_xml_writer, $fb);
541  $a_xml_writer->xmlEndTag("flow_mat");
542  $a_xml_writer->xmlEndTag("itemfeedback");
543  }*/
544  /*
545  $attrs = array(
546  "ident" => $i,
547  "view" => "All"
548  );
549  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
550  // qti flow_mat
551  $a_xml_writer->xmlStartTag("flow_mat");
552  // $a_xml_writer->xmlStartTag("material");
553  // $a_xml_writer->xmlElement("mattext");
554  // $a_xml_writer->xmlEndTag("material");
555  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
556  $this->object->getId(), $i, 0
557  );
558  $this->object->addQTIMaterial($a_xml_writer, $fb);
559  $a_xml_writer->xmlEndTag("flow_mat");
560  $a_xml_writer->xmlEndTag("itemfeedback");
561  */
562  }
563  $this->exportAnswerSpecificFeedbacks($a_xml_writer);
564 
565  if (strlen($feedback_allcorrect)) {
566  $attrs = array(
567  "ident" => "response_allcorrect",
568  "view" => "All"
569  );
570  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
571  // qti flow_mat
572  $a_xml_writer->xmlStartTag("flow_mat");
573  $this->object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
574  $a_xml_writer->xmlEndTag("flow_mat");
575  $a_xml_writer->xmlEndTag("itemfeedback");
576  }
577  if (strlen($feedback_onenotcorrect)) {
578  $attrs = array(
579  "ident" => "response_onenotcorrect",
580  "view" => "All"
581  );
582  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
583  // qti flow_mat
584  $a_xml_writer->xmlStartTag("flow_mat");
585  $this->object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
586  $a_xml_writer->xmlEndTag("flow_mat");
587  $a_xml_writer->xmlEndTag("itemfeedback");
588  }
589 
590  $a_xml_writer->xmlEndTag("item");
591  $a_xml_writer->xmlEndTag("questestinterop");
592 
593  $xml = $a_xml_writer->xmlDumpMem(false);
594  if (!$a_include_header) {
595  $pos = strpos($xml, "?>");
596  $xml = substr($xml, $pos + 2);
597  }
598  return $xml;
599  }
global $DIC
Definition: saml.php:7
const CLOZE_TEXT
Cloze question constants.
XML writer class.
addGeneralMetadata(ilXmlWriter $xmlwriter)
exportAnswerSpecificFeedbacks(ilXmlWriter $xmlWriter)
const CLOZE_SELECT
xmlHeader()
Writes xml header public.
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
$i
Definition: disco.tpl.php:19
const CLOZE_NUMERIC
$key
Definition: croninfo.php:18
const CLOZE_TEST_IDENTIFIER
Question identifier constants.
+ Here is the call graph for this function:

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