28 string $importdirectory,
34 int &$question_counter,
41 $this->
object->setTitle($item->
getTitle());
43 $this->
object->setComment($item->
getComment());
44 $this->
object->setAuthor($item->
getAuthor());
45 $this->
object->setOwner($user_id);
47 $this->
object->setObjId($questionpool_id);
50 $this->
object->setAllowedExtensions($item->
getMetadataEntry(
"allowedextensions") ??
'');
52 $this->
object->setAdditionalContentEditingMode(
55 $this->
object->saveToDb();
60 $questiontext = $this->
object->getQuestion();
63 $importfile = $importdirectory . DIRECTORY_SEPARATOR . $mob[
"uri"];
66 $DIC[
'ilLog']->write(__METHOD__ .
': import mob from dir: ' . $importfile);
70 $questiontext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" .
IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $questiontext);
71 foreach ($feedbacksgeneric as $correctness => $material) {
72 $feedbacksgeneric[$correctness] = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" .
IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $material);
77 foreach ($feedbacksgeneric as $correctness => $material) {
78 $this->
object->feedbackOBJ->importGenericFeedback(
84 $this->
object->saveToDb();
87 $q_1_id = $this->
object->getId();
88 $question_id = $this->
object->duplicate(
true,
"",
"", -1, $tst_id);
89 $tst_object->questions[$question_counter++] = $question_id;
90 $import_mapping[$item->
getIdent()] = [
"pool" => $q_1_id,
"test" => $question_id];
92 $import_mapping[$item->
getIdent()] = [
"pool" => $this->
object->getId(),
"test" => 0];
94 return $import_mapping;
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static get(string $a_var)
addGeneralMetadata(ilQTIItem $item)
QTIMaterialToString(ilQTIMaterial $a_material)
Reads an QTI material tag and creates a text or XHTML string.
getMetadataEntry(string $a_label)
fetchAdditionalContentEditingModeInformation($qtiItem)
fetches the "additional content editing mode" information from qti item and falls back to ADDITIONAL_...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getFeedbackGeneric($item)
fromXML(string $importdirectory, int $user_id, ilQTIItem $item, int $questionpool_id, ?int $tst_id, ?ilObject &$tst_object, int &$question_counter, array $import_mapping)
importSuggestedSolutions(int $question_id, array $solution_from_import)
Class for question imports.
static clear(string $a_var)