26 $this->log = $DIC[
"ilLog"];
48 $this->ds->setDSPrefix(
"ds");
49 $this->ds->setImport($this);
64 self::$survey = $a_val;
91 if ($a_entity ==
"svy") {
93 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_id)) {
95 #$newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(),'/'))); 97 $new_id = $a_mapping->getMapping(
"Modules/Survey",
"svy", 0);
105 if (!@file_exists($xml_file)) {
106 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $xml_file);
109 $GLOBALS[
'ilLog']->write(
"getQuestionPoolID = " . $this->
getImport()->getConfig(
"Modules/Survey")->getQuestionPoolID());
111 $import =
new SurveyImportParser($this->
getImport()->getConfig(
"Modules/Survey")->getQuestionPoolID(), $xml_file,
true, $a_mapping);
113 $import->setSurveyObject($newObj);
114 $import->startParsing();
116 $this->svy_log->debug(
"is array import_mob_xml: -" . is_array(
$_SESSION[
"import_mob_xhtml"]) .
"-");
119 if (is_array(
$_SESSION[
"import_mob_xhtml"])) {
120 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob) {
121 $this->svy_log->debug(
"import mob xhtml, type: " . $mob[
"type"] .
", id: " . $mob[
"mob"]);
124 $mob[
"type"] =
"svy:html";
127 $importfile = dirname($xml_file) .
"/" . $mob[
"uri"];
128 $this->svy_log->debug(
"import file: " . $importfile);
130 if (file_exists($importfile)) {
134 if ($mob[
"type"] ==
"svy:html") {
136 $this->svy_log->debug(
"old introduction: " . $newObj->getIntroduction());
137 $newObj->setIntroduction(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" .
IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $newObj->getIntroduction()));
138 $newObj->setOutro(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" .
IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $newObj->getOutro()));
140 $this->svy_log->debug(
"new introduction: " . $newObj->getIntroduction());
141 } elseif ($import->questions[$mob[
"id"]]) {
142 $new_qid = $import->questions[$mob[
"id"]];
145 $qtext = $new_question->getQuestiontext();
147 $this->svy_log->debug(
"old question text: " . $qtext);
150 $qtext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" .
IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $qtext);
152 $new_question->setQuestiontext($qtext);
153 $new_question->saveToDb();
155 $this->svy_log->debug(
"new question text: " . $qtext);
158 if ($new_question->getOriginalId()) {
160 $pool_question->setQuestiontext($qtext);
161 $pool_question->saveToDb();
165 $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", (
int) $a_id, (
int) $newObj->getId());
173 return $newObj->getId();
getSchemaVersion()
Get schema version.
getImportDirectory()
Get import directory.
Importer class for files.
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.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
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
__construct(Container $dic, ilPlugin $plugin)
static getLogger($a_component_id)
Get component logger.