4 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
26 function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
29 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
33 $a_xml_writer->xmlStartTag(
"questestinterop");
35 "ident" =>
"il_".IL_INST_ID.
"_qst_".$this->object->getId(),
36 "title" => $this->
object->getTitle(),
37 "maxattempts" => $this->
object->getNrOfTries()
39 $a_xml_writer->xmlStartTag(
"item", $attrs);
41 $a_xml_writer->xmlElement(
"qticomment", NULL, $this->
object->getComment());
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);
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");
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");
66 $a_xml_writer->xmlEndTag(
"qtimetadata");
67 $a_xml_writer->xmlEndTag(
"itemmetadata");
71 "label" => $this->
object->getTitle()
73 $a_xml_writer->xmlStartTag(
"presentation", $attrs);
75 $a_xml_writer->xmlStartTag(
"flow");
77 $this->
object->addQTIMaterial($a_xml_writer, $this->
object->getQuestion());
78 $solution = $this->
object->getSuggestedSolution(0);
81 if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches))
83 $a_xml_writer->xmlStartTag(
"material");
84 $intlink =
"il_" . IL_INST_ID .
"_" . $matches[2] .
"_" . $matches[3];
85 if (strcmp($matches[1],
"") != 0)
87 $intlink = $solution[
"internal_link"];
90 "label" =>
"suggested_solution" 92 $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
93 $a_xml_writer->xmlEndTag(
"material");
97 $a_xml_writer->xmlStartTag(
"material");
99 "label" =>
"applet data",
100 "uri" => $this->
object->getJavaAppletFilename(),
101 "height" => $this->
object->getJavaHeight(),
102 "width" => $this->
object->getJavaWidth(),
103 "embedded" =>
"base64" 105 $javapath = $this->
object->getJavaPath() . $this->
object->getJavaAppletFilename();
106 $fh = @fopen($javapath,
"rb");
111 $javafile = fread(
$fh, filesize($javapath));
113 $base64 = base64_encode($javafile);
114 $a_xml_writer->xmlElement(
"matapplet", $attrs, $base64);
116 if ($this->
object->buildParamsOnly())
118 if ($this->
object->getJavaCode())
121 "label" =>
"java_code" 123 $a_xml_writer->xmlElement(
"mattext", $attrs, $this->
object->getJavaCode());
125 if ($this->
object->getJavaCodebase())
128 "label" =>
"java_codebase" 130 $a_xml_writer->xmlElement(
"mattext", $attrs, $this->
object->getJavaCodebase());
132 if ($this->
object->getJavaArchive())
135 "label" =>
"java_archive" 137 $a_xml_writer->xmlElement(
"mattext", $attrs, $this->
object->getJavaArchive());
139 for ($i = 0; $i < $this->
object->getParameterCount(); $i++)
141 $param = $this->
object->getParameter($i);
143 "label" => $param[
"name"]
145 $a_xml_writer->xmlElement(
"mattext", $attrs, $param[
"value"]);
148 $a_xml_writer->xmlEndTag(
"material");
149 $a_xml_writer->xmlStartTag(
"material");
153 $a_xml_writer->xmlElement(
"mattext", $attrs, $this->
object->getPoints());
154 $a_xml_writer->xmlEndTag(
"material");
156 $a_xml_writer->xmlEndTag(
"flow");
157 $a_xml_writer->xmlEndTag(
"presentation");
160 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
161 $this->
object->getId(), true
163 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
164 $this->
object->getId(), false
166 if (strlen($feedback_allcorrect . $feedback_onenotcorrect))
168 $a_xml_writer->xmlStartTag(
"resprocessing");
169 $a_xml_writer->xmlStartTag(
"outcomes");
170 $a_xml_writer->xmlStartTag(
"decvar");
171 $a_xml_writer->xmlEndTag(
"decvar");
172 $a_xml_writer->xmlEndTag(
"outcomes");
174 if (strlen($feedback_allcorrect))
179 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
181 $a_xml_writer->xmlStartTag(
"conditionvar");
183 "respident" =>
"points" 185 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
186 $a_xml_writer->xmlEndTag(
"conditionvar");
189 "feedbacktype" =>
"Response",
190 "linkrefid" =>
"response_allcorrect" 192 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
193 $a_xml_writer->xmlEndTag(
"respcondition");
196 if (strlen($feedback_onenotcorrect))
201 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
203 $a_xml_writer->xmlStartTag(
"conditionvar");
204 $a_xml_writer->xmlStartTag(
"not");
206 "respident" =>
"points" 208 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
209 $a_xml_writer->xmlEndTag(
"not");
210 $a_xml_writer->xmlEndTag(
"conditionvar");
213 "feedbacktype" =>
"Response",
214 "linkrefid" =>
"response_onenotcorrect" 216 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
217 $a_xml_writer->xmlEndTag(
"respcondition");
219 $a_xml_writer->xmlEndTag(
"resprocessing");
222 if (strlen($feedback_allcorrect))
225 "ident" =>
"response_allcorrect",
228 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
230 $a_xml_writer->xmlStartTag(
"flow_mat");
231 $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
232 $a_xml_writer->xmlEndTag(
"flow_mat");
233 $a_xml_writer->xmlEndTag(
"itemfeedback");
235 if (strlen($feedback_onenotcorrect))
238 "ident" =>
"response_onenotcorrect",
241 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
243 $a_xml_writer->xmlStartTag(
"flow_mat");
244 $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
245 $a_xml_writer->xmlEndTag(
"flow_mat");
246 $a_xml_writer->xmlEndTag(
"itemfeedback");
249 $a_xml_writer->xmlEndTag(
"item");
250 $a_xml_writer->xmlEndTag(
"questestinterop");
251 $xml = $a_xml_writer->xmlDumpMem(FALSE);
252 if (!$a_include_header)
254 $pos = strpos($xml,
"?>");
255 $xml = substr($xml, $pos + 2);
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
const JAVAAPPLET_QUESTION_IDENTIFIER
xmlHeader()
Writes xml header public.
Class for java applet question exports.
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.
Create styles array
The data for the language used.
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
Create new PHPExcel object
obj_idprivate