ILIAS  release_8 Revision v8.24
class.assOrderingHorizontalExport.php
Go to the documentation of this file.
1<?php
18include_once "./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
19
30{
36 public function toXML($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false, $force_image_references = false): string
37 {
38 global $DIC;
39 $ilias = $DIC['ilias'];
40
41 include_once("./Services/Xml/classes/class.ilXmlWriter.php");
42 $a_xml_writer = new ilXmlWriter();
43 // set xml header
44 $a_xml_writer->xmlHeader();
45 $a_xml_writer->xmlStartTag("questestinterop");
46 $attrs = array(
47 "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
48 "title" => $this->object->getTitle(),
49 "maxattempts" => $this->object->getNrOfTries()
50 );
51 $a_xml_writer->xmlStartTag("item", $attrs);
52 // add question description
53 $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
54 $a_xml_writer->xmlStartTag("itemmetadata");
55 $a_xml_writer->xmlStartTag("qtimetadata");
56 $a_xml_writer->xmlStartTag("qtimetadatafield");
57 $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
58 $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
59 $a_xml_writer->xmlEndTag("qtimetadatafield");
60 $a_xml_writer->xmlStartTag("qtimetadatafield");
61 $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
62 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getQuestionType());
63 $a_xml_writer->xmlEndTag("qtimetadatafield");
64 $a_xml_writer->xmlStartTag("qtimetadatafield");
65 $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
66 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
67 $a_xml_writer->xmlEndTag("qtimetadatafield");
68
69 // additional content editing information
71 $this->addGeneralMetadata($a_xml_writer);
72
73 $a_xml_writer->xmlStartTag("qtimetadatafield");
74 $a_xml_writer->xmlElement("fieldlabel", null, "points");
75 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
76 $a_xml_writer->xmlEndTag("qtimetadatafield");
77 $a_xml_writer->xmlStartTag("qtimetadatafield");
78 $a_xml_writer->xmlElement("fieldlabel", null, "ordertext");
79 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getOrderText());
80 $a_xml_writer->xmlEndTag("qtimetadatafield");
81 $a_xml_writer->xmlStartTag("qtimetadatafield");
82 $a_xml_writer->xmlElement("fieldlabel", null, "textsize");
83 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getTextSize());
84 $a_xml_writer->xmlEndTag("qtimetadatafield");
85 $a_xml_writer->xmlStartTag("qtimetadatafield");
86 $a_xml_writer->xmlElement("fieldlabel", null, "separator");
87 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getSeparator());
88 $a_xml_writer->xmlEndTag("qtimetadatafield");
89 $a_xml_writer->xmlEndTag("qtimetadata");
90 $a_xml_writer->xmlEndTag("itemmetadata");
91
92 // PART I: qti presentation
93 $attrs = array(
94 "label" => $this->object->getTitle()
95 );
96 $a_xml_writer->xmlStartTag("presentation", $attrs);
97 // add flow to presentation
98 $a_xml_writer->xmlStartTag("flow");
99 // add material with question text to presentation
100 $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
101 // add answers to presentation
102 $a_xml_writer->xmlEndTag("flow");
103 $a_xml_writer->xmlEndTag("presentation");
104
105 $this->addGenericFeedback($a_xml_writer);
106
107 $a_xml_writer = $this->addSolutionHints($a_xml_writer);
108
109 $a_xml_writer->xmlEndTag("item");
110 $a_xml_writer->xmlEndTag("questestinterop");
111
112 $xml = $a_xml_writer->xmlDumpMem(false);
113 if (!$a_include_header) {
114 $pos = strpos($xml, "?>");
115 $xml = substr($xml, $pos + 2);
116 }
117 return $xml;
118 }
119}
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addGeneralMetadata(ilXmlWriter $xmlwriter)
addGenericFeedback(ilXmlWriter $a_xml_writer)
addSolutionHints(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: feed.php:28
$xml
Definition: metadata.php:351