4 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assQuestionImport.php";
28 function fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
34 $presentation = $item->getPresentation();
35 $duration = $item->getDuration();
37 $created = sprintf(
"%04d%02d%02d%02d%02d%02d", $now[
'year'], $now[
'mon'], $now[
'mday'], $now[
'hours'], $now[
'minutes'], $now[
'seconds']);
39 $feedbacksgeneric = array();
42 $this->
object->setTitle($item->getTitle());
43 $this->
object->setNrOfTries($item->getMaxattempts());
44 $this->
object->setComment($item->getComment());
45 $this->
object->setAuthor($item->getAuthor());
46 $this->
object->setOwner($ilUser->getId());
47 $this->
object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
48 $this->
object->setObjId($questionpool_id);
49 $this->
object->setEstimatedWorkingTime($duration[
"h"], $duration[
"m"], $duration[
"s"]);
50 $this->
object->setPointsWrong($item->getMetadataEntry(
"points_wrong"));
51 $this->
object->setErrorText($item->getMetadataEntry(
"errortext"));
52 $this->
object->setTextSize($item->getMetadataEntry(
"textsize"));
53 $errordata = unserialize($item->getMetadataEntry(
"errordata"));
54 if (is_array($errordata))
56 foreach ($errordata as
$data)
58 $this->
object->addErrorData($data[1], $data[0], $data[2]);
62 $this->
object->setAdditionalContentEditingMode(
65 $this->
object->saveToDb();
71 $questiontext = $this->
object->getQuestion();
72 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
74 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
75 include_once
"./Services/RTE/classes/class.ilRTE.php";
76 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
87 $GLOBALS[
'ilLog']->write(__METHOD__.
': import mob from dir: '. $importfile);
91 $questiontext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $questiontext);
92 foreach ($feedbacks as $ident => $material)
94 $feedbacks[$ident] = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $material);
96 foreach ($feedbacksgeneric as $correctness => $material)
98 $feedbacksgeneric[$correctness] = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $material);
104 foreach ($feedbacks as $ident => $material)
106 $this->
object->feedbackOBJ->importSpecificAnswerFeedback(
110 foreach ($feedbacksgeneric as $correctness => $material)
112 $this->
object->feedbackOBJ->importGenericFeedback(
117 $this->
object->saveToDb();
118 if (count($item->suggested_solutions))
120 foreach ($item->suggested_solutions as $suggested_solution)
122 $this->
object->setSuggestedSolution($suggested_solution[
"solution"]->getContent(), $suggested_solution[
"gap_index"],
true);
124 $this->
object->saveToDb();
128 $q_1_id = $this->
object->getId();
129 $question_id = $this->
object->duplicate(
true, null, null, null, $tst_id);
130 $tst_object->questions[$question_counter++] = $question_id;
131 $import_mapping[$item->getIdent()] = array(
"pool" => $q_1_id,
"test" => $question_id);
135 $import_mapping[$item->getIdent()] = array(
"pool" => $this->object->getId(),
"test" => 0);
addGeneralMetadata(ilQTIItem $item)
fetchAdditionalContentEditingModeInformation($qtiItem)
fetches the "additional content editing mode" information from qti item and falls back to ADDITIONAL_...
getQplImportArchivDirectory()
returns the full path to extracted qpl import archiv (qpl import dir + qpl archiv subdir) ...
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
getFeedbackAnswerSpecific(ilQTIItem $item)
fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
Creates a question from a QTI file.
getFeedbackGeneric($item)
getTstImportArchivDirectory()
returns the full path to extracted tst import archiv (tst import dir + tst archiv subdir) ...
Class for question imports.
Class for error text question imports.