ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
class.assQuestionExport.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
5 
16 {
24  var $object;
25 
32  function assQuestionExport(&$a_object)
33  {
34  $this->object =& $a_object;
35  }
36 
37  function exportFeedbackOnly($a_xml_writer)
38  {
39  $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
40  $this->object->getId(), true
41  );
42  $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
43  $this->object->getId(), false
44  );
45  if (strlen($feedback_allcorrect . $feedback_onenotcorrect))
46  {
47  $a_xml_writer->xmlStartTag("resprocessing");
48  $a_xml_writer->xmlStartTag("outcomes");
49  $a_xml_writer->xmlStartTag("decvar");
50  $a_xml_writer->xmlEndTag("decvar");
51  $a_xml_writer->xmlEndTag("outcomes");
52 
53  if (strlen($feedback_allcorrect))
54  {
55  $attrs = array(
56  "continue" => "Yes"
57  );
58  $a_xml_writer->xmlStartTag("respcondition", $attrs);
59  // qti conditionvar
60  $a_xml_writer->xmlStartTag("conditionvar");
61  $attrs = array(
62  "respident" => "points"
63  );
64  $a_xml_writer->xmlElement("varequal", $attrs, $this->object->getPoints());
65  $a_xml_writer->xmlEndTag("conditionvar");
66  // qti displayfeedback
67  $attrs = array(
68  "feedbacktype" => "Response",
69  "linkrefid" => "response_allcorrect"
70  );
71  $a_xml_writer->xmlElement("displayfeedback", $attrs);
72  $a_xml_writer->xmlEndTag("respcondition");
73  }
74 
75  if (strlen($feedback_onenotcorrect))
76  {
77  $attrs = array(
78  "continue" => "Yes"
79  );
80  $a_xml_writer->xmlStartTag("respcondition", $attrs);
81  // qti conditionvar
82  $a_xml_writer->xmlStartTag("conditionvar");
83  $a_xml_writer->xmlStartTag("not");
84  $attrs = array(
85  "respident" => "points"
86  );
87  $a_xml_writer->xmlElement("varequal", $attrs, $this->object->getPoints());
88  $a_xml_writer->xmlEndTag("not");
89  $a_xml_writer->xmlEndTag("conditionvar");
90  // qti displayfeedback
91  $attrs = array(
92  "feedbacktype" => "Response",
93  "linkrefid" => "response_onenotcorrect"
94  );
95  $a_xml_writer->xmlElement("displayfeedback", $attrs);
96  $a_xml_writer->xmlEndTag("respcondition");
97  }
98  $a_xml_writer->xmlEndTag("resprocessing");
99  }
100 
101  if (strlen($feedback_allcorrect))
102  {
103  $attrs = array(
104  "ident" => "response_allcorrect",
105  "view" => "All"
106  );
107  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
108  // qti flow_mat
109  $a_xml_writer->xmlStartTag("flow_mat");
110  $this->object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
111  $a_xml_writer->xmlEndTag("flow_mat");
112  $a_xml_writer->xmlEndTag("itemfeedback");
113  }
114  if (strlen($feedback_onenotcorrect))
115  {
116  $attrs = array(
117  "ident" => "response_onenotcorrect",
118  "view" => "All"
119  );
120  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
121  // qti flow_mat
122  $a_xml_writer->xmlStartTag("flow_mat");
123  $this->object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
124  $a_xml_writer->xmlEndTag("flow_mat");
125  $a_xml_writer->xmlEndTag("itemfeedback");
126  }
127  }
128 
138  function toXML($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false, $force_image_references = false)
139  {
140  }
141 
152  final protected function addQtiMetaDataField(ilXmlWriter $a_xml_writer, $fieldLabel, $fieldValue)
153  {
154  $a_xml_writer->xmlStartTag("qtimetadatafield");
155  $a_xml_writer->xmlElement("fieldlabel", NULL, $fieldLabel);
156  $a_xml_writer->xmlElement("fieldentry", NULL, $fieldValue);
157  $a_xml_writer->xmlEndTag("qtimetadatafield");
158  }
159 
168  final protected function addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
169  {
170  $this->addQtiMetaDataField(
171  $a_xml_writer, 'additional_cont_edit_mode', $this->object->getAdditionalContentEditingMode()
172  );
173  }
174 
178  protected function addGeneralMetadata(ilXmlWriter $xmlwriter)
179  {
180  $this->addQtiMetaDataField($xmlwriter, 'externalId', $this->object->getExternalId());
181  }
182 }
183 
184 ?>
assQuestionExport(&$a_object)
assQuestionExport constructor
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
exportFeedbackOnly($a_xml_writer)
XML writer class.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
xmlEndTag($tag)
Writes an endtag.
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 ...
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
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.