ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
assTextQuestionExport Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assTextQuestionExport:
+ Collaboration diagram for assTextQuestionExport:

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 Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 
- Public Member Functions inherited from assQuestionExport
 __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 Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 
 addQTIMaterial (ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
 

Data Fields

 $object
 
- Data Fields inherited from assQuestionExport
 $object
 
const ITEM_SOLUTIONHINT = 'solutionhint'
 

Additional Inherited Members

- 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)
 
 addSolutionHints (ilXmlWriter $writer)
 
 addSuggestedSolution (ilXmlWriter $writer)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class for essay question exports

assTextQuestionExport is a class for essay 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 27 of file class.assTextQuestionExport.php.

Member Function Documentation

◆ toXML()

assTextQuestionExport::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.

Definition at line 39 of file class.assTextQuestionExport.php.

References $DIC, assQuestionExport\addAdditionalContentEditingModeInformation(), assQuestionExport\addAnswerSpecificFeedback(), assQuestionExport\addGeneralMetadata(), assQuestionExport\addQTIMaterial(), assQuestionExport\addQtiMetaDataField(), assQuestionExport\addSolutionHints(), assQuestionExport\addSuggestedSolution(), IL_INST_ID, null, and ILIAS\Repository\object().

39  : string
40  {
41  global $DIC;
42  $ilias = $DIC['ilias'];
43 
44  $a_xml_writer = new ilXmlWriter();
45  // set xml header
46  $a_xml_writer->xmlHeader();
47  $a_xml_writer->xmlStartTag("questestinterop");
48  $attrs = [
49  "ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(),
50  "title" => $this->object->getTitle(),
51  "maxattempts" => $this->object->getNrOfTries()
52  ];
53  $a_xml_writer->xmlStartTag("item", $attrs);
54  // add question description
55  $a_xml_writer->xmlElement("qticomment", null, $this->object->getComment());
56  $a_xml_writer->xmlStartTag("itemmetadata");
57  $a_xml_writer->xmlStartTag("qtimetadata");
58  $a_xml_writer->xmlStartTag("qtimetadatafield");
59  $a_xml_writer->xmlElement("fieldlabel", null, "ILIAS_VERSION");
60  $a_xml_writer->xmlElement("fieldentry", null, $ilias->getSetting("ilias_version"));
61  $a_xml_writer->xmlEndTag("qtimetadatafield");
62  $a_xml_writer->xmlStartTag("qtimetadatafield");
63  $a_xml_writer->xmlElement("fieldlabel", null, "QUESTIONTYPE");
64  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getQuestionType());
65  $a_xml_writer->xmlEndTag("qtimetadatafield");
66  $a_xml_writer->xmlStartTag("qtimetadatafield");
67  $a_xml_writer->xmlElement("fieldlabel", null, "AUTHOR");
68  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getAuthor());
69  $a_xml_writer->xmlEndTag("qtimetadatafield");
70 
71  // additional content editing information
72  $this->addAdditionalContentEditingModeInformation($a_xml_writer);
73  $this->addGeneralMetadata($a_xml_writer);
74 
75  $this->addQtiMetaDataField($a_xml_writer, 'wordcounter', (int) $this->object->isWordCounterEnabled());
76 
77  $a_xml_writer->xmlStartTag("qtimetadatafield");
78  $a_xml_writer->xmlElement("fieldlabel", null, "textrating");
79  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getTextRating());
80  $a_xml_writer->xmlEndTag("qtimetadatafield");
81 
82  /*
83  $a_xml_writer->xmlStartTag("qtimetadatafield");
84  $a_xml_writer->xmlElement("fieldlabel", NULL, "keywords");
85  $a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getKeywords());
86  $a_xml_writer->xmlEndTag("qtimetadatafield");
87  */
88 
89  $a_xml_writer->xmlStartTag("qtimetadatafield");
90  $a_xml_writer->xmlElement("fieldlabel", null, "matchcondition");
91  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getMatchcondition());
92  $a_xml_writer->xmlEndTag("qtimetadatafield");
93 
94  $a_xml_writer->xmlStartTag("qtimetadatafield");
95  $a_xml_writer->xmlElement("fieldlabel", null, "termscoring");
96  $scores = base64_encode(serialize($this->object->getAnswers()));
97  $a_xml_writer->xmlElement("fieldentry", null, $scores);
98  $a_xml_writer->xmlEndTag("qtimetadatafield");
99 
100  $a_xml_writer->xmlStartTag("qtimetadatafield");
101  $a_xml_writer->xmlElement("fieldlabel", null, "termrelation");
102  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getKeywordRelation());
103  $a_xml_writer->xmlEndTag("qtimetadatafield");
104 
105  $a_xml_writer->xmlStartTag("qtimetadatafield");
106  $a_xml_writer->xmlElement("fieldlabel", null, "specificfeedback");
107  $a_xml_writer->xmlElement("fieldentry", null, $this->object->getKeywordRelation());
108  $a_xml_writer->xmlEndTag("qtimetadatafield");
109 
110  $a_xml_writer->xmlEndTag("qtimetadata");
111  $a_xml_writer->xmlEndTag("itemmetadata");
112 
113  // PART I: qti presentation
114  $attrs = [
115  "label" => $this->object->getTitle()
116  ];
117  $a_xml_writer->xmlStartTag("presentation", $attrs);
118  // add flow to presentation
119  $a_xml_writer->xmlStartTag("flow");
120  // add material with question text to presentation
121  $this->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
122  // add information on response rendering
123  $attrs = [
124  "ident" => "TEXT",
125  "rcardinality" => "Ordered"
126  ];
127  $a_xml_writer->xmlStartTag("response_str", $attrs);
128  $attrs = [
129  "fibtype" => "String",
130  "prompt" => "Box"
131  ];
132  if ($this->object->getMaxNumOfChars() > 0) {
133  $attrs["maxchars"] = $this->object->getMaxNumOfChars();
134  }
135  $a_xml_writer->xmlStartTag("render_fib", $attrs);
136  $attrs = [
137  "ident" => "A"
138  ];
139  $a_xml_writer->xmlStartTag("response_label", $attrs);
140  $a_xml_writer->xmlEndTag("response_label");
141  $a_xml_writer->xmlEndTag("render_fib");
142  $a_xml_writer = $this->addSuggestedSolution($a_xml_writer);
143  $a_xml_writer->xmlEndTag("response_str");
144  $a_xml_writer->xmlEndTag("flow");
145  $a_xml_writer->xmlEndTag("presentation");
146 
147  // PART II: qti resprocessing
148  $attrs = [
149  "scoremodel" => "HumanRater"
150  ];
151  $a_xml_writer->xmlStartTag("resprocessing", $attrs);
152  $a_xml_writer->xmlStartTag("outcomes");
153  $attrs = [
154  "varname" => "WritingScore",
155  "vartype" => "Integer",
156  "minvalue" => "0",
157  "maxvalue" => $this->object->getPoints()
158  ];
159  $a_xml_writer->xmlStartTag("decvar", $attrs);
160  $a_xml_writer->xmlEndTag("decvar");
161  $a_xml_writer->xmlEndTag("outcomes");
162 
163  $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
164  $this->object->getId(),
165  true
166  );
167  $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
168  $this->object->getId(),
169  false
170  );
171  if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
172  if (strlen($feedback_allcorrect)) {
173  $attrs = [
174  "continue" => "Yes"
175  ];
176  $a_xml_writer->xmlStartTag("respcondition", $attrs);
177  // qti conditionvar
178  $a_xml_writer->xmlStartTag("conditionvar");
179  $attrs = [
180  "respident" => "points"
181  ];
182  $a_xml_writer->xmlElement("varequal", $attrs, $this->object->getPoints());
183  $a_xml_writer->xmlEndTag("conditionvar");
184  // qti displayfeedback
185  $attrs = [
186  "feedbacktype" => "Response",
187  "linkrefid" => "response_allcorrect"
188  ];
189  $a_xml_writer->xmlElement("displayfeedback", $attrs);
190  $a_xml_writer->xmlEndTag("respcondition");
191  }
192 
193  if (strlen($feedback_onenotcorrect)) {
194  $attrs = [
195  "continue" => "Yes"
196  ];
197  $a_xml_writer->xmlStartTag("respcondition", $attrs);
198  // qti conditionvar
199  $a_xml_writer->xmlStartTag("conditionvar");
200  $a_xml_writer->xmlStartTag("not");
201  $attrs = [
202  "respident" => "points"
203  ];
204  $a_xml_writer->xmlElement("varequal", $attrs, $this->object->getPoints());
205  $a_xml_writer->xmlEndTag("not");
206  $a_xml_writer->xmlEndTag("conditionvar");
207  // qti displayfeedback
208  $attrs = [
209  "feedbacktype" => "Response",
210  "linkrefid" => "response_onenotcorrect"
211  ];
212  $a_xml_writer->xmlElement("displayfeedback", $attrs);
213  $a_xml_writer->xmlEndTag("respcondition");
214  }
215  }
216 
217  $a_xml_writer->xmlStartTag("respcondition");
218  $a_xml_writer->xmlStartTag("conditionvar");
219  $a_xml_writer->xmlElement("other", null, "tutor_rated");
220  $a_xml_writer->xmlEndTag("conditionvar");
221  $a_xml_writer->xmlEndTag("respcondition");
222  $a_xml_writer->xmlEndTag("resprocessing");
223 
224  $this->addAnswerSpecificFeedback($a_xml_writer, $this->object->feedbackOBJ->getAnswerOptionsByAnswerIndex());
225 
226  if (strlen($feedback_allcorrect)) {
227  $attrs = [
228  "ident" => "response_allcorrect",
229  "view" => "All"
230  ];
231  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
232  // qti flow_mat
233  $a_xml_writer->xmlStartTag("flow_mat");
234  $this->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
235  $a_xml_writer->xmlEndTag("flow_mat");
236  $a_xml_writer->xmlEndTag("itemfeedback");
237  }
238  if (strlen($feedback_onenotcorrect)) {
239  $attrs = [
240  "ident" => "response_onenotcorrect",
241  "view" => "All"
242  ];
243  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
244  // qti flow_mat
245  $a_xml_writer->xmlStartTag("flow_mat");
246  $this->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
247  $a_xml_writer->xmlEndTag("flow_mat");
248  $a_xml_writer->xmlEndTag("itemfeedback");
249  }
250 
251  $a_xml_writer = $this->addSolutionHints($a_xml_writer);
252 
253  $a_xml_writer->xmlEndTag("item");
254  $a_xml_writer->xmlEndTag("questestinterop");
255 
256  $xml = $a_xml_writer->xmlDumpMem(false);
257  if (!$a_include_header) {
258  $pos = strpos($xml, "?>");
259  $xml = substr($xml, $pos + 2);
260  }
261  return $xml;
262  }
const IL_INST_ID
Definition: constants.php:40
addQTIMaterial(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
addAnswerSpecificFeedback(ilXmlWriter $a_xml_writer, $answers)
addGeneralMetadata(ilXmlWriter $xmlwriter)
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 ...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
addSuggestedSolution(ilXmlWriter $writer)
addSolutionHints(ilXmlWriter $writer)
+ Here is the call graph for this function:

Field Documentation

◆ $object

assTextQuestionExport::$object

Definition at line 32 of file class.assTextQuestionExport.php.


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