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();
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);
50 $this->
object->setWidth($item->getMetadataEntry(
"width"));
51 $this->
object->setHeight($item->getMetadataEntry(
"height"));
52 $this->
object->setApplet($item->getMetadataEntry(
"applet"));
53 $this->
object->setParameters(unserialize($item->getMetadataEntry(
"params")));
54 $this->
object->setPoints($item->getMetadataEntry(
"points"));
56 $this->
object->setAdditionalContentEditingMode(
59 $this->
object->saveToDb();
61 $flashapplet =& base64_decode($item->getMetadataEntry(
"swf"));
62 if (!file_exists($this->
object->getFlashPath()))
64 include_once
"./Services/Utilities/classes/class.ilUtil.php";
67 $filename = $this->
object->getFlashPath() . $this->
object->getApplet();
68 $fh = fopen($filename,
"wb");
77 fwrite(
$fh, $flashapplet);
84 $questiontext = $this->
object->getQuestion();
85 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
87 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
88 include_once
"./Services/RTE/classes/class.ilRTE.php";
89 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
100 $GLOBALS[
'ilLog']->write(__METHOD__.
': import mob from dir: '. $importfile);
104 $questiontext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $questiontext);
105 foreach ($feedbacksgeneric as $correctness => $material)
107 $feedbacksgeneric[$correctness] = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $material);
112 foreach ($feedbacksgeneric as $correctness => $material)
114 $this->
object->feedbackOBJ->importGenericFeedback(
118 $this->
object->saveToDb();
119 if (count($item->suggested_solutions))
121 foreach ($item->suggested_solutions as $suggested_solution)
123 $this->
object->setSuggestedSolution($suggested_solution[
"solution"]->getContent(), $suggested_solution[
"gap_index"],
true);
125 $this->
object->saveToDb();
129 $q_1_id = $this->
object->getId();
130 $question_id = $this->
object->duplicate(
true, null, null, null, $tst_id);
131 $tst_object->questions[$question_counter++] = $question_id;
132 $import_mapping[$item->getIdent()] =
array(
"pool" => $q_1_id,
"test" => $question_id);
136 $import_mapping[$item->getIdent()] =
array(
"pool" => $this->
object->getId(),
"test" => 0);
static makeDirParents($a_dir)
Create a new directory and all parent directories.
addGeneralMetadata(ilQTIItem $item)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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...
fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
Creates a question from a QTI file.
getFeedbackGeneric($item)
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
Class for flash question imports.
getTstImportArchivDirectory()
returns the full path to extracted tst import archiv (tst import dir + tst archiv subdir) ...
Class for question imports.