ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 

Additional Inherited Members

- Data Fields inherited from assQuestionExport
 $object
 
const ITEM_SOLUTIONHINT = 'solutionhint'
 
- 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)
 
 addSolutionHints (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 29 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 36 of file class.assFormulaQuestionExport.php.

References $DIC, $res, $xml, assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addGeneralMetadata(), assQuestionExport\addGenericFeedback(), assQuestionExport\addSolutionHints(), IL_INST_ID, and ILIAS\Repository\object().

36  : 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  );
50  $a_xml_writer->xmlStartTag("item", $attrs);
51  // add question description
52  $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
53  $a_xml_writer->xmlStartTag("itemmetadata");
54  $a_xml_writer->xmlStartTag("qtimetadata");
55  $a_xml_writer->xmlStartTag("qtimetadatafield");
56  $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
57  $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
58  $a_xml_writer->xmlEndTag("qtimetadatafield");
59  $a_xml_writer->xmlStartTag("qtimetadatafield");
60  $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
61  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getQuestionType());
62  $a_xml_writer->xmlEndTag("qtimetadatafield");
63  $a_xml_writer->xmlStartTag("qtimetadatafield");
64  $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
65  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
66  $a_xml_writer->xmlEndTag("qtimetadatafield");
67  $a_xml_writer->xmlStartTag("qtimetadatafield");
68  $a_xml_writer->xmlElement("fieldlabel", null, "points");
69  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
70  $a_xml_writer->xmlEndTag("qtimetadatafield");
71  foreach ($this->object->getVariables() as $variable) {
72  $var = array(
73  "precision" => $variable->getPrecision(),
74  "intprecision" => $variable->getIntprecision(),
75  "rangemin" => $variable->getRangeMin(),
76  "rangemax" => $variable->getRangeMax(),
77  "unit" => (is_object($variable->getUnit())) ? $variable->getUnit()->getUnit() : "",
78  "unitvalue" => (is_object($variable->getUnit())) ? $variable->getUnit()->getId() : ""
79  );
80  $a_xml_writer->xmlStartTag("qtimetadatafield");
81  $a_xml_writer->xmlElement("fieldlabel", null, $variable->getVariable());
82  $a_xml_writer->xmlElement("fieldentry", null, serialize($var));
83  $a_xml_writer->xmlEndTag("qtimetadatafield");
84  }
85  foreach ($this->object->getResults() as $result) {
86  $resultunits = $this->object->getResultUnits($result);
87  $ru = array();
88  foreach ($resultunits as $unit) {
89  array_push($ru, array("unit" => $unit->getUnit(), "unitvalue" => $unit->getId()));
90  }
91  $res = array(
92  "precision" => $result->getPrecision(),
93  "tolerance" => $result->getTolerance(),
94  "rangemin" => $result->getRangeMin(),
95  "rangemax" => $result->getRangeMax(),
96  "points" => $result->getPoints(),
97  "formula" => $result->getFormula(),
98  "rating" => ($result->getRatingSimple()) ? "" : array("sign" => $result->getRatingSign(), "value" => $result->getRatingValue(), "unit" => $result->getRatingUnit()),
99  "unit" => (is_object($result->getUnit())) ? $result->getUnit()->getUnit() : "",
100  "unitvalue" => (is_object($result->getUnit())) ? $result->getUnit()->getId() : "",
101  "resultunits" => $ru,
102  "resulttype" => $result->getResultType()
103  );
104  $a_xml_writer->xmlStartTag("qtimetadatafield");
105  $a_xml_writer->xmlElement("fieldlabel", null, $result->getResult());
106  $a_xml_writer->xmlElement("fieldentry", null, serialize($res));
107  $a_xml_writer->xmlEndTag("qtimetadatafield");
108  }
109 
110  // additional content editing information
111  $this->addAdditionalContentEditingModeInformation($a_xml_writer);
112  $this->addGeneralMetadata($a_xml_writer);
113 
114  $a_xml_writer->xmlEndTag("qtimetadata");
115  $a_xml_writer->xmlEndTag("itemmetadata");
116 
117  // PART I: qti presentation
118  $attrs = array(
119  "label" => $this->object->getTitle()
120  );
121  $a_xml_writer->xmlStartTag("presentation", $attrs);
122  // add flow to presentation
123  $a_xml_writer->xmlStartTag("flow");
124  // add material with question text to presentation
125  $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
126  // add answers to presentation
127  $a_xml_writer->xmlEndTag("flow");
128  $a_xml_writer->xmlEndTag("presentation");
129 
130  $this->addGenericFeedback($a_xml_writer);
131 
132  $a_xml_writer = $this->addSolutionHints($a_xml_writer);
133 
134  $a_xml_writer->xmlEndTag("item");
135  $a_xml_writer->xmlEndTag("questestinterop");
136 
137  $xml = $a_xml_writer->xmlDumpMem(false);
138  if (!$a_include_header) {
139  $pos = strpos($xml, "?>");
140  $xml = substr($xml, $pos + 2);
141  }
142  return $xml;
143  }
$res
Definition: ltiservices.php:69
const IL_INST_ID
Definition: constants.php:40
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addGeneralMetadata(ilXmlWriter $xmlwriter)
global $DIC
Definition: feed.php:28
$xml
Definition: metadata.php:351
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
addSolutionHints(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: