ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
assFileUploadExport Class Reference

Class for file upload question exports. More...

+ Inheritance diagram for assFileUploadExport:
+ Collaboration diagram for assFileUploadExport:

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. 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. 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

Class for file upload 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$

Definition at line 13 of file class.assFileUploadExport.php.

Member Function Documentation

◆ toXML()

assFileUploadExport::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

Definition at line 24 of file class.assFileUploadExport.php.

References $DIC, $xml, assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addGeneralMetadata(), assQuestionExport\addSolutionHints(), assQuestionExport\exportFeedbackOnly(), IL_INST_ID, and ilXmlWriter\xmlHeader().

25  {
26  global $DIC;
27  $ilias = $DIC['ilias'];
28 
29  include_once("./Services/Xml/classes/class.ilXmlWriter.php");
30  $a_xml_writer = new ilXmlWriter;
31  // set xml header
32  $a_xml_writer->xmlHeader();
33  $a_xml_writer->xmlStartTag("questestinterop");
34  $attrs = array(
35  "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
36  "title" => $this->object->getTitle(),
37  "maxattempts" => $this->object->getNrOfTries()
38  );
39  $a_xml_writer->xmlStartTag("item", $attrs);
40  // add question description
41  $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
42  // add estimated working time
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);
46  // add ILIAS specific metadata
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 
62  // additional content editing information
63  $this->addAdditionalContentEditingModeInformation($a_xml_writer);
64  $this->addGeneralMetadata($a_xml_writer);
65 
66  $a_xml_writer->xmlStartTag("qtimetadatafield");
67  $a_xml_writer->xmlElement("fieldlabel", null, "points");
68  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
69  $a_xml_writer->xmlEndTag("qtimetadatafield");
70  $a_xml_writer->xmlStartTag("qtimetadatafield");
71  $a_xml_writer->xmlElement("fieldlabel", null, "maxsize");
72  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getMaxSize());
73  $a_xml_writer->xmlEndTag("qtimetadatafield");
74  $a_xml_writer->xmlStartTag("qtimetadatafield");
75  $a_xml_writer->xmlElement("fieldlabel", null, "allowedextensions");
76  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAllowedExtensions());
77  $a_xml_writer->xmlEndTag("qtimetadatafield");
78  $a_xml_writer->xmlEndTag("qtimetadata");
79  $a_xml_writer->xmlEndTag("itemmetadata");
80 
81  // PART I: qti presentation
82  $attrs = array(
83  "label" => $this->object->getTitle()
84  );
85  $a_xml_writer->xmlStartTag("presentation", $attrs);
86  // add flow to presentation
87  $a_xml_writer->xmlStartTag("flow");
88  // add material with question text to presentation
89  $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
90  // add answers to presentation
91  $a_xml_writer->xmlEndTag("flow");
92  $a_xml_writer->xmlEndTag("presentation");
93 
94  $this->exportFeedbackOnly($a_xml_writer);
95 
96  $a_xml_writer = $this->addSolutionHints($a_xml_writer);
97 
98  $a_xml_writer->xmlEndTag("item");
99  $a_xml_writer->xmlEndTag("questestinterop");
100 
101  $xml = $a_xml_writer->xmlDumpMem(false);
102  if (!$a_include_header) {
103  $pos = strpos($xml, "?>");
104  $xml = substr($xml, $pos + 2);
105  }
106  return $xml;
107  }
const IL_INST_ID
Definition: constants.php:38
exportFeedbackOnly($a_xml_writer)
XML writer class.
addGeneralMetadata(ilXmlWriter $xmlwriter)
global $DIC
Definition: goto.php:24
xmlHeader()
Writes xml header public.
$xml
Definition: metadata.php:332
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)
+ Here is the call graph for this function:

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