ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
assFlashQuestionExport Class Reference

Class for flash question exports. 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. More...
 
- Public Member Functions inherited from assQuestionExport
 assQuestionExport (&$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
 
- 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)
 

Detailed Description

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

Returns
string The QTI xml representation of the question @access public

Reimplemented from assQuestionExport.

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

25 {
26 global $ilias;
27
28 include_once("./Services/Xml/classes/class.ilXmlWriter.php");
29 $a_xml_writer = new ilXmlWriter;
30 // set xml header
31 $a_xml_writer->xmlHeader();
32 $a_xml_writer->xmlStartTag("questestinterop");
33 $attrs = array(
34 "ident" => "il_".IL_INST_ID."_qst_".$this->object->getId(),
35 "title" => $this->object->getTitle(),
36 "maxattempts" => $this->object->getNrOfTries()
37 );
38 $a_xml_writer->xmlStartTag("item", $attrs);
39 // add question description
40 $a_xml_writer->xmlElement("qticomment", NULL, $this->object->getComment());
41 // add estimated working time
42 $workingtime = $this->object->getEstimatedWorkingTime();
43 $duration = sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]);
44 $a_xml_writer->xmlElement("duration", NULL, $duration);
45 // add ILIAS specific metadata
46 $a_xml_writer->xmlStartTag("itemmetadata");
47 $a_xml_writer->xmlStartTag("qtimetadata");
48 $a_xml_writer->xmlStartTag("qtimetadatafield");
49 $a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
50 $a_xml_writer->xmlElement("fieldentry", NULL, $ilias->getSetting("ilias_version"));
51 $a_xml_writer->xmlEndTag("qtimetadatafield");
52 $a_xml_writer->xmlStartTag("qtimetadatafield");
53 $a_xml_writer->xmlElement("fieldlabel", NULL, "QUESTIONTYPE");
54 $a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getQuestionType());
55 $a_xml_writer->xmlEndTag("qtimetadatafield");
56 $a_xml_writer->xmlStartTag("qtimetadatafield");
57 $a_xml_writer->xmlElement("fieldlabel", NULL, "AUTHOR");
58 $a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getAuthor());
59 $a_xml_writer->xmlEndTag("qtimetadatafield");
60
61 // additional content editing information
63 $this->addGeneralMetadata($a_xml_writer);
64
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 $a_xml_writer->xmlStartTag("qtimetadatafield");
70 $a_xml_writer->xmlElement("fieldlabel", NULL, "width");
71 $a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getWidth());
72 $a_xml_writer->xmlEndTag("qtimetadatafield");
73 $a_xml_writer->xmlStartTag("qtimetadatafield");
74 $a_xml_writer->xmlElement("fieldlabel", NULL, "height");
75 $a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getHeight());
76 $a_xml_writer->xmlEndTag("qtimetadatafield");
77 $a_xml_writer->xmlStartTag("qtimetadatafield");
78 $a_xml_writer->xmlElement("fieldlabel", NULL, "applet");
79 $a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getApplet());
80 $a_xml_writer->xmlEndTag("qtimetadatafield");
81 $a_xml_writer->xmlStartTag("qtimetadatafield");
82 $a_xml_writer->xmlElement("fieldlabel", NULL, "swf");
83 $flashpath = $this->object->getFlashPath() . $this->object->getApplet();
84 $fh = @fopen($flashpath, "rb");
85 $base64 = "";
86 if ($fh != FALSE)
87 {
88 $flashfile = fread($fh, filesize($flashpath));
89 fclose($fh);
90 $base64 = base64_encode($flashfile);
91 }
92 $a_xml_writer->xmlElement("fieldentry", NULL, $base64);
93 $a_xml_writer->xmlEndTag("qtimetadatafield");
94 $a_xml_writer->xmlStartTag("qtimetadatafield");
95 $a_xml_writer->xmlElement("fieldlabel", NULL, "params");
96 $a_xml_writer->xmlElement("fieldentry", NULL, serialize($this->object->getParameters()));
97 $a_xml_writer->xmlEndTag("qtimetadatafield");
98 $a_xml_writer->xmlEndTag("qtimetadata");
99 $a_xml_writer->xmlEndTag("itemmetadata");
100
101 // PART I: qti presentation
102 $attrs = array(
103 "label" => $this->object->getTitle()
104 );
105 $a_xml_writer->xmlStartTag("presentation", $attrs);
106 // add flow to presentation
107 $a_xml_writer->xmlStartTag("flow");
108 // add material with question text to presentation
109 $this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
110 // add answers to presentation
111 $a_xml_writer->xmlEndTag("flow");
112 $a_xml_writer->xmlEndTag("presentation");
113
114 $this->exportFeedbackOnly($a_xml_writer);
115
116 $a_xml_writer->xmlEndTag("item");
117 $a_xml_writer->xmlEndTag("questestinterop");
118
119 $xml = $a_xml_writer->xmlDumpMem(FALSE);
120 if (!$a_include_header)
121 {
122 $pos = strpos($xml, "?>");
123 $xml = substr($xml, $pos + 2);
124 }
125 return $xml;
126 }
addGeneralMetadata(ilXmlWriter $xmlwriter)
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)
XML writer class.
xmlHeader()
Writes xml header @access public.

References assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addGeneralMetadata(), assQuestionExport\exportFeedbackOnly(), and ilXmlWriter\xmlHeader().

+ Here is the call graph for this function:

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