4include_once 
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
 
   31    public function toXML($a_include_header = 
true, $a_include_binary = 
true, $a_shuffle = 
false, $test_output = 
false, $force_image_references = 
false)
 
   34        $ilias = 
$DIC[
'ilias'];
 
   36        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
   40        $a_xml_writer->xmlStartTag(
"questestinterop");
 
   42            "ident" => 
"il_" . 
IL_INST_ID . 
"_qst_" . $this->object->getId(),
 
   43            "title" => $this->object->getTitle(),
 
   44            "maxattempts" => $this->object->getNrOfTries()
 
   46        $a_xml_writer->xmlStartTag(
"item", $attrs);
 
   48        $a_xml_writer->xmlElement(
"qticomment", 
null, $this->object->getComment());
 
   50        $workingtime = $this->
object->getEstimatedWorkingTime();
 
   51        $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
 
   52        $a_xml_writer->xmlElement(
"duration", 
null, $duration);
 
   54        $a_xml_writer->xmlStartTag(
"itemmetadata");
 
   55        $a_xml_writer->xmlStartTag(
"qtimetadata");
 
   56        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   57        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ILIAS_VERSION");
 
   58        $a_xml_writer->xmlElement(
"fieldentry", 
null, $ilias->getSetting(
"ilias_version"));
 
   59        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   60        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   61        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"QUESTIONTYPE");
 
   63        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   64        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   65        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"AUTHOR");
 
   66        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getAuthor());
 
   67        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   73        $this->
addQtiMetaDataField($a_xml_writer, 
'wordcounter', (
int) $this->object->isWordCounterEnabled());
 
   75        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   76        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"textrating");
 
   77        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getTextRating());
 
   78        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   87        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   88        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"matchcondition");
 
   89        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->matchcondition);
 
   90        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   92        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   93        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"termscoring");
 
   94        $scores = base64_encode(serialize($this->object->getAnswers()));
 
   95        $a_xml_writer->xmlElement(
"fieldentry", 
null, $scores);
 
   96        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   98        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   99        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"termrelation");
 
  100        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getKeywordRelation());
 
  101        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
  103        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
  104        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"specificfeedback");
 
  105        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getKeywordRelation());
 
  106        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
  108        $a_xml_writer->xmlEndTag(
"qtimetadata");
 
  109        $a_xml_writer->xmlEndTag(
"itemmetadata");
 
  113            "label" => $this->object->getTitle()
 
  115        $a_xml_writer->xmlStartTag(
"presentation", $attrs);
 
  117        $a_xml_writer->xmlStartTag(
"flow");
 
  119        $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
 
  123            "rcardinality" => 
"Ordered" 
  125        $a_xml_writer->xmlStartTag(
"response_str", $attrs);
 
  127            "fibtype" => 
"String",
 
  130        if ($this->object->getMaxNumOfChars() > 0) {
 
  131            $attrs[
"maxchars"] = $this->
object->getMaxNumOfChars();
 
  133        $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
 
  137        $a_xml_writer->xmlStartTag(
"response_label", $attrs);
 
  138        $a_xml_writer->xmlEndTag(
"response_label");
 
  139        $a_xml_writer->xmlEndTag(
"render_fib");
 
  141        $solution = $this->
object->getSuggestedSolution(0);
 
  142        if (count($solution)) {
 
  143            if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
 
  144                $a_xml_writer->xmlStartTag(
"material");
 
  145                $intlink = 
"il_" . 
IL_INST_ID . 
"_" . $matches[2] . 
"_" . $matches[3];
 
  146                if (strcmp($matches[1], 
"") != 0) {
 
  147                    $intlink = $solution[
"internal_link"];
 
  150                    "label" => 
"suggested_solution" 
  152                $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
 
  153                $a_xml_writer->xmlEndTag(
"material");
 
  156        $a_xml_writer->xmlEndTag(
"response_str");
 
  157        $a_xml_writer->xmlEndTag(
"flow");
 
  158        $a_xml_writer->xmlEndTag(
"presentation");
 
  162            "scoremodel" => 
"HumanRater" 
  164        $a_xml_writer->xmlStartTag(
"resprocessing", $attrs);
 
  165        $a_xml_writer->xmlStartTag(
"outcomes");
 
  167            "varname" => 
"WritingScore",
 
  168            "vartype" => 
"Integer",
 
  170            "maxvalue" => $this->object->getPoints()
 
  172        $a_xml_writer->xmlStartTag(
"decvar", $attrs);
 
  173        $a_xml_writer->xmlEndTag(
"decvar");
 
  174        $a_xml_writer->xmlEndTag(
"outcomes");
 
  176        $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
 
  177            $this->object->getId(),
 
  180        $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
 
  181            $this->object->getId(),
 
  184        if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
 
  185            if (strlen($feedback_allcorrect)) {
 
  189                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  191                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  193                    "respident" => 
"points" 
  195                $a_xml_writer->xmlElement(
"varequal", $attrs, $this->object->getPoints());
 
  196                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  199                    "feedbacktype" => 
"Response",
 
  200                    "linkrefid" => 
"response_allcorrect" 
  202                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  203                $a_xml_writer->xmlEndTag(
"respcondition");
 
  206            if (strlen($feedback_onenotcorrect)) {
 
  210                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  212                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  213                $a_xml_writer->xmlStartTag(
"not");
 
  215                    "respident" => 
"points" 
  217                $a_xml_writer->xmlElement(
"varequal", $attrs, $this->object->getPoints());
 
  218                $a_xml_writer->xmlEndTag(
"not");
 
  219                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  222                    "feedbacktype" => 
"Response",
 
  223                    "linkrefid" => 
"response_onenotcorrect" 
  225                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  226                $a_xml_writer->xmlEndTag(
"respcondition");
 
  230        $a_xml_writer->xmlStartTag(
"respcondition");
 
  231        $a_xml_writer->xmlStartTag(
"conditionvar");
 
  232        $a_xml_writer->xmlElement(
"other", 
null, 
"tutor_rated");
 
  233        $a_xml_writer->xmlEndTag(
"conditionvar");
 
  234        $a_xml_writer->xmlEndTag(
"respcondition");
 
  235        $a_xml_writer->xmlEndTag(
"resprocessing");
 
  239        if (strlen($feedback_allcorrect)) {
 
  241                "ident" => 
"response_allcorrect",
 
  244            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  246            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  247            $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
 
  248            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  249            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  251        if (strlen($feedback_onenotcorrect)) {
 
  253                "ident" => 
"response_onenotcorrect",
 
  256            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  258            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  259            $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
 
  260            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  261            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  266        $a_xml_writer->xmlEndTag(
"item");
 
  267        $a_xml_writer->xmlEndTag(
"questestinterop");
 
  269        $xml = $a_xml_writer->xmlDumpMem(
false);
 
  270        if (!$a_include_header) {
 
  271            $pos = strpos(
$xml, 
"?>");
 
An exception for terminatinating execution or to throw for unit testing.
Class for question exports.
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 ...
addAnswerSpecificFeedback(ilXmlWriter $a_xml_writer, $answers)
addSolutionHints(ilXmlWriter $writer)
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
Class for essay question exports.
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.
xmlHeader()
Writes xml header @access public.
const TEXT_QUESTION_IDENTIFIER