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'];
 
   30        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
   34        $a_xml_writer->xmlStartTag(
"questestinterop");
 
   36            "ident" => 
"il_" . IL_INST_ID . 
"_qst_" . $this->object->getId(),
 
   37            "title" => $this->object->getTitle(),
 
   38            "maxattempts" => $this->object->getNrOfTries()
 
   40        $a_xml_writer->xmlStartTag(
"item", $attrs);
 
   42        $a_xml_writer->xmlElement(
"qticomment", 
null, $this->object->getComment());
 
   44        $workingtime = $this->
object->getEstimatedWorkingTime();
 
   45        $duration = sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
 
   46        $a_xml_writer->xmlElement(
"duration", 
null, $duration);
 
   48        $a_xml_writer->xmlStartTag(
"itemmetadata");
 
   49        $a_xml_writer->xmlStartTag(
"qtimetadata");
 
   50        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   51        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ILIAS_VERSION");
 
   52        $a_xml_writer->xmlElement(
"fieldentry", 
null, $ilias->getSetting(
"ilias_version"));
 
   53        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   54        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   55        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"QUESTIONTYPE");
 
   57        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   58        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   59        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"AUTHOR");
 
   60        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getAuthor());
 
   61        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   67        $a_xml_writer->xmlEndTag(
"qtimetadata");
 
   68        $a_xml_writer->xmlEndTag(
"itemmetadata");
 
   72            "label" => $this->object->getTitle()
 
   74        $a_xml_writer->xmlStartTag(
"presentation", $attrs);
 
   76        $a_xml_writer->xmlStartTag(
"flow");
 
   78        $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
 
   79        $solution = $this->
object->getSuggestedSolution(0);
 
   80        if (count($solution)) {
 
   81            if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
 
   82                $a_xml_writer->xmlStartTag(
"material");
 
   83                $intlink = 
"il_" . IL_INST_ID . 
"_" . $matches[2] . 
"_" . $matches[3];
 
   84                if (strcmp($matches[1], 
"") != 0) {
 
   85                    $intlink = $solution[
"internal_link"];
 
   88                    "label" => 
"suggested_solution" 
   90                $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
 
   91                $a_xml_writer->xmlEndTag(
"material");
 
   95        $a_xml_writer->xmlStartTag(
"material");
 
   97            "label" => 
"applet data",
 
   98            "uri" => $this->object->getJavaAppletFilename(),
 
   99            "height" => $this->object->getJavaHeight(),
 
  100            "width" => $this->object->getJavaWidth(),
 
  101            "embedded" => 
"base64" 
  103        $javapath = $this->
object->getJavaPath() . $this->
object->getJavaAppletFilename();
 
  104        $fh = @fopen($javapath, 
"rb");
 
  108        $javafile = fread($fh, filesize($javapath));
 
  110        $base64 = base64_encode($javafile);
 
  111        $a_xml_writer->xmlElement(
"matapplet", $attrs, $base64);
 
  113        if ($this->object->buildParamsOnly()) {
 
  114            if ($this->object->getJavaCode()) {
 
  116                    "label" => 
"java_code" 
  118                $a_xml_writer->xmlElement(
"mattext", $attrs, $this->object->getJavaCode());
 
  120            if ($this->object->getJavaCodebase()) {
 
  122                    "label" => 
"java_codebase" 
  124                $a_xml_writer->xmlElement(
"mattext", $attrs, $this->object->getJavaCodebase());
 
  126            if ($this->object->getJavaArchive()) {
 
  128                    "label" => 
"java_archive" 
  130                $a_xml_writer->xmlElement(
"mattext", $attrs, $this->object->getJavaArchive());
 
  132            for (
$i = 0; 
$i < $this->
object->getParameterCount(); 
$i++) {
 
  133                $param = $this->
object->getParameter(
$i);
 
  135                    "label" => $param[
"name"]
 
  137                $a_xml_writer->xmlElement(
"mattext", $attrs, $param[
"value"]);
 
  140        $a_xml_writer->xmlEndTag(
"material");
 
  141        $a_xml_writer->xmlStartTag(
"material");
 
  145        $a_xml_writer->xmlElement(
"mattext", $attrs, $this->object->getPoints());
 
  146        $a_xml_writer->xmlEndTag(
"material");
 
  148        $a_xml_writer->xmlEndTag(
"flow");
 
  149        $a_xml_writer->xmlEndTag(
"presentation");
 
  152        $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
 
  153            $this->object->getId(),
 
  156        $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
 
  157            $this->object->getId(),
 
  160        if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
 
  161            $a_xml_writer->xmlStartTag(
"resprocessing");
 
  162            $a_xml_writer->xmlStartTag(
"outcomes");
 
  163            $a_xml_writer->xmlStartTag(
"decvar");
 
  164            $a_xml_writer->xmlEndTag(
"decvar");
 
  165            $a_xml_writer->xmlEndTag(
"outcomes");
 
  167            if (strlen($feedback_allcorrect)) {
 
  171                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  173                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  175                    "respident" => 
"points" 
  177                $a_xml_writer->xmlElement(
"varequal", $attrs, $this->object->getPoints());
 
  178                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  181                    "feedbacktype" => 
"Response",
 
  182                    "linkrefid" => 
"response_allcorrect" 
  184                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  185                $a_xml_writer->xmlEndTag(
"respcondition");
 
  188            if (strlen($feedback_onenotcorrect)) {
 
  192                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  194                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  195                $a_xml_writer->xmlStartTag(
"not");
 
  197                    "respident" => 
"points" 
  199                $a_xml_writer->xmlElement(
"varequal", $attrs, $this->object->getPoints());
 
  200                $a_xml_writer->xmlEndTag(
"not");
 
  201                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  204                    "feedbacktype" => 
"Response",
 
  205                    "linkrefid" => 
"response_onenotcorrect" 
  207                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  208                $a_xml_writer->xmlEndTag(
"respcondition");
 
  210            $a_xml_writer->xmlEndTag(
"resprocessing");
 
  213        if (strlen($feedback_allcorrect)) {
 
  215                "ident" => 
"response_allcorrect",
 
  218            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  220            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  221            $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
 
  222            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  223            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  225        if (strlen($feedback_onenotcorrect)) {
 
  227                "ident" => 
"response_onenotcorrect",
 
  230            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  232            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  233            $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
 
  234            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  235            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  238        $a_xml_writer->xmlEndTag(
"item");
 
  239        $a_xml_writer->xmlEndTag(
"questestinterop");
 
  240        $xml = $a_xml_writer->xmlDumpMem(
false);
 
  241        if (!$a_include_header) {
 
  242            $pos = strpos(
$xml, 
"?>");
 
An exception for terminatinating execution or to throw for unit testing.
Class for java applet 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.
Class for question exports.
addGeneralMetadata(ilXmlWriter $xmlwriter)
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
xmlHeader()
Writes xml header @access public.
const JAVAAPPLET_QUESTION_IDENTIFIER