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->setNrOfTries($item->getMaxattempts());
63 $this->
object->setComment($item->getComment());
64 $this->
object->setAuthor($item->getAuthor());
65 $this->
object->setOwner($ilUser->getId());
66 $this->
object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
67 $this->
object->setObjId($questionpool_id);
68 $this->
object->setEstimatedWorkingTime($duration[
"h"], $duration[
"m"], $duration[
"s"]);
69 $this->
object->setPointsWrong($item->getMetadataEntry(
"points_wrong"));
70 $this->
object->setErrorText($item->getMetadataEntry(
"errortext"));
71 $this->
object->setTextSize($item->getMetadataEntry(
"textsize"));
72 $errordata = unserialize($item->getMetadataEntry(
"errordata"));
73 if (is_array($errordata))
75 foreach ($errordata as
$data)
77 $this->
object->addErrorData($data[1], $data[0], $data[2]);
80 $this->
object->saveToDb();
83 $questiontext = $this->
object->getQuestion();
84 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
86 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
87 include_once
"./Services/RTE/classes/class.ilRTE.php";
88 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
99 $GLOBALS[
'ilLog']->write(__METHOD__.
': import mob from dir: '. $importfile);
103 $questiontext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $questiontext);
107 $this->
object->saveToDb();
108 if (count($item->suggested_solutions))
110 foreach ($item->suggested_solutions as $suggested_solution)
112 $this->
object->setSuggestedSolution($suggested_solution[
"solution"]->getContent(), $suggested_solution[
"gap_index"],
true);
114 $this->
object->saveToDb();
118 $q_1_id = $this->
object->getId();
119 $question_id = $this->
object->duplicate(
true, null, null, null, $tst_id);
120 $tst_object->questions[$question_counter++] = $question_id;
121 $import_mapping[$item->getIdent()] = array(
"pool" => $q_1_id,
"test" => $question_id);
125 $import_mapping[$item->getIdent()] = array(
"pool" => $this->object->getId(),
"test" => 0);