ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.assFileUploadExport.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
5 
14 {
24  public function toXML($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false, $force_image_references = false)
25  {
26  global $ilias;
27 
28  include_once("./Services/Xml/classes/class.ilXmlWriter.php");
29  $a_xml_writer = new ilXmlWriter;
30  // set xml header
31  $a_xml_writer->xmlHeader();
32  $a_xml_writer->xmlStartTag("questestinterop");
33  $attrs = array(
34  "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
35  "title" => $this->object->getTitle(),
36  "maxattempts" => $this->object->getNrOfTries()
37  );
38  $a_xml_writer->xmlStartTag("item", $attrs);
39  // add question description
40  $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
41  // add estimated working time
42  $workingtime = $this->object->getEstimatedWorkingTime();
43  $duration = sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]);
44  $a_xml_writer->xmlElement("duration", null, $duration);
45  // add ILIAS specific metadata
46  $a_xml_writer->xmlStartTag("itemmetadata");
47  $a_xml_writer->xmlStartTag("qtimetadata");
48  $a_xml_writer->xmlStartTag("qtimetadatafield");
49  $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
50  $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
51  $a_xml_writer->xmlEndTag("qtimetadatafield");
52  $a_xml_writer->xmlStartTag("qtimetadatafield");
53  $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
54  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getQuestionType());
55  $a_xml_writer->xmlEndTag("qtimetadatafield");
56  $a_xml_writer->xmlStartTag("qtimetadatafield");
57  $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
58  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
59  $a_xml_writer->xmlEndTag("qtimetadatafield");
60 
61  // additional content editing information
62  $this->addAdditionalContentEditingModeInformation($a_xml_writer);
63  $this->addGeneralMetadata($a_xml_writer);
64 
65  $a_xml_writer->xmlStartTag("qtimetadatafield");
66  $a_xml_writer->xmlElement("fieldlabel", null, "points");
67  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
68  $a_xml_writer->xmlEndTag("qtimetadatafield");
69  $a_xml_writer->xmlStartTag("qtimetadatafield");
70  $a_xml_writer->xmlElement("fieldlabel", null, "maxsize");
71  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getMaxSize());
72  $a_xml_writer->xmlEndTag("qtimetadatafield");
73  $a_xml_writer->xmlStartTag("qtimetadatafield");
74  $a_xml_writer->xmlElement("fieldlabel", null, "allowedextensions");
75  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAllowedExtensions());
76  $a_xml_writer->xmlEndTag("qtimetadatafield");
77  $a_xml_writer->xmlEndTag("qtimetadata");
78  $a_xml_writer->xmlEndTag("itemmetadata");
79 
80  // PART I: qti presentation
81  $attrs = array(
82  "label" => $this->object->getTitle()
83  );
84  $a_xml_writer->xmlStartTag("presentation", $attrs);
85  // add flow to presentation
86  $a_xml_writer->xmlStartTag("flow");
87  // add material with question text to presentation
88  $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
89  // add answers to presentation
90  $a_xml_writer->xmlEndTag("flow");
91  $a_xml_writer->xmlEndTag("presentation");
92 
93  $this->exportFeedbackOnly($a_xml_writer);
94 
95  $a_xml_writer->xmlEndTag("item");
96  $a_xml_writer->xmlEndTag("questestinterop");
97 
98  $xml = $a_xml_writer->xmlDumpMem(false);
99  if (!$a_include_header) {
100  $pos = strpos($xml, "?>");
101  $xml = substr($xml, $pos + 2);
102  }
103  return $xml;
104  }
105 }
Class for file upload question exports.
exportFeedbackOnly($a_xml_writer)
XML writer class.
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
$xml
Definition: metadata.php:240
xmlHeader()
Writes xml header public.
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
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.