4 include_once(
"./Services/Export/classes/class.ilXmlImporter.php");
33 include_once(
"./Modules/Survey/classes/class.ilSurveyDataSet.php");
35 $this->ds->setDSPrefix(
"ds");
36 $this->ds->setImport($this);
51 self::$survey = $a_val;
72 if ($a_entity ==
"svy")
75 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_id))
78 #$newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(),'/'))); 81 $new_id = $a_mapping->getMapping(
"Modules/Survey",
"svy", 0);
86 include_once
"./Services/Survey/classes/class.SurveyImportParser.php";
90 if (!@file_exists($xml_file))
92 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $xml_file);
95 $GLOBALS[
'ilLog']->write(
"getQuestionPoolID = ".$this->
getImport()->getConfig(
"Modules/Survey")->getQuestionPoolID());
97 $import =
new SurveyImportParser($this->
getImport()->getConfig(
"Modules/Survey")->getQuestionPoolID(), $xml_file,
true, $a_mapping);
99 $import->setSurveyObject($newObj);
100 $import->startParsing();
102 $this->svy_log->debug(
"is array import_mob_xml: -".is_array(
$_SESSION[
"import_mob_xhtml"]).
"-");
105 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
107 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
108 include_once
"./Services/RTE/classes/class.ilRTE.php";
109 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
110 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
112 $this->svy_log->debug(
"import mob xhtml, type: ".$mob[
"type"].
", id: ".$mob[
"mob"]);
116 $mob[
"type"] =
"svy:html";
119 $importfile = dirname($xml_file) .
"/" . $mob[
"uri"];
120 $this->svy_log->debug(
"import file: ".$importfile);
122 if (file_exists($importfile))
127 if ($mob[
"type"] ==
"svy:html")
130 $this->svy_log->debug(
"old introduction: ".$newObj->getIntroduction());
131 $newObj->setIntroduction(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $newObj->getIntroduction()));
132 $newObj->setOutro(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $newObj->getOutro()));
134 $this->svy_log->debug(
"new introduction: ".$newObj->getIntroduction());
136 else if($import->questions[$mob[
"id"]])
138 $new_qid = $import->questions[$mob[
"id"]];
141 $qtext = $new_question->getQuestiontext();
143 $this->svy_log->debug(
"old question text: ".$qtext);
146 $qtext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $qtext);
148 $new_question->setQuestiontext($qtext);
149 $new_question->saveToDb();
151 $this->svy_log->debug(
"new question text: ".$qtext);
154 if($new_question->getOriginalId())
157 $pool_question->setQuestiontext($qtext);
158 $pool_question->saveToDb();
164 $this->svy_log->error(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
172 $a_mapping->addMapping(
"Modules/Survey",
"svy", $a_id, $newObj->getId());
176 include_once(
"./Services/DataSet/classes/class.ilDataSetImportParser.php");
178 $a_xml, $this->ds, $a_mapping);
192 $GLOBALS[
'ilLog']->write(__METHOD__.
': '.$this->getImportDirectory());
getSchemaVersion()
Get schema version.
getImportDirectory()
Get import directory.
Importer class for files.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getSurvey()
Get current survey object.
Survey Question Import Parser.
Manifest parser for ILIAS standard export files.
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...
setSurvey(ilObjSurvey $a_val)
Set current survey object (being imported).
parseXmlFileNames()
Create qti and xml file name.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
static getLogger($a_component_id)
Get component logger.