|
| toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false) |
|
| __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...
|
|
◆ toXML()
assLongMenuExportQti21::toXML |
( |
|
$a_include_header = true , |
|
|
|
$a_include_binary = true , |
|
|
|
$a_shuffle = false , |
|
|
|
$test_output = false , |
|
|
|
$force_image_references = false |
|
) |
| |
Definition at line 10 of file class.assLongMenuExportQti21.php.
References $DIC, $i, $index, $key, $values, $xml, and assLongMenu\GAP_PLACEHOLDER.
13 $ilias = $DIC[
'ilias'];
15 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
20 'xmlns' =>
"http://www.imsglobal.org/xsd/imsqti_v2p1",
21 'xmlns:xsi' =>
'http://www.w3.org/2001/XMLSchema-instance',
22 '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',
23 "identifier" =>
"il_" . IL_INST_ID .
"_qst_" . $this->object->getId(),
24 "title" => $this->
object->getTitle(),
26 'adaptive' =>
'false',
27 'timeDependent' =>
'false' 29 $xml->xmlStartTag(
"assessmentItem", $attrs,
false,
true,
false);
31 $correct_answers = $this->
object->getCorrectAnswers();
32 $answers = $this->
object->getAnswers();
34 $inlineChoice = array();
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);
56 if (in_array($value, $correct_answers[$key][0])) {
57 $points = $correct_answers[
$key][1];
61 "mappedValue" => $points
63 $inlineChoiceString .=
'<inlineChoice identifier="' . $value .
'" fixed="false" showHide="show">' . $value .
'</inlineChoice>';
64 $xml->xmlElement(
"mapEntry", $attrs);
66 $xml->xmlEndTag(
"mapping");
67 $xml->xmlEndTag(
"responseDeclaration");
68 $inlineChoiceString .=
'</inlineChoiceInteraction>';
69 $inlineChoice[$real_id] = $inlineChoiceString;
72 "identifier" =>
"SCORE",
73 "cardinality" =>
"single",
76 $xml->xmlStartTag(
"outcomeDeclaration", $attrs);
77 $xml->xmlStartTag(
"defaultValue");
78 $xml->xmlElement(
"value", null, 0);
79 $xml->xmlEndTag(
"defaultValue");
80 $xml->xmlEndTag(
"outcomeDeclaration");
83 "identifier" =>
"MAXSCORE",
84 "cardinality" =>
"single",
87 $xml->xmlStartTag(
"outcomeDeclaration", $attrs);
88 $xml->xmlStartTag(
"defaultValue");
89 $xml->xmlElement(
"value", null, $this->object->getMaximumPoints());
90 $xml->xmlEndTag(
"defaultValue");
91 $xml->xmlEndTag(
"outcomeDeclaration");
94 "identifier" =>
"FEEDBACKBASIC",
95 "cardinality" =>
"single",
96 "baseType" =>
"identifier",
97 "view" =>
"testConstructor" 100 $xml->xmlStartTag(
"outcomeDeclaration", $attrs);
101 $xml->xmlStartTag(
"defaultValue");
102 $xml->xmlElement(
"value", null,
"TODO IMPLEMENT FEEDBACK");
103 $xml->xmlEndTag(
"defaultValue");
104 $xml->xmlEndTag(
"outcomeDeclaration");
106 $longmenu_text = $this->
object->getLongMenuTextValue();
108 for (
$i = 1;
$i <=
sizeof($answers);
$i++) {
111 $longmenu_text = $this->
object->getQuestion() . $longmenu_text;
112 $xml->xmlStartTag(
"itemBody", $attrs);
113 $xml->xmlElement(
"div", null, $longmenu_text,
true,
false);
114 $xml->xmlEndTag(
"itemBody");
116 $xml->xmlStartTag(
"responseProcessing");
117 foreach ($answers as $key =>
$values) {
118 $xml->xmlStartTag(
"responseCondition");
119 $xml->xmlStartTag(
"responseIf");
120 $xml->xmlStartTag(
"not");
121 $xml->xmlStartTag(
"isNull");
122 $xml->xmlElement(
"variable", array(
"identifier" =>
'LONGMENU_' . ($key + 1) ));
123 $xml->xmlEndTag(
"isNull");
124 $xml->xmlEndTag(
"not");
125 $xml->xmlStartTag(
"setOutcomeValue", array(
"identifier" =>
'SCORE'));
126 $xml->xmlStartTag(
"sum");
127 $xml->xmlElement(
"variable", array(
"identifier" =>
'SCORE'));
128 $xml->xmlElement(
"mapResponse", array(
"identifier" =>
'LONGMENU_' . ($key + 1) ));
129 $xml->xmlEndTag(
"sum");
130 $xml->xmlEndTag(
"setOutcomeValue");
131 $xml->xmlStartTag(
"setOutcomeValue", array(
"identifier" =>
'FEEDBACKBASIC'));
132 $xml->xmlElement(
"value", array(
'baseType' =>
'identifier'),
"incorrect");
133 $xml->xmlEndTag(
"setOutcomeValue");
134 $xml->xmlEndTag(
"responseIf");
135 $xml->xmlEndTag(
"responseCondition");
137 $xml->xmlEndTag(
"responseProcessing");
138 $xml->xmlEndTag(
"assessmentItem");
140 if (!$a_include_header) {
141 $pos = strpos(
$xml,
"?>");
◆ $object
assLongMenuExportQti21::$object |
The documentation for this class was generated from the following file: