4include_once 
"./Modules/TestQuestionPool/classes/export/qti12/class.assQuestionExport.php";
 
   26    public function toXML($a_include_header = 
true, $a_include_binary = 
true, $a_shuffle = 
false, $test_output = 
false, $force_image_references = 
false)
 
   29        $ilias = 
$DIC[
'ilias'];
 
   31        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
   35        $a_xml_writer->xmlStartTag(
"questestinterop");
 
   37            "ident" => 
"il_" . 
IL_INST_ID . 
"_qst_" . $this->object->getId(),
 
   38            "title" => $this->object->getTitle(),
 
   39            "maxattempts" => $this->object->getNrOfTries()
 
   41        $a_xml_writer->xmlStartTag(
"item", $attrs);
 
   43        $a_xml_writer->xmlElement(
"qticomment", 
null, $this->object->getComment());
 
   45        $workingtime = $this->
object->getEstimatedWorkingTime();
 
   46        $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
 
   47        $a_xml_writer->xmlElement(
"duration", 
null, $duration);
 
   49        $a_xml_writer->xmlStartTag(
"itemmetadata");
 
   50        $a_xml_writer->xmlStartTag(
"qtimetadata");
 
   51        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   52        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ILIAS_VERSION");
 
   53        $a_xml_writer->xmlElement(
"fieldentry", 
null, $ilias->getSetting(
"ilias_version"));
 
   54        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   55        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   56        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"QUESTIONTYPE");
 
   58        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   59        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   60        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"AUTHOR");
 
   61        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getAuthor());
 
   62        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   68        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   69        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"textrating");
 
   70        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getTextRating());
 
   71        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   72        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   73        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"correctanswers");
 
   74        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getCorrectAnswers());
 
   75        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   76        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   77        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"points");
 
   78        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getPoints());
 
   79        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   80        $a_xml_writer->xmlEndTag(
"qtimetadata");
 
   81        $a_xml_writer->xmlEndTag(
"itemmetadata");
 
   85            "label" => $this->object->getTitle()
 
   87        $a_xml_writer->xmlStartTag(
"presentation", $attrs);
 
   89        $a_xml_writer->xmlStartTag(
"flow");
 
   91        $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
 
   93        for ($counter = 1; $counter <= $this->
object->getCorrectAnswers(); $counter++) {
 
   95                "ident" => 
"TEXTSUBSET_" . sprintf(
"%02d", $counter),
 
   96                "rcardinality" => 
"Single" 
   98            $a_xml_writer->xmlStartTag(
"response_str", $attrs);
 
   99            $solution = $this->
object->getSuggestedSolution(0);
 
  100            if (count($solution)) {
 
  101                if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
 
  102                    $a_xml_writer->xmlStartTag(
"material");
 
  103                    $intlink = 
"il_" . 
IL_INST_ID . 
"_" . $matches[2] . 
"_" . $matches[3];
 
  104                    if (strcmp($matches[1], 
"") != 0) {
 
  105                        $intlink = $solution[
"internal_link"];
 
  108                        "label" => 
"suggested_solution" 
  110                    $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
 
  111                    $a_xml_writer->xmlEndTag(
"material");
 
  116                "fibtype" => 
"String",
 
  117                "columns" => $this->object->getMaxTextboxWidth()
 
  119            $a_xml_writer->xmlStartTag(
"render_fib", $attrs);
 
  120            $a_xml_writer->xmlEndTag(
"render_fib");
 
  121            $a_xml_writer->xmlEndTag(
"response_str");
 
  124        $a_xml_writer->xmlEndTag(
"flow");
 
  125        $a_xml_writer->xmlEndTag(
"presentation");
 
  128        $a_xml_writer->xmlStartTag(
"resprocessing");
 
  129        $a_xml_writer->xmlStartTag(
"outcomes");
 
  130        $a_xml_writer->xmlStartTag(
"decvar");
 
  131        $a_xml_writer->xmlEndTag(
"decvar");
 
  133            "varname" => 
"matches",
 
  136        $a_xml_writer->xmlElement(
"decvar", $attribs, 
null);
 
  137        $a_xml_writer->xmlEndTag(
"outcomes");
 
  139        for ($counter = 1; $counter <= $this->
object->getCorrectAnswers(); $counter++) {
 
  140            $scoregroups = &$this->
object->joinAnswers();
 
  141            foreach ($scoregroups as $points => $scoreanswers) {
 
  145                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  147                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  149                    "respident" => 
"TEXTSUBSET_" . sprintf(
"%02d", $counter)
 
  151                $a_xml_writer->xmlElement(
"varsubset", $attrs, join(
",", $scoreanswers));
 
  152                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  155                    "varname" => 
"matches",
 
  158                $a_xml_writer->xmlElement(
"setvar", $attrs, $points);
 
  161                    "feedbacktype" => 
"Response",
 
  162                    "linkrefid" => 
"Matches_" . sprintf(
"%02d", $counter)
 
  164                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  165                $a_xml_writer->xmlEndTag(
"respcondition");
 
  169        $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
 
  170            $this->object->getId(),
 
  173        $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
 
  174            $this->object->getId(),
 
  177        if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
 
  178            if (strlen($feedback_allcorrect)) {
 
  182                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  184                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  186                    "respident" => 
"points" 
  188                $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->object->getMaximumPoints());
 
  189                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  192                    "feedbacktype" => 
"Response",
 
  193                    "linkrefid" => 
"response_allcorrect" 
  195                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  196                $a_xml_writer->xmlEndTag(
"respcondition");
 
  199            if (strlen($feedback_onenotcorrect)) {
 
  203                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  205                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  206                $a_xml_writer->xmlStartTag(
"not");
 
  209                    "respident" => 
"points" 
  211                $a_xml_writer->xmlElement(
"varsubset", $attrs, $this->object->getMaximumPoints());
 
  213                $a_xml_writer->xmlEndTag(
"not");
 
  214                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  217                    "feedbacktype" => 
"Response",
 
  218                    "linkrefid" => 
"response_onenotcorrect" 
  220                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  221                $a_xml_writer->xmlEndTag(
"respcondition");
 
  225        $a_xml_writer->xmlEndTag(
"resprocessing");
 
  228        for ($counter = 1; $counter <= $this->
object->getCorrectAnswers(); $counter++) {
 
  230                "ident" => 
"Matches_" . sprintf(
"%02d", $counter),
 
  233            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  235            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  236            $a_xml_writer->xmlStartTag(
"material");
 
  237            $a_xml_writer->xmlElement(
"mattext");
 
  238            $a_xml_writer->xmlEndTag(
"material");
 
  239            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  240            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  243        if (strlen($feedback_allcorrect)) {
 
  245                "ident" => 
"response_allcorrect",
 
  248            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  250            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  251            $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
 
  252            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  253            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  255        if (strlen($feedback_onenotcorrect)) {
 
  257                "ident" => 
"response_onenotcorrect",
 
  260            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  262            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  263            $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
 
  264            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  265            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  270        $a_xml_writer->xmlEndTag(
"item");
 
  271        $a_xml_writer->xmlEndTag(
"questestinterop");
 
  273        $xml = $a_xml_writer->xmlDumpMem(
false);
 
  274        if (!$a_include_header) {
 
  275            $pos = strpos(
$xml, 
"?>");
 
An exception for terminatinating execution or to throw for unit testing.
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
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 text subset 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 TEXTSUBSET_QUESTION_IDENTIFIER