4 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
26 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
30 include_once
'Services/Xml/classes/class.ilXmlWriter.php';
34 $a_xml_writer->xmlStartTag(
"questestinterop");
36 "ident" =>
"il_" . IL_INST_ID .
"_qst_" . $this->
object->getId(),
37 "title" => $this->
object->getTitle()
39 $a_xml_writer->xmlStartTag(
"item", $attrs);
41 $a_xml_writer->xmlElement(
"qticomment", null, $this->
object->getComment());
43 $workingtime = $this->
object->getEstimatedWorkingTime();
44 $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
45 $a_xml_writer->xmlElement(
"duration", null, $duration);
47 $a_xml_writer->xmlStartTag(
"itemmetadata");
48 $a_xml_writer->xmlStartTag(
"qtimetadata");
49 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
50 $a_xml_writer->xmlElement(
"fieldlabel", null,
"ILIAS_VERSION");
51 $a_xml_writer->xmlElement(
"fieldentry", null, $ilias->getSetting(
"ilias_version"));
52 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
53 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
54 $a_xml_writer->xmlElement(
"fieldlabel", null,
"QUESTIONTYPE");
55 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
object->getQuestionType());
56 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
57 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
58 $a_xml_writer->xmlElement(
"fieldlabel", null,
"AUTHOR");
59 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
object->getAuthor());
60 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
61 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
62 $a_xml_writer->xmlElement(
"fieldlabel", null,
"points");
63 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
object->getPoints());
64 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
65 foreach ($this->
object->getVariables() as $variable) {
67 "precision" => $variable->getPrecision(),
68 "intprecision" => $variable->getIntprecision(),
69 "rangemin" => $variable->getRangeMin(),
70 "rangemax" => $variable->getRangeMax(),
71 "unit" => (is_object($variable->getUnit())) ? $variable->getUnit()->getUnit() :
"",
72 "unitvalue" => (is_object($variable->getUnit())) ? $variable->getUnit()->getId() :
"" 74 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
75 $a_xml_writer->xmlElement(
"fieldlabel", null, $variable->getVariable());
76 $a_xml_writer->xmlElement(
"fieldentry", null, serialize($var));
77 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
80 $resultunits = $this->
object->getResultUnits(
$result);
82 foreach ($resultunits as $unit) {
83 array_push($ru,
array(
"unit" => $unit->getUnit(),
"unitvalue" => $unit->getId()));
86 "precision" =>
$result->getPrecision(),
87 "tolerance" =>
$result->getTolerance(),
88 "rangemin" =>
$result->getRangeMin(),
89 "rangemax" =>
$result->getRangeMax(),
90 "points" =>
$result->getPoints(),
91 "formula" =>
$result->getFormula(),
92 "rating" => (
$result->getRatingSimple()) ?
"" :
array(
"sign" =>
$result->getRatingSign(),
"value" =>
$result->getRatingValue(),
"unit" =>
$result->getRatingUnit()),
93 "unit" => (is_object(
$result->getUnit())) ?
$result->getUnit()->getUnit() :
"",
94 "unitvalue" => (is_object(
$result->getUnit())) ?
$result->getUnit()->getId() :
"",
97 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
98 $a_xml_writer->xmlElement(
"fieldlabel", null,
$result->getResult());
99 $a_xml_writer->xmlElement(
"fieldentry", null, serialize(
$res));
100 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
107 $a_xml_writer->xmlEndTag(
"qtimetadata");
108 $a_xml_writer->xmlEndTag(
"itemmetadata");
112 "label" => $this->
object->getTitle()
114 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
116 $a_xml_writer->xmlStartTag(
"flow");
118 $this->
object->addQTIMaterial($a_xml_writer, $this->
object->getQuestion());
120 $a_xml_writer->xmlEndTag(
"flow");
121 $a_xml_writer->xmlEndTag(
"presentation");
125 $a_xml_writer->xmlEndTag(
"item");
126 $a_xml_writer->xmlEndTag(
"questestinterop");
128 $xml = $a_xml_writer->xmlDumpMem(
false);
129 if (!$a_include_header) {
130 $pos = strpos(
$xml,
"?>");
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
foreach($_POST as $key=> $value) $res
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...
addGenericFeedback(ilXmlWriter $a_xml_writer)
Create new PHPExcel object
obj_idprivate