ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.assOrderingHorizontalExport.php
Go to the documentation of this file.
1<?php
2
29{
35 public function toXML($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false, $force_image_references = false): string
36 {
37 global $DIC;
38 $ilias = $DIC['ilias'];
39
40 $a_xml_writer = new ilXmlWriter();
41 // set xml header
42 $a_xml_writer->xmlHeader();
43 $a_xml_writer->xmlStartTag("questestinterop");
44 $attrs = [
45 "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
46 "title" => $this->object->getTitle(),
47 "maxattempts" => $this->object->getNrOfTries()
48 ];
49 $a_xml_writer->xmlStartTag("item", $attrs);
50 // add question description
51 $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
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, $this->object->getQuestionType());
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
69 $this->addGeneralMetadata($a_xml_writer);
70
71 $a_xml_writer->xmlStartTag("qtimetadatafield");
72 $a_xml_writer->xmlElement("fieldlabel", null, "points");
73 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
74 $a_xml_writer->xmlEndTag("qtimetadatafield");
75 $a_xml_writer->xmlStartTag("qtimetadatafield");
76 $a_xml_writer->xmlElement("fieldlabel", null, "ordertext");
77 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getOrderText());
78 $a_xml_writer->xmlEndTag("qtimetadatafield");
79 $a_xml_writer->xmlStartTag("qtimetadatafield");
80 $a_xml_writer->xmlElement("fieldlabel", null, "textsize");
81 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getTextSize());
82 $a_xml_writer->xmlEndTag("qtimetadatafield");
83 $a_xml_writer->xmlStartTag("qtimetadatafield");
84 $a_xml_writer->xmlElement("fieldlabel", null, "separator");
85 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getSeparator());
86 $a_xml_writer->xmlEndTag("qtimetadatafield");
87 $a_xml_writer->xmlEndTag("qtimetadata");
88 $a_xml_writer->xmlEndTag("itemmetadata");
89
90 // PART I: qti presentation
91 $attrs = [
92 "label" => $this->object->getTitle()
93 ];
94 $a_xml_writer->xmlStartTag("presentation", $attrs);
95 // add flow to presentation
96 $a_xml_writer->xmlStartTag("flow");
97 // add material with question text to presentation
98 $this->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
99 // add answers to presentation
100 $a_xml_writer->xmlEndTag("flow");
101 $a_xml_writer = $this->addSuggestedSolution($a_xml_writer);
102 $a_xml_writer->xmlEndTag("presentation");
103
104 $this->addGenericFeedback($a_xml_writer);
105
106 $a_xml_writer->xmlEndTag("item");
107 $a_xml_writer->xmlEndTag("questestinterop");
108
109 $xml = $a_xml_writer->xmlDumpMem(false);
110 if (!$a_include_header) {
111 $pos = strpos($xml, "?>");
112 $xml = substr($xml, $pos + 2);
113 }
114 return $xml;
115 }
116}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 and sets the internal domxml variable with the DOM X...
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
addQTIMaterial(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
addSuggestedSolution(ilXmlWriter $writer)
addGenericFeedback(ilXmlWriter $a_xml_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