4 include_once(
"./Services/Export/classes/class.ilXmlImporter.php");
26 parent::__construct();
29 $this->log = $DIC[
"ilLog"];
50 include_once(
"./Modules/Survey/classes/class.ilSurveyDataSet.php");
52 $this->ds->setDSPrefix(
"ds");
53 $this->ds->setImport($this);
68 self::$survey = $a_val;
89 if ($a_entity ==
"svy") {
91 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_id)) {
93 #$newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(),'/'))); 95 $new_id = $a_mapping->getMapping(
"Modules/Survey",
"svy", 0);
100 include_once
"./Services/Survey/classes/class.SurveyImportParser.php";
104 if (!@file_exists($xml_file)) {
105 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $xml_file);
112 $import->setSurveyObject($newObj);
113 $import->startParsing();
115 $this->svy_log->debug(
"is array import_mob_xml: -" . is_array(
$_SESSION[
"import_mob_xhtml"]) .
"-");
118 if (is_array(
$_SESSION[
"import_mob_xhtml"])) {
119 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
120 include_once
"./Services/RTE/classes/class.ilRTE.php";
121 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
122 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob) {
123 $this->svy_log->debug(
"import mob xhtml, type: " . $mob[
"type"] .
", id: " . $mob[
"mob"]);
126 $mob[
"type"] =
"svy:html";
129 $importfile = dirname($xml_file) .
"/" . $mob[
"uri"];
130 $this->svy_log->debug(
"import file: " . $importfile);
132 if (file_exists($importfile)) {
136 if ($mob[
"type"] ==
"svy:html") {
138 $this->svy_log->debug(
"old introduction: " . $newObj->getIntroduction());
139 $newObj->setIntroduction(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $newObj->getIntroduction()));
140 $newObj->setOutro(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $newObj->getOutro()));
142 $this->svy_log->debug(
"new introduction: " . $newObj->getIntroduction());
143 } elseif ($import->questions[$mob[
"id"]]) {
144 $new_qid = $import->questions[$mob[
"id"]];
147 $qtext = $new_question->getQuestiontext();
149 $this->svy_log->debug(
"old question text: " . $qtext);
152 $qtext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $qtext);
154 $new_question->setQuestiontext($qtext);
155 $new_question->saveToDb();
157 $this->svy_log->debug(
"new question text: " . $qtext);
160 if ($new_question->getOriginalId()) {
162 $pool_question->setQuestiontext($qtext);
163 $pool_question->saveToDb();
167 $this->svy_log->error(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
175 $a_mapping->addMapping(
"Modules/Survey",
"svy", $a_id, $newObj->getId());
177 include_once(
"./Services/DataSet/classes/class.ilDataSetImportParser.php");
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).
__construct()
Constructor.
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.
getConfig()
Get the Config.
static getLogger($a_component_id)
Get component logger.