24 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assQuestionImport.php";
50 function fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
56 $presentation = $item->getPresentation();
57 $duration = $item->getDuration();
59 $created = sprintf(
"%04d%02d%02d%02d%02d%02d", $now[
'year'], $now[
'mon'], $now[
'mday'], $now[
'hours'], $now[
'minutes'], $now[
'seconds']);
61 $feedbacksgeneric = array();
63 $this->
object->setTitle($item->getTitle());
64 $this->
object->setNrOfTries($item->getMaxattempts());
65 $this->
object->setComment($item->getComment());
66 $this->
object->setAuthor($item->getAuthor());
67 $this->
object->setOwner($ilUser->getId());
68 $this->
object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
69 $this->
object->setObjId($questionpool_id);
70 $this->
object->setEstimatedWorkingTime($duration[
"h"], $duration[
"m"], $duration[
"s"]);
71 $this->
object->setPoints($item->getMetadataEntry(
"points"));
72 $this->
object->setOrderText($item->getMetadataEntry(
"ordertext"));
73 $this->
object->setTextSize($item->getMetadataEntry(
"textsize"));
74 $this->
object->setSeparator($item->getMetadataEntry(
"separator"));
75 $this->
object->saveToDb();
78 $questiontext = $this->
object->getQuestion();
79 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
81 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
82 include_once
"./Services/RTE/classes/class.ilRTE.php";
83 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
94 $GLOBALS[
'ilLog']->write(__METHOD__.
': import mob from dir: '. $importfile);
98 $questiontext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $questiontext);
102 $this->
object->saveToDb();
103 if (count($item->suggested_solutions))
105 foreach ($item->suggested_solutions as $suggested_solution)
107 $this->
object->setSuggestedSolution($suggested_solution[
"solution"]->getContent(), $suggested_solution[
"gap_index"],
true);
109 $this->
object->saveToDb();
113 $q_1_id = $this->
object->getId();
114 $question_id = $this->
object->duplicate(
true, null, null, null, $tst_id);
115 $tst_object->questions[$question_counter++] = $question_id;
116 $import_mapping[$item->getIdent()] = array(
"pool" => $q_1_id,
"test" => $question_id);
120 $import_mapping[$item->getIdent()] = array(
"pool" => $this->object->getId(),
"test" => 0);