ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.assFileUploadExport.php
Go to the documentation of this file.
1 <?php
26 {
32  public function toXML($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false, $force_image_references = false): string
33  {
34  global $DIC;
35  $ilias = $DIC['ilias'];
36 
37  $a_xml_writer = new ilXmlWriter();
38  // set xml header
39  $a_xml_writer->xmlHeader();
40  $a_xml_writer->xmlStartTag("questestinterop");
41  $attrs = [
42  "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
43  "title" => $this->object->getTitle(),
44  "maxattempts" => $this->object->getNrOfTries()
45  ];
46  $a_xml_writer->xmlStartTag("item", $attrs);
47  // add question description
48  $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
49  $a_xml_writer->xmlStartTag("itemmetadata");
50  $a_xml_writer->xmlStartTag("qtimetadata");
51  $a_xml_writer->xmlStartTag("qtimetadatafield");
52  $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
53  $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
54  $a_xml_writer->xmlEndTag("qtimetadatafield");
55  $a_xml_writer->xmlStartTag("qtimetadatafield");
56  $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
57  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getQuestionType());
58  $a_xml_writer->xmlEndTag("qtimetadatafield");
59  $a_xml_writer->xmlStartTag("qtimetadatafield");
60  $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
61  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
62  $a_xml_writer->xmlEndTag("qtimetadatafield");
63 
64  // additional content editing information
65  $this->addAdditionalContentEditingModeInformation($a_xml_writer);
66  $this->addGeneralMetadata($a_xml_writer);
67 
68  $a_xml_writer->xmlStartTag("qtimetadatafield");
69  $a_xml_writer->xmlElement("fieldlabel", null, "points");
70  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
71  $a_xml_writer->xmlEndTag("qtimetadatafield");
72  $a_xml_writer->xmlStartTag("qtimetadatafield");
73  $a_xml_writer->xmlElement("fieldlabel", null, "maxsize");
74  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getMaxSize());
75  $a_xml_writer->xmlEndTag("qtimetadatafield");
76  $a_xml_writer->xmlStartTag("qtimetadatafield");
77  $a_xml_writer->xmlElement("fieldlabel", null, "allowedextensions");
78  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAllowedExtensions());
79  $a_xml_writer->xmlEndTag("qtimetadatafield");
80  $a_xml_writer->xmlEndTag("qtimetadata");
81  $a_xml_writer->xmlEndTag("itemmetadata");
82 
83  // PART I: qti presentation
84  $attrs = [
85  "label" => $this->object->getTitle()
86  ];
87  $a_xml_writer->xmlStartTag("presentation", $attrs);
88  // add flow to presentation
89  $a_xml_writer->xmlStartTag("flow");
90  // add material with question text to presentation
91  $this->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
92  // add answers to presentation
93  $a_xml_writer->xmlEndTag("flow");
94  $a_xml_writer = $this->addSuggestedSolution($a_xml_writer);
95  $a_xml_writer->xmlEndTag("presentation");
96 
97  $this->exportFeedbackOnly($a_xml_writer);
98 
99  $a_xml_writer = $this->addSolutionHints($a_xml_writer);
100 
101  $a_xml_writer->xmlEndTag("item");
102  $a_xml_writer->xmlEndTag("questestinterop");
103 
104  $xml = $a_xml_writer->xmlDumpMem(false);
105  if (!$a_include_header) {
106  $pos = strpos($xml, "?>");
107  $xml = substr($xml, $pos + 2);
108  }
109  return $xml;
110  }
111 }
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
exportFeedbackOnly($a_xml_writer)
addQTIMaterial(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
global $DIC
Definition: feed.php:28
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
addSuggestedSolution(ilXmlWriter $writer)
addSolutionHints(ilXmlWriter $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...