ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
assFormulaQuestionExport Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assFormulaQuestionExport:
+ Collaboration diagram for assFormulaQuestionExport:

Public Member Functions

 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 sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 
- Public Member Functions inherited from assQuestionExport
 __construct ($a_object)
 assQuestionExport constructor More...
 
 exportFeedbackOnly ($a_xml_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 sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 
 addQTIMaterial (ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
 

Additional Inherited Members

- Data Fields inherited from assQuestionExport
 $object
 
- Protected Member Functions inherited from assQuestionExport
 addAnswerSpecificFeedback (ilXmlWriter $a_xml_writer, $answers)
 
 addGenericFeedback (ilXmlWriter $a_xml_writer)
 
 addQtiMetaDataField (ilXmlWriter $a_xml_writer, $fieldLabel, $fieldValue)
 adds a qti meta data field with given name and value to the passed xml writer (xml writer must be in context of opened "qtimetadata" tag) More...
 
 addAdditionalContentEditingModeInformation (ilXmlWriter $a_xml_writer)
 adds a qti meta data field for ilias specific information of "additional content editing mode" (xml writer must be in context of opened "qtimetadata" tag) More...
 
 addGeneralMetadata (ilXmlWriter $xmlwriter)
 
 addSuggestedSolution (ilXmlWriter $writer)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class for formula question question exports

assSingleChoiceExport is a class for single choice question exports

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
Id
class.assFormulaQuestionExport.php 1185 2010-02-02 08:36:26Z hschottm

\

Definition at line 28 of file class.assFormulaQuestionExport.php.

Member Function Documentation

◆ toXML()

assFormulaQuestionExport::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 sets the internal domxml variable with the DOM XML representation of the QTI xml representation.

Definition at line 35 of file class.assFormulaQuestionExport.php.

References $DIC, $res, assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addGeneralMetadata(), assQuestionExport\addGenericFeedback(), assQuestionExport\addQTIMaterial(), assQuestionExport\addSuggestedSolution(), IL_INST_ID, null, and ILIAS\Repository\object().

35  : 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  ];
48  $a_xml_writer->xmlStartTag("item", $attrs);
49  // add question description
50  $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
51  $a_xml_writer->xmlStartTag("itemmetadata");
52  $a_xml_writer->xmlStartTag("qtimetadata");
53  $a_xml_writer->xmlStartTag("qtimetadatafield");
54  $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
55  $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
56  $a_xml_writer->xmlEndTag("qtimetadatafield");
57  $a_xml_writer->xmlStartTag("qtimetadatafield");
58  $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
59  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getQuestionType());
60  $a_xml_writer->xmlEndTag("qtimetadatafield");
61  $a_xml_writer->xmlStartTag("qtimetadatafield");
62  $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
63  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
64  $a_xml_writer->xmlEndTag("qtimetadatafield");
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  foreach ($this->object->getVariables() as $variable) {
70  $var = [
71  "precision" => $variable->getPrecision(),
72  "intprecision" => $variable->getIntprecision(),
73  "rangemin" => $variable->getRangeMin(),
74  "rangemax" => $variable->getRangeMax(),
75  "unit" => (is_object($variable->getUnit())) ? $variable->getUnit()->getUnit() : "",
76  "unitvalue" => (is_object($variable->getUnit())) ? $variable->getUnit()->getId() : ""
77  ];
78  $a_xml_writer->xmlStartTag("qtimetadatafield");
79  $a_xml_writer->xmlElement("fieldlabel", null, $variable->getVariable());
80  $a_xml_writer->xmlElement("fieldentry", null, serialize($var));
81  $a_xml_writer->xmlEndTag("qtimetadatafield");
82  }
83  foreach ($this->object->getResults() as $result) {
84  $resultunits = $this->object->getResultUnits($result);
85  $ru = [];
86  foreach ($resultunits as $unit) {
87  array_push($ru, ["unit" => $unit->getUnit(), "unitvalue" => $unit->getId()]);
88  }
89  $res = [
90  "precision" => $result->getPrecision(),
91  "tolerance" => $result->getTolerance(),
92  "rangemin" => $result->getRangeMin(),
93  "rangemax" => $result->getRangeMax(),
94  "points" => $result->getPoints(),
95  "formula" => $result->getFormula(),
96  "rating" => ($result->getRatingSimple()) ? "" : ["sign" => $result->getRatingSign(), "value" => $result->getRatingValue(), "unit" => $result->getRatingUnit()],
97  "unit" => (is_object($result->getUnit())) ? $result->getUnit()->getUnit() : "",
98  "unitvalue" => (is_object($result->getUnit())) ? $result->getUnit()->getId() : "",
99  "resultunits" => $ru,
100  "resulttype" => $result->getResultType()
101  ];
102  $a_xml_writer->xmlStartTag("qtimetadatafield");
103  $a_xml_writer->xmlElement("fieldlabel", null, $result->getResult());
104  $a_xml_writer->xmlElement("fieldentry", null, serialize($res));
105  $a_xml_writer->xmlEndTag("qtimetadatafield");
106  }
107 
108  // additional content editing information
109  $this->addAdditionalContentEditingModeInformation($a_xml_writer);
110  $this->addGeneralMetadata($a_xml_writer);
111 
112  $a_xml_writer->xmlEndTag("qtimetadata");
113  $a_xml_writer->xmlEndTag("itemmetadata");
114 
115  // PART I: qti presentation
116  $attrs = [
117  "label" => $this->object->getTitle()
118  ];
119  $a_xml_writer->xmlStartTag("presentation", $attrs);
120  // add flow to presentation
121  $a_xml_writer->xmlStartTag("flow");
122  // add material with question text to presentation
123  $this->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
124  // add answers to presentation
125  $a_xml_writer->xmlEndTag("flow");
126  $a_xml_writer = $this->addSuggestedSolution($a_xml_writer);
127  $a_xml_writer->xmlEndTag("presentation");
128 
129  $this->addGenericFeedback($a_xml_writer);
130 
131  $a_xml_writer->xmlEndTag("item");
132  $a_xml_writer->xmlEndTag("questestinterop");
133 
134  $xml = $a_xml_writer->xmlDumpMem(false);
135  if (!$a_include_header) {
136  $pos = strpos($xml, "?>");
137  $xml = substr($xml, $pos + 2);
138  }
139  return $xml;
140  }
$res
Definition: ltiservices.php:66
const IL_INST_ID
Definition: constants.php:40
addQTIMaterial(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
addGeneralMetadata(ilXmlWriter $xmlwriter)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:26
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)
addGenericFeedback(ilXmlWriter $a_xml_writer)
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: