ILIAS  release_7 Revision v7.30-3-g800a261c036
assQuestionExport Class Reference

Class for question exports. 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. 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

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 15 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 28 of file class.assQuestionExport.php.

29  {
30  $this->object = $a_object;
31  }

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

References addQtiMetaDataField().

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

195  {
196  $this->addQtiMetaDataField(
197  $a_xml_writer,
198  'additional_cont_edit_mode',
199  $this->object->getAdditionalContentEditingMode()
200  );
201  }
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 36 of file class.assQuestionExport.php.

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

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

37  {
38  foreach ($answers as $index => $answer) {
39  $linkrefid = "response_$index";
40  $attrs = array(
41  "ident" => $linkrefid,
42  "view" => "All"
43  );
44  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
45  // qti flow_mat
46  $a_xml_writer->xmlStartTag("flow_mat");
47  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
48  $this->object->getId(),
49  0,
50  $index
51  );
52  $this->object->addQTIMaterial($a_xml_writer, $fb);
53  $a_xml_writer->xmlEndTag("flow_mat");
54  $a_xml_writer->xmlEndTag("itemfeedback");
55  }
56  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
$index
Definition: metadata.php:128
+ 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 206 of file class.assQuestionExport.php.

References addQtiMetaDataField().

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

207  {
208  $this->addQtiMetaDataField($xmlwriter, 'externalId', $this->object->getExternalId());
209 
210  $this->addQtiMetaDataField(
211  $xmlwriter,
212  'ilias_lifecycle',
213  $this->object->getLifecycle()->getIdentifier()
214  );
215 
216  $this->addQtiMetaDataField(
217  $xmlwriter,
218  'lifecycle',
219  $this->object->getLifecycle()->getMappedLomLifecycle()
220  );
221  }
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 61 of file class.assQuestionExport.php.

References exportFeedbackOnly().

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

62  {
63  $this->exportFeedbackOnly($a_xml_writer);
64  }
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 178 of file class.assQuestionExport.php.

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

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

179  {
180  $a_xml_writer->xmlStartTag("qtimetadatafield");
181  $a_xml_writer->xmlElement("fieldlabel", null, $fieldLabel);
182  $a_xml_writer->xmlElement("fieldentry", null, $fieldValue);
183  $a_xml_writer->xmlEndTag("qtimetadatafield");
184  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
xmlElement($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 225 of file class.assQuestionExport.php.

References $data, ilAssQuestionHintList\getListByQuestionId(), and ilXmlWriter\xmlElement().

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

225  : ilXmlWriter
226  {
227  $question_id = (int) $this->object->getId();
228  $list = ilAssQuestionHintList::getListByQuestionId($question_id);
229 
230  foreach ($list as $hint) {
231  $attrs = [
232  'index' => $hint->getIndex(),
233  'points' => $hint->getPoints()
234  ];
235  $data = $hint->getText();
236  $writer->xmlElement(self::ITEM_SOLUTIONHINT, $attrs, $data);
237  }
238  return $writer;
239  }
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
$data
Definition: storeScorm.php:23
XML writer class.
xmlElement($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 66 of file class.assQuestionExport.php.

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

67  {
68  $feedback_allcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
69  $this->object->getId(),
70  true
71  );
72  $feedback_onenotcorrect = $this->object->feedbackOBJ->getGenericFeedbackExportPresentation(
73  $this->object->getId(),
74  false
75  );
76  if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
77  $a_xml_writer->xmlStartTag("resprocessing");
78  $a_xml_writer->xmlStartTag("outcomes");
79  $a_xml_writer->xmlStartTag("decvar");
80  $a_xml_writer->xmlEndTag("decvar");
81  $a_xml_writer->xmlEndTag("outcomes");
82 
83  if (strlen($feedback_allcorrect)) {
84  $attrs = array(
85  "continue" => "Yes"
86  );
87  $a_xml_writer->xmlStartTag("respcondition", $attrs);
88  // qti conditionvar
89  $a_xml_writer->xmlStartTag("conditionvar");
90  $attrs = array(
91  "respident" => "points"
92  );
93  $a_xml_writer->xmlElement("varequal", $attrs, $this->object->getPoints());
94  $a_xml_writer->xmlEndTag("conditionvar");
95  // qti displayfeedback
96  $attrs = array(
97  "feedbacktype" => "Response",
98  "linkrefid" => "response_allcorrect"
99  );
100  $a_xml_writer->xmlElement("displayfeedback", $attrs);
101  $a_xml_writer->xmlEndTag("respcondition");
102  }
103 
104  if (strlen($feedback_onenotcorrect)) {
105  $attrs = array(
106  "continue" => "Yes"
107  );
108  $a_xml_writer->xmlStartTag("respcondition", $attrs);
109  // qti conditionvar
110  $a_xml_writer->xmlStartTag("conditionvar");
111  $a_xml_writer->xmlStartTag("not");
112  $attrs = array(
113  "respident" => "points"
114  );
115  $a_xml_writer->xmlElement("varequal", $attrs, $this->object->getPoints());
116  $a_xml_writer->xmlEndTag("not");
117  $a_xml_writer->xmlEndTag("conditionvar");
118  // qti displayfeedback
119  $attrs = array(
120  "feedbacktype" => "Response",
121  "linkrefid" => "response_onenotcorrect"
122  );
123  $a_xml_writer->xmlElement("displayfeedback", $attrs);
124  $a_xml_writer->xmlEndTag("respcondition");
125  }
126  $a_xml_writer->xmlEndTag("resprocessing");
127  }
128 
129  if (strlen($feedback_allcorrect)) {
130  $attrs = array(
131  "ident" => "response_allcorrect",
132  "view" => "All"
133  );
134  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
135  // qti flow_mat
136  $a_xml_writer->xmlStartTag("flow_mat");
137  $this->object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
138  $a_xml_writer->xmlEndTag("flow_mat");
139  $a_xml_writer->xmlEndTag("itemfeedback");
140  }
141  if (strlen($feedback_onenotcorrect)) {
142  $attrs = array(
143  "ident" => "response_onenotcorrect",
144  "view" => "All"
145  );
146  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
147  // qti flow_mat
148  $a_xml_writer->xmlStartTag("flow_mat");
149  $this->object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
150  $a_xml_writer->xmlEndTag("flow_mat");
151  $a_xml_writer->xmlEndTag("itemfeedback");
152  }
153  }
+ 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

Returns
string The QTI xml representation of the question public

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

165  {
166  }

Field Documentation

◆ $object

assQuestionExport::$object

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

◆ ITEM_SOLUTIONHINT

const assQuestionExport::ITEM_SOLUTIONHINT = 'solutionhint'

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