ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
assQuestionExport 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 assQuestionExport:
+ Collaboration diagram for assQuestionExport:

Public Member Functions

 __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...
 

Data Fields

 $object
 
const ITEM_SOLUTIONHINT = 'solutionhint'
 

Protected Member Functions

 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)
 

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 question exports

exportQuestion is a basis class 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 29 of file class.assQuestionExport.php.

Constructor & Destructor Documentation

◆ __construct()

assQuestionExport::__construct (   $a_object)

assQuestionExport constructor

Parameters
object$a_objectThe question object public

Definition at line 42 of file class.assQuestionExport.php.

43  {
44  $this->object = $a_object;
45  }

Member Function Documentation

◆ addAdditionalContentEditingModeInformation()

assQuestionExport::addAdditionalContentEditingModeInformation ( ilXmlWriter  $a_xml_writer)
finalprotected

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)

protected

Parameters
ilXmlWriter$a_xml_writer

Definition at line 205 of file class.assQuestionExport.php.

References addQtiMetaDataField(), and ILIAS\Repository\object().

Referenced by assLongMenuExport\toXML(), assKprimChoiceExport\toXML(), assFlashQuestionExport\toXML(), assSingleChoiceExport\toXML(), assMatchingQuestionExport\toXML(), assErrorTextExport\toXML(), assFileUploadExport\toXML(), assMultipleChoiceExport\toXML(), assNumericExport\toXML(), assTextSubsetExport\toXML(), assFormulaQuestionExport\toXML(), assOrderingHorizontalExport\toXML(), assImagemapQuestionExport\toXML(), assTextQuestionExport\toXML(), assOrderingQuestionExport\toXML(), and assClozeTestExport\toXML().

205  : void
206  {
207  $this->addQtiMetaDataField(
208  $a_xml_writer,
209  'additional_cont_edit_mode',
210  $this->object->getAdditionalContentEditingMode()
211  );
212  }
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 ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAnswerSpecificFeedback()

assQuestionExport::addAnswerSpecificFeedback ( ilXmlWriter  $a_xml_writer,
  $answers 
)
protected
Parameters
ilXmlWriter$a_xml_writer

Definition at line 50 of file class.assQuestionExport.php.

References $index, ILIAS\Repository\object(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by assErrorTextExport\toXML(), and assTextQuestionExport\toXML().

50  : void
51  {
52  foreach ($answers as $index => $answer) {
53  $linkrefid = "response_$index";
54  $attrs = array(
55  "ident" => $linkrefid,
56  "view" => "All"
57  );
58  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
59  // qti flow_mat
60  $a_xml_writer->xmlStartTag("flow_mat");
61  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
62  $this->object->getId(),
63  0,
64  $index
65  );
66  $this->object->addQTIMaterial($a_xml_writer, $fb);
67  $a_xml_writer->xmlEndTag("flow_mat");
68  $a_xml_writer->xmlEndTag("itemfeedback");
69  }
70  }
$index
Definition: metadata.php:145
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGeneralMetadata()

assQuestionExport::addGeneralMetadata ( ilXmlWriter  $xmlwriter)
protected
Parameters
ilXmlWriter$xmlwriter

Definition at line 217 of file class.assQuestionExport.php.

References addQtiMetaDataField(), and ILIAS\Repository\object().

Referenced by assLongMenuExport\toXML(), assKprimChoiceExport\toXML(), assFlashQuestionExport\toXML(), assSingleChoiceExport\toXML(), assMatchingQuestionExport\toXML(), assErrorTextExport\toXML(), assFileUploadExport\toXML(), assMultipleChoiceExport\toXML(), assNumericExport\toXML(), assTextSubsetExport\toXML(), assFormulaQuestionExport\toXML(), assOrderingHorizontalExport\toXML(), assImagemapQuestionExport\toXML(), assTextQuestionExport\toXML(), assOrderingQuestionExport\toXML(), and assClozeTestExport\toXML().

217  : void
218  {
219  $this->addQtiMetaDataField($xmlwriter, 'externalId', $this->object->getExternalId());
220 
221  $this->addQtiMetaDataField(
222  $xmlwriter,
223  'ilias_lifecycle',
224  $this->object->getLifecycle()->getIdentifier()
225  );
226 
227  $this->addQtiMetaDataField(
228  $xmlwriter,
229  'lifecycle',
230  $this->object->getLifecycle()->getMappedLomLifecycle()
231  );
232  }
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 ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGenericFeedback()

assQuestionExport::addGenericFeedback ( ilXmlWriter  $a_xml_writer)
protected
Parameters
ilXmlWriter$a_xml_writer

Definition at line 75 of file class.assQuestionExport.php.

References exportFeedbackOnly().

Referenced by assErrorTextExport\toXML(), assOrderingHorizontalExport\toXML(), and assFormulaQuestionExport\toXML().

75  : void
76  {
77  $this->exportFeedbackOnly($a_xml_writer);
78  }
exportFeedbackOnly($a_xml_writer)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addQtiMetaDataField()

assQuestionExport::addQtiMetaDataField ( ilXmlWriter  $a_xml_writer,
  $fieldLabel,
  $fieldValue 
)
finalprotected

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)

protected

Parameters
ilXmlWriter$a_xml_writer
string$fieldLabel
string$fieldValue

Definition at line 189 of file class.assQuestionExport.php.

References ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by addAdditionalContentEditingModeInformation(), addGeneralMetadata(), assSingleChoiceExport\toXML(), assMultipleChoiceExport\toXML(), and assTextQuestionExport\toXML().

189  : void
190  {
191  $a_xml_writer->xmlStartTag("qtimetadatafield");
192  $a_xml_writer->xmlElement("fieldlabel", null, $fieldLabel);
193  $a_xml_writer->xmlElement("fieldentry", null, $fieldValue);
194  $a_xml_writer->xmlEndTag("qtimetadatafield");
195  }
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSolutionHints()

assQuestionExport::addSolutionHints ( ilXmlWriter  $writer)
protected

Definition at line 236 of file class.assQuestionExport.php.

References $data, ilAssQuestionHintList\getListByQuestionId(), ILIAS\Repository\int(), ILIAS\Repository\object(), and ilXmlWriter\xmlElement().

Referenced by assLongMenuExport\toXML(), assKprimChoiceExport\toXML(), assFlashQuestionExport\toXML(), assSingleChoiceExport\toXML(), assMatchingQuestionExport\toXML(), assErrorTextExport\toXML(), assFileUploadExport\toXML(), assMultipleChoiceExport\toXML(), assNumericExport\toXML(), assTextSubsetExport\toXML(), assFormulaQuestionExport\toXML(), assOrderingHorizontalExport\toXML(), assImagemapQuestionExport\toXML(), assTextQuestionExport\toXML(), assOrderingQuestionExport\toXML(), and assClozeTestExport\toXML().

236  : ilXmlWriter
237  {
238  $question_id = (int) $this->object->getId();
239  $list = ilAssQuestionHintList::getListByQuestionId($question_id);
240 
241  foreach ($list as $hint) {
242  $attrs = [
243  'index' => $hint->getIndex(),
244  'points' => $hint->getPoints()
245  ];
246  $data = $hint->getText();
247  $writer->xmlElement(self::ITEM_SOLUTIONHINT, $attrs, $data);
248  }
249  return $writer;
250  }
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportFeedbackOnly()

assQuestionExport::exportFeedbackOnly (   $a_xml_writer)

Definition at line 80 of file class.assQuestionExport.php.

References ILIAS\Repository\object().

Referenced by addGenericFeedback(), assFileUploadExport\toXML(), and assFlashQuestionExport\toXML().

80  : void
81  {
82  $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
83  $this->object->getId(),
84  true
85  );
86  $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
87  $this->object->getId(),
88  false
89  );
90  if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
91  $a_xml_writer->xmlStartTag("resprocessing");
92  $a_xml_writer->xmlStartTag("outcomes");
93  $a_xml_writer->xmlStartTag("decvar");
94  $a_xml_writer->xmlEndTag("decvar");
95  $a_xml_writer->xmlEndTag("outcomes");
96 
97  if (strlen($feedback_allcorrect)) {
98  $attrs = array(
99  "continue" => "Yes"
100  );
101  $a_xml_writer->xmlStartTag("respcondition", $attrs);
102  // qti conditionvar
103  $a_xml_writer->xmlStartTag("conditionvar");
104  $attrs = array(
105  "respident" => "points"
106  );
107  $a_xml_writer->xmlElement("varequal", $attrs, $this->object->getPoints());
108  $a_xml_writer->xmlEndTag("conditionvar");
109  // qti displayfeedback
110  $attrs = array(
111  "feedbacktype" => "Response",
112  "linkrefid" => "response_allcorrect"
113  );
114  $a_xml_writer->xmlElement("displayfeedback", $attrs);
115  $a_xml_writer->xmlEndTag("respcondition");
116  }
117 
118  if (strlen($feedback_onenotcorrect)) {
119  $attrs = array(
120  "continue" => "Yes"
121  );
122  $a_xml_writer->xmlStartTag("respcondition", $attrs);
123  // qti conditionvar
124  $a_xml_writer->xmlStartTag("conditionvar");
125  $a_xml_writer->xmlStartTag("not");
126  $attrs = array(
127  "respident" => "points"
128  );
129  $a_xml_writer->xmlElement("varequal", $attrs, $this->object->getPoints());
130  $a_xml_writer->xmlEndTag("not");
131  $a_xml_writer->xmlEndTag("conditionvar");
132  // qti displayfeedback
133  $attrs = array(
134  "feedbacktype" => "Response",
135  "linkrefid" => "response_onenotcorrect"
136  );
137  $a_xml_writer->xmlElement("displayfeedback", $attrs);
138  $a_xml_writer->xmlEndTag("respcondition");
139  }
140  $a_xml_writer->xmlEndTag("resprocessing");
141  }
142 
143  if (strlen($feedback_allcorrect)) {
144  $attrs = array(
145  "ident" => "response_allcorrect",
146  "view" => "All"
147  );
148  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
149  // qti flow_mat
150  $a_xml_writer->xmlStartTag("flow_mat");
151  $this->object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
152  $a_xml_writer->xmlEndTag("flow_mat");
153  $a_xml_writer->xmlEndTag("itemfeedback");
154  }
155  if (strlen($feedback_onenotcorrect)) {
156  $attrs = array(
157  "ident" => "response_onenotcorrect",
158  "view" => "All"
159  );
160  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
161  // qti flow_mat
162  $a_xml_writer->xmlStartTag("flow_mat");
163  $this->object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
164  $a_xml_writer->xmlEndTag("flow_mat");
165  $a_xml_writer->xmlEndTag("itemfeedback");
166  }
167  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

assQuestionExport::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 174 of file class.assQuestionExport.php.

174  : string
175  {
176  return '';
177  }

Field Documentation

◆ $object

assQuestionExport::$object

Definition at line 34 of file class.assQuestionExport.php.

Referenced by assClozeTestExport\__construct().

◆ ITEM_SOLUTIONHINT

const assQuestionExport::ITEM_SOLUTIONHINT = 'solutionhint'

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