ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assFormulaQuestionExport Class Reference

Class for formula question question exports. 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.
- Public Member Functions inherited from assQuestionExport
 assQuestionExport (&$a_object)
 assQuestionExport constructor
 exportFeedbackOnly ($a_xml_writer)

Additional Inherited Members

- Data Fields inherited from assQuestionExport
 $object
- Protected Member Functions inherited from assQuestionExport
 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)
 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)
 addGeneralMetadata (ilXmlWriter $xmlwriter)

Detailed Description

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 15 of file class.assFormulaQuestionExport.php.

Member Function Documentation

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

Returns
string The QTI xml representation of the question public

Reimplemented from assQuestionExport.

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

References $res, $result, assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addGeneralMetadata(), and ilXmlWriter\xmlHeader().

{
global $ilias;
include_once 'Services/Xml/classes/class.ilXmlWriter.php';
$a_xml_writer = new ilXmlWriter;
// set xml header
$a_xml_writer->xmlHeader();
$a_xml_writer->xmlStartTag("questestinterop");
$attrs = array(
"ident" => "il_".IL_INST_ID."_qst_".$this->object->getId(),
"title" => $this->object->getTitle()
);
$a_xml_writer->xmlStartTag("item", $attrs);
// add question description
$a_xml_writer->xmlElement("qticomment", NULL, $this->object->getComment());
// add estimated working time
$workingtime = $this->object->getEstimatedWorkingTime();
$duration = sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]);
$a_xml_writer->xmlElement("duration", NULL, $duration);
// add ILIAS specific metadata
$a_xml_writer->xmlStartTag("itemmetadata");
$a_xml_writer->xmlStartTag("qtimetadata");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
$a_xml_writer->xmlElement("fieldentry", NULL, $ilias->getSetting("ilias_version"));
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "QUESTIONTYPE");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getQuestionType());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "AUTHOR");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getAuthor());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "points");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getPoints());
$a_xml_writer->xmlEndTag("qtimetadatafield");
foreach ($this->object->getVariables() as $variable)
{
$var = array(
"precision" => $variable->getPrecision(),
"intprecision" => $variable->getIntprecision(),
"rangemin" => $variable->getRangeMin(),
"rangemax" => $variable->getRangeMax(),
"unit" => (is_object($variable->getUnit())) ? $variable->getUnit()->getUnit() : "",
"unitvalue" => (is_object($variable->getUnit())) ? $variable->getUnit()->getId() : ""
);
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, $variable->getVariable());
$a_xml_writer->xmlElement("fieldentry", NULL, serialize($var));
$a_xml_writer->xmlEndTag("qtimetadatafield");
}
foreach ($this->object->getResults() as $result)
{
$resultunits = $this->object->getResultUnits($result);
$ru = array();
foreach ($resultunits as $unit)
{
array_push($ru, array("unit" => $unit->getUnit(), "unitvalue" => $unit->getId()));
}
$res = array(
"precision" => $result->getPrecision(),
"tolerance" => $result->getTolerance(),
"rangemin" => $result->getRangeMin(),
"rangemax" => $result->getRangeMax(),
"points" => $result->getPoints(),
"formula" => $result->getFormula(),
"rating" => ($result->getRatingSimple()) ? "" : array("sign" => $result->getRatingSign(), "value" => $result->getRatingValue(), "unit" => $result->getRatingUnit()),
"unit" => (is_object($result->getUnit())) ? $result->getUnit()->getUnit() : "",
"unitvalue" => (is_object($result->getUnit())) ? $result->getUnit()->getId() : "",
"resultunits" => $ru
);
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, $result->getResult());
$a_xml_writer->xmlElement("fieldentry", NULL, serialize($res));
$a_xml_writer->xmlEndTag("qtimetadatafield");
}
// additional content editing information
$this->addGeneralMetadata($a_xml_writer);
$a_xml_writer->xmlEndTag("qtimetadata");
$a_xml_writer->xmlEndTag("itemmetadata");
// PART I: qti presentation
$attrs = array(
"label" => $this->object->getTitle()
);
$a_xml_writer->xmlStartTag("presentation", $attrs);
// add flow to presentation
$a_xml_writer->xmlStartTag("flow");
// add material with question text to presentation
$this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
// add answers to presentation
$a_xml_writer->xmlEndTag("flow");
$a_xml_writer->xmlEndTag("presentation");
$a_xml_writer->xmlEndTag("item");
$a_xml_writer->xmlEndTag("questestinterop");
$xml = $a_xml_writer->xmlDumpMem(FALSE);
if (!$a_include_header)
{
$pos = strpos($xml, "?>");
$xml = substr($xml, $pos + 2);
}
return $xml;
}

+ Here is the call graph for this function:


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