2 require_once
'Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php';
10 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
14 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
19 'xmlns' =>
"http://www.imsglobal.org/xsd/imsqti_v2p1",
20 'xmlns:xsi' =>
'http://www.w3.org/2001/XMLSchema-instance',
21 'xsi:schemaLocation' =>
'http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/qti/qtiv2p1/imsqti_v2p1p1.xsd http://www.w3.org/1998/Math/MathML http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd',
22 "identifier" =>
"il_".IL_INST_ID.
"_qst_".$this->object->getId(),
23 "title" => $this->
object->getTitle(),
25 'adaptive' =>
'false',
26 'timeDependent' =>
'false' 28 $xml->xmlStartTag(
"assessmentItem", $attrs,
false,
true,
false);
30 $correct_answers = $this->
object->getCorrectAnswers();
31 $answers = $this->
object->getAnswers();
33 $inlineChoice =
array();
34 foreach($answers as $key => $values)
37 $inlineChoiceString =
'<inlineChoiceInteraction responseIdentifier="LONGMENU_' . $real_id.
'" shuffle="false" required="false">';
39 "identifier" =>
"LONGMENU_" . $real_id,
40 "cardinality" =>
"single",
41 "baseType" =>
"identifier" 43 $xml->xmlStartTag(
"responseDeclaration", $attrs);
44 $xml->xmlStartTag(
"correctResponse");
45 $xml->xmlElement(
"value", NULL, $correct_answers[$key][0][0]);
46 $xml->xmlEndTag(
"correctResponse");
48 "defaultValue" =>
"0",
50 "upperBound" => $correct_answers[$key][1]
52 $xml->xmlStartTag(
"mapping", $attrs);
54 foreach($values as $index => $value)
58 if(in_array($value, $correct_answers[$key][0]))
60 $points = $correct_answers[$key][1];
64 "mappedValue" => $points
66 $inlineChoiceString .=
'<inlineChoice identifier="'.$value.
'" fixed="false" showHide="show">'.$value.
'</inlineChoice>';
67 $xml->xmlElement(
"mapEntry", $attrs);
69 $xml->xmlEndTag(
"mapping");
70 $xml->xmlEndTag(
"responseDeclaration");
71 $inlineChoiceString .=
'</inlineChoiceInteraction>';
72 $inlineChoice[$real_id] = $inlineChoiceString;
75 "identifier" =>
"SCORE",
76 "cardinality" =>
"single",
79 $xml->xmlStartTag(
"outcomeDeclaration", $attrs);
80 $xml->xmlStartTag(
"defaultValue");
81 $xml->xmlElement(
"value", NULL, 0);
82 $xml->xmlEndTag(
"defaultValue");
83 $xml->xmlEndTag(
"outcomeDeclaration");
86 "identifier" =>
"MAXSCORE",
87 "cardinality" =>
"single",
90 $xml->xmlStartTag(
"outcomeDeclaration", $attrs);
91 $xml->xmlStartTag(
"defaultValue");
92 $xml->xmlElement(
"value", NULL, $this->
object->getMaximumPoints());
93 $xml->xmlEndTag(
"defaultValue");
94 $xml->xmlEndTag(
"outcomeDeclaration");
97 "identifier" =>
"FEEDBACKBASIC",
98 "cardinality" =>
"single",
99 "baseType" =>
"identifier",
100 "view" =>
"testConstructor" 103 $xml->xmlStartTag(
"outcomeDeclaration", $attrs);
104 $xml->xmlStartTag(
"defaultValue");
105 $xml->xmlElement(
"value", NULL,
"TODO IMPLEMENT FEEDBACK");
106 $xml->xmlEndTag(
"defaultValue");
107 $xml->xmlEndTag(
"outcomeDeclaration");
109 $longmenu_text = $this->
object->getLongMenuTextValue();
111 for($i = 1; $i <=
sizeof($answers); $i++ )
115 $longmenu_text = $this->
object->getQuestion() . $longmenu_text;
116 $xml->xmlStartTag(
"itemBody", $attrs);
117 $xml->xmlElement(
"div", NULL, $longmenu_text,
true,
false);
118 $xml->xmlEndTag(
"itemBody");
120 $xml->xmlStartTag(
"responseProcessing");
121 foreach($answers as $key => $values)
123 $xml->xmlStartTag(
"responseCondition");
124 $xml->xmlStartTag(
"responseIf");
125 $xml->xmlStartTag(
"not");
126 $xml->xmlStartTag(
"isNull");
127 $xml->xmlElement(
"variable",
array(
"identifier" =>
'LONGMENU_'. ($key + 1) ));
128 $xml->xmlEndTag(
"isNull");
129 $xml->xmlEndTag(
"not");
130 $xml->xmlStartTag(
"setOutcomeValue",
array(
"identifier" =>
'SCORE'));
131 $xml->xmlStartTag(
"sum");
132 $xml->xmlElement(
"variable",
array(
"identifier" =>
'SCORE'));
133 $xml->xmlElement(
"mapResponse",
array(
"identifier" =>
'LONGMENU_'. ($key + 1) ));
134 $xml->xmlEndTag(
"sum");
135 $xml->xmlEndTag(
"setOutcomeValue");
136 $xml->xmlStartTag(
"setOutcomeValue",
array(
"identifier" =>
'FEEDBACKBASIC'));
137 $xml->xmlElement(
"value",
array(
'baseType' =>
'identifier'),
"incorrect");
138 $xml->xmlEndTag(
"setOutcomeValue");
139 $xml->xmlEndTag(
"responseIf");
140 $xml->xmlEndTag(
"responseCondition");
142 $xml->xmlEndTag(
"responseProcessing");
143 $xml->xmlEndTag(
"assessmentItem");
144 $xml = $xml->xmlDumpMem(FALSE);
145 if (!$a_include_header)
147 $pos = strpos($xml,
"?>");
148 $xml = substr($xml, $pos + 2);
Class for question exports.
xmlHeader()
Writes xml header public.
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate