ILIAS  release_8 Revision v8.24
assFlashQuestionExport 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 assFlashQuestionExport:
+ Collaboration diagram for assFlashQuestionExport:

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 flash 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 27 of file class.assFlashQuestionExport.php.

Member Function Documentation

◆ toXML()

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

Reimplemented from assQuestionExport.

Definition at line 34 of file class.assFlashQuestionExport.php.

34 : string
35 {
36 global $DIC;
37 $ilias = $DIC['ilias'];
38
39 include_once("./Services/Xml/classes/class.ilXmlWriter.php");
40 $a_xml_writer = new ilXmlWriter();
41 // set xml header
42 $a_xml_writer->xmlHeader();
43 $a_xml_writer->xmlStartTag("questestinterop");
44 $attrs = array(
45 "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
46 "title" => $this->object->getTitle(),
47 "maxattempts" => $this->object->getNrOfTries()
48 );
49 $a_xml_writer->xmlStartTag("item", $attrs);
50 // add question description
51 $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
52 $a_xml_writer->xmlStartTag("itemmetadata");
53 $a_xml_writer->xmlStartTag("qtimetadata");
54 $a_xml_writer->xmlStartTag("qtimetadatafield");
55 $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
56 $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
57 $a_xml_writer->xmlEndTag("qtimetadatafield");
58 $a_xml_writer->xmlStartTag("qtimetadatafield");
59 $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
60 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getQuestionType());
61 $a_xml_writer->xmlEndTag("qtimetadatafield");
62 $a_xml_writer->xmlStartTag("qtimetadatafield");
63 $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
64 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
65 $a_xml_writer->xmlEndTag("qtimetadatafield");
66
67 // additional content editing information
69 $this->addGeneralMetadata($a_xml_writer);
70
71 $a_xml_writer->xmlStartTag("qtimetadatafield");
72 $a_xml_writer->xmlElement("fieldlabel", null, "points");
73 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getPoints());
74 $a_xml_writer->xmlEndTag("qtimetadatafield");
75 $a_xml_writer->xmlStartTag("qtimetadatafield");
76 $a_xml_writer->xmlElement("fieldlabel", null, "width");
77 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getWidth());
78 $a_xml_writer->xmlEndTag("qtimetadatafield");
79 $a_xml_writer->xmlStartTag("qtimetadatafield");
80 $a_xml_writer->xmlElement("fieldlabel", null, "height");
81 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getHeight());
82 $a_xml_writer->xmlEndTag("qtimetadatafield");
83 $a_xml_writer->xmlStartTag("qtimetadatafield");
84 $a_xml_writer->xmlElement("fieldlabel", null, "applet");
85 $a_xml_writer->xmlElement("fieldentry", null, $this->object->getApplet());
86 $a_xml_writer->xmlEndTag("qtimetadatafield");
87 $a_xml_writer->xmlStartTag("qtimetadatafield");
88 $a_xml_writer->xmlElement("fieldlabel", null, "swf");
89 $flashpath = $this->object->getFlashPath() . $this->object->getApplet();
90 $fh = @fopen($flashpath, "rb");
91 $base64 = "";
92 if ($fh != false) {
93 $flashfile = fread($fh, filesize($flashpath));
94 fclose($fh);
95 $base64 = base64_encode($flashfile);
96 }
97 $a_xml_writer->xmlElement("fieldentry", null, $base64);
98 $a_xml_writer->xmlEndTag("qtimetadatafield");
99 $a_xml_writer->xmlStartTag("qtimetadatafield");
100 $a_xml_writer->xmlElement("fieldlabel", null, "params");
101 $a_xml_writer->xmlElement("fieldentry", null, serialize($this->object->getParameters()));
102 $a_xml_writer->xmlEndTag("qtimetadatafield");
103 $a_xml_writer->xmlEndTag("qtimetadata");
104 $a_xml_writer->xmlEndTag("itemmetadata");
105
106 // PART I: qti presentation
107 $attrs = array(
108 "label" => $this->object->getTitle()
109 );
110 $a_xml_writer->xmlStartTag("presentation", $attrs);
111 // add flow to presentation
112 $a_xml_writer->xmlStartTag("flow");
113 // add material with question text to presentation
114 $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
115 // add answers to presentation
116 $a_xml_writer->xmlEndTag("flow");
117 $a_xml_writer->xmlEndTag("presentation");
118
119 $this->exportFeedbackOnly($a_xml_writer);
120
121 $a_xml_writer = $this->addSolutionHints($a_xml_writer);
122
123 $a_xml_writer->xmlEndTag("item");
124 $a_xml_writer->xmlEndTag("questestinterop");
125
126 $xml = $a_xml_writer->xmlDumpMem(false);
127 if (!$a_include_header) {
128 $pos = strpos($xml, "?>");
129 $xml = substr($xml, $pos + 2);
130 }
131 return $xml;
132 }
addGeneralMetadata(ilXmlWriter $xmlwriter)
addSolutionHints(ilXmlWriter $writer)
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
exportFeedbackOnly($a_xml_writer)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_INST_ID
Definition: constants.php:40
global $DIC
Definition: feed.php:28
$xml
Definition: metadata.php:351

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

+ Here is the call graph for this function:

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