31 string $importdirectory,
37 int &$question_counter,
45 $created = sprintf(
"%04d%02d%02d%02d%02d%02d", $now[
'year'], $now[
'mon'], $now[
'mday'], $now[
'hours'], $now[
'minutes'], $now[
'seconds']);
48 $this->
object->setTitle($item->
getTitle());
50 $this->
object->setComment($item->
getComment());
51 $this->
object->setAuthor($item->
getAuthor());
52 $this->
object->setOwner($user_id);
54 $this->
object->setObjId($questionpool_id);
60 $this->
object->setAdditionalContentEditingMode(
63 $this->
object->saveToDb();
69 $questiontext = $this->
object->getQuestion();
72 $importfile = $importdirectory . DIRECTORY_SEPARATOR . $mob[
"uri"];
75 $DIC[
'ilLog']->write(__METHOD__ .
': import mob from dir: ' . $importfile);
79 $questiontext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" .
IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $questiontext);
81 foreach ($feedbacks as $ident => $material) {
82 $feedbacks[$ident] = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" .
IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $material);
84 foreach ($feedbacksgeneric as $correctness => $material) {
85 $feedbacksgeneric[$correctness] = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" .
IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $material);
91 foreach ($feedbacks as $ident => $material) {
94 $this->
object->feedbackOBJ->importSpecificAnswerFeedback(
101 foreach ($feedbacksgeneric as $correctness => $material) {
102 $this->
object->feedbackOBJ->importGenericFeedback(
108 $this->
object->saveToDb();
111 $q_1_id = $this->
object->getId();
112 $question_id = $this->
object->duplicate(
true,
"",
"", -1, $tst_id);
113 $tst_object->questions[$question_counter++] = $question_id;
114 $import_mapping[$item->
getIdent()] = [
"pool" => $q_1_id,
"test" => $question_id];
116 $import_mapping[$item->
getIdent()] = [
"pool" => $this->
object->getId(),
"test" => 0];
118 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)
getFeedbackAnswerSpecific(ilQTIItem $item, $prefix='response_')
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_...
getFeedbackGeneric($item)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importSuggestedSolutions(int $question_id, array $solution_from_import)
Class for question imports.
static clear(string $a_var)
fetchIndexFromFeedbackIdent($feedbackIdent, $prefix='response_')
fromXML(string $importdirectory, int $user_id, ilQTIItem $item, int $questionpool_id, ?int $tst_id, ?ilObject &$tst_object, int &$question_counter, array $import_mapping)