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        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
   33        $a_xml_writer->xmlStartTag(
"questestinterop");
 
   35            "ident" => 
"il_" . IL_INST_ID . 
"_qst_" . $this->object->getId(),
 
   36            "title" => $this->object->getTitle(),
 
   37            "maxattempts" => $this->object->getNrOfTries()
 
   39        $a_xml_writer->xmlStartTag(
"item", $attrs);
 
   41        $a_xml_writer->xmlElement(
"qticomment", 
null, $this->object->getComment());
 
   43        $workingtime = $this->
object->getEstimatedWorkingTime();
 
   44        $duration = 
sprintf(
"P0Y0M0DT%dH%dM%dS", $workingtime[
"h"], $workingtime[
"m"], $workingtime[
"s"]);
 
   45        $a_xml_writer->xmlElement(
"duration", 
null, $duration);
 
   47        $a_xml_writer->xmlStartTag(
"itemmetadata");
 
   48        $a_xml_writer->xmlStartTag(
"qtimetadata");
 
   49        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   50        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ILIAS_VERSION");
 
   51        $a_xml_writer->xmlElement(
"fieldentry", 
null, $ilias->getSetting(
"ilias_version"));
 
   52        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   53        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   54        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"QUESTIONTYPE");
 
   56        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   57        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
   58        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"AUTHOR");
 
   59        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->object->getAuthor());
 
   60        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
   66        $a_xml_writer->xmlEndTag(
"qtimetadata");
 
   67        $a_xml_writer->xmlEndTag(
"itemmetadata");
 
   71            "label" => $this->object->getTitle()
 
   73        $a_xml_writer->xmlStartTag(
"presentation", $attrs);
 
   75        $a_xml_writer->xmlStartTag(
"flow");
 
   77        $this->
object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
 
   78        $solution = $this->
object->getSuggestedSolution(0);
 
   79        if (count($solution)) {
 
   80            if (preg_match(
"/il_(\d*?)_(\w+)_(\d+)/", $solution[
"internal_link"], $matches)) {
 
   81                $a_xml_writer->xmlStartTag(
"material");
 
   82                $intlink = 
"il_" . IL_INST_ID . 
"_" . $matches[2] . 
"_" . $matches[3];
 
   83                if (strcmp($matches[1], 
"") != 0) {
 
   84                    $intlink = $solution[
"internal_link"];
 
   87                    "label" => 
"suggested_solution" 
   89                $a_xml_writer->xmlElement(
"mattext", $attrs, $intlink);
 
   90                $a_xml_writer->xmlEndTag(
"material");
 
   94        $a_xml_writer->xmlStartTag(
"material");
 
   96            "label" => 
"applet data",
 
   97            "uri" => $this->object->getJavaAppletFilename(),
 
   98            "height" => $this->object->getJavaHeight(),
 
   99            "width" => $this->object->getJavaWidth(),
 
  100            "embedded" => 
"base64" 
  102        $javapath = $this->
object->getJavaPath() . $this->
object->getJavaAppletFilename();
 
  103        $fh = @fopen($javapath, 
"rb");
 
  107        $javafile = fread(
$fh, filesize($javapath));
 
  109        $base64 = base64_encode($javafile);
 
  110        $a_xml_writer->xmlElement(
"matapplet", $attrs, $base64);
 
  112        if ($this->object->buildParamsOnly()) {
 
  113            if ($this->object->getJavaCode()) {
 
  115                    "label" => 
"java_code" 
  117                $a_xml_writer->xmlElement(
"mattext", $attrs, $this->object->getJavaCode());
 
  119            if ($this->object->getJavaCodebase()) {
 
  121                    "label" => 
"java_codebase" 
  123                $a_xml_writer->xmlElement(
"mattext", $attrs, $this->object->getJavaCodebase());
 
  125            if ($this->object->getJavaArchive()) {
 
  127                    "label" => 
"java_archive" 
  129                $a_xml_writer->xmlElement(
"mattext", $attrs, $this->object->getJavaArchive());
 
  131            for (
$i = 0; 
$i < $this->
object->getParameterCount(); 
$i++) {
 
  132                $param = $this->
object->getParameter(
$i);
 
  134                    "label" => $param[
"name"]
 
  136                $a_xml_writer->xmlElement(
"mattext", $attrs, $param[
"value"]);
 
  139        $a_xml_writer->xmlEndTag(
"material");
 
  140        $a_xml_writer->xmlStartTag(
"material");
 
  144        $a_xml_writer->xmlElement(
"mattext", $attrs, $this->object->getPoints());
 
  145        $a_xml_writer->xmlEndTag(
"material");
 
  147        $a_xml_writer->xmlEndTag(
"flow");
 
  148        $a_xml_writer->xmlEndTag(
"presentation");
 
  151        $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
 
  152            $this->object->getId(),
 
  155        $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
 
  156            $this->object->getId(),
 
  159        if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
 
  160            $a_xml_writer->xmlStartTag(
"resprocessing");
 
  161            $a_xml_writer->xmlStartTag(
"outcomes");
 
  162            $a_xml_writer->xmlStartTag(
"decvar");
 
  163            $a_xml_writer->xmlEndTag(
"decvar");
 
  164            $a_xml_writer->xmlEndTag(
"outcomes");
 
  166            if (strlen($feedback_allcorrect)) {
 
  170                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  172                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  174                    "respident" => 
"points" 
  176                $a_xml_writer->xmlElement(
"varequal", $attrs, $this->object->getPoints());
 
  177                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  180                    "feedbacktype" => 
"Response",
 
  181                    "linkrefid" => 
"response_allcorrect" 
  183                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  184                $a_xml_writer->xmlEndTag(
"respcondition");
 
  187            if (strlen($feedback_onenotcorrect)) {
 
  191                $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
 
  193                $a_xml_writer->xmlStartTag(
"conditionvar");
 
  194                $a_xml_writer->xmlStartTag(
"not");
 
  196                    "respident" => 
"points" 
  198                $a_xml_writer->xmlElement(
"varequal", $attrs, $this->object->getPoints());
 
  199                $a_xml_writer->xmlEndTag(
"not");
 
  200                $a_xml_writer->xmlEndTag(
"conditionvar");
 
  203                    "feedbacktype" => 
"Response",
 
  204                    "linkrefid" => 
"response_onenotcorrect" 
  206                $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
 
  207                $a_xml_writer->xmlEndTag(
"respcondition");
 
  209            $a_xml_writer->xmlEndTag(
"resprocessing");
 
  212        if (strlen($feedback_allcorrect)) {
 
  214                "ident" => 
"response_allcorrect",
 
  217            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  219            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  220            $this->
object->addQTIMaterial($a_xml_writer, $feedback_allcorrect);
 
  221            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  222            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  224        if (strlen($feedback_onenotcorrect)) {
 
  226                "ident" => 
"response_onenotcorrect",
 
  229            $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
 
  231            $a_xml_writer->xmlStartTag(
"flow_mat");
 
  232            $this->
object->addQTIMaterial($a_xml_writer, $feedback_onenotcorrect);
 
  233            $a_xml_writer->xmlEndTag(
"flow_mat");
 
  234            $a_xml_writer->xmlEndTag(
"itemfeedback");
 
  237        $a_xml_writer->xmlEndTag(
"item");
 
  238        $a_xml_writer->xmlEndTag(
"questestinterop");
 
  239        $xml = $a_xml_writer->xmlDumpMem(
false);
 
  240        if (!$a_include_header) {
 
  241            $pos = strpos(
$xml, 
"?>");
 
sprintf('%.4f', $callTime)
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