ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
 

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)
 

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

33  {
34  $this->object = $a_object;
35  }

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 198 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(), assTextSubsetExport\toXML(), assTextQuestionExport\toXML(), assJavaAppletExport\toXML(), assNumericExport\toXML(), assFormulaQuestionExport\toXML(), assClozeTestExport\toXML(), assImagemapQuestionExport\toXML(), and assOrderingQuestionExport\toXML().

199  {
200  $this->addQtiMetaDataField(
201  $a_xml_writer,
202  'additional_cont_edit_mode',
203  $this->object->getAdditionalContentEditingMode()
204  );
205  }
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 40 of file class.assQuestionExport.php.

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

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

41  {
42  foreach ($answers as $index => $answer) {
43  $linkrefid = "response_$index";
44  $attrs = array(
45  "ident" => $linkrefid,
46  "view" => "All"
47  );
48  $a_xml_writer->xmlStartTag("itemfeedback", $attrs);
49  // qti flow_mat
50  $a_xml_writer->xmlStartTag("flow_mat");
51  $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
52  $this->object->getId(),
53  0,
54  $index
55  );
56  $this->object->addQTIMaterial($a_xml_writer, $fb);
57  $a_xml_writer->xmlEndTag("flow_mat");
58  $a_xml_writer->xmlEndTag("itemfeedback");
59  }
60  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
$index
Definition: metadata.php:60
xmlEndTag($tag)
Writes an endtag.
+ 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 210 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(), assTextSubsetExport\toXML(), assTextQuestionExport\toXML(), assJavaAppletExport\toXML(), assNumericExport\toXML(), assFormulaQuestionExport\toXML(), assClozeTestExport\toXML(), assImagemapQuestionExport\toXML(), and assOrderingQuestionExport\toXML().

211  {
212  $this->addQtiMetaDataField($xmlwriter, 'externalId', $this->object->getExternalId());
213  }
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 65 of file class.assQuestionExport.php.

References exportFeedbackOnly().

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

66  {
67  $this->exportFeedbackOnly($a_xml_writer);
68  }
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 182 of file class.assQuestionExport.php.

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

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

183  {
184  $a_xml_writer->xmlStartTag("qtimetadatafield");
185  $a_xml_writer->xmlElement("fieldlabel", null, $fieldLabel);
186  $a_xml_writer->xmlElement("fieldentry", null, $fieldValue);
187  $a_xml_writer->xmlEndTag("qtimetadatafield");
188  }
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:

◆ exportFeedbackOnly()

assQuestionExport::exportFeedbackOnly (   $a_xml_writer)

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

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

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

169  {
170  }

Field Documentation

◆ $object

assQuestionExport::$object

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


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