24 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assQuestionImport.php";
48 function fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
54 $presentation = $item->getPresentation();
55 $duration = $item->getDuration();
57 $created = sprintf(
"%04d%02d%02d%02d%02d%02d", $now[
'year'], $now[
'mon'], $now[
'mday'], $now[
'hours'], $now[
'minutes'], $now[
'seconds']);
59 $feedbacksgeneric = array();
61 $this->
object->setTitle($item->getTitle());
62 $this->
object->setExternalID($item->getMetadataEntry(
"externalID"));
63 $this->
object->setNrOfTries($item->getMaxattempts());
64 $this->
object->setComment($item->getComment());
65 $this->
object->setAuthor($item->getAuthor());
66 $this->
object->setOwner($ilUser->getId());
67 $this->
object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
68 $this->
object->setObjId($questionpool_id);
69 $this->
object->setEstimatedWorkingTime($duration[
"h"], $duration[
"m"], $duration[
"s"]);
70 $this->
object->setWidth($item->getMetadataEntry(
"width"));
71 $this->
object->setHeight($item->getMetadataEntry(
"height"));
72 $this->
object->setApplet($item->getMetadataEntry(
"applet"));
73 $this->
object->setParameters(unserialize($item->getMetadataEntry(
"params")));
74 $this->
object->setPoints($item->getMetadataEntry(
"points"));
75 $this->
object->saveToDb();
77 $flashapplet =& base64_decode($item->getMetadataEntry(
"swf"));
78 if (!file_exists($this->object->getFlashPath()))
80 include_once
"./Services/Utilities/classes/class.ilUtil.php";
83 $filename = $this->
object->getFlashPath() . $this->
object->getApplet();
93 fwrite($fh, $flashapplet);
100 $questiontext = $this->
object->getQuestion();
101 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
103 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
104 include_once
"./Services/RTE/classes/class.ilRTE.php";
105 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
109 include_once
"./Modules/Test/classes/class.ilObjTest.php";
114 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
119 $questiontext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $questiontext);
120 foreach ($feedbacksgeneric as $correctness => $material)
122 $feedbacksgeneric[$correctness] = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $material);
127 foreach ($feedbacksgeneric as $correctness => $material)
131 $this->
object->saveToDb();
132 if (count($item->suggested_solutions))
134 foreach ($item->suggested_solutions as $suggested_solution)
136 $this->
object->setSuggestedSolution($suggested_solution[
"solution"]->getContent(), $suggested_solution[
"gap_index"],
true);
138 $this->
object->saveToDb();
142 $q_1_id = $this->
object->getId();
143 $question_id = $this->
object->duplicate(
true);
144 $tst_object->questions[$question_counter++] = $question_id;
145 $import_mapping[$item->getIdent()] = array(
"pool" => $q_1_id,
"test" => $question_id);
149 $import_mapping[$item->getIdent()] = array(
"pool" => $this->object->getId(),
"test" => 0);