4include_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;
95 if ($a_entity ==
"svy") {
97 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_id)) {
99 #$newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(),'/')));
101 $new_id = $a_mapping->getMapping(
"Modules/Survey",
"svy", 0);
106 include_once
"./Services/Survey/classes/class.SurveyImportParser.php";
110 if (!@file_exists($xml_file)) {
111 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $xml_file);
118 $import->setSurveyObject($newObj);
119 $import->startParsing();
121 $this->svy_log->debug(
"is array import_mob_xml: -" . is_array(
$_SESSION[
"import_mob_xhtml"]) .
"-");
124 if (is_array(
$_SESSION[
"import_mob_xhtml"])) {
125 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
126 include_once
"./Services/RTE/classes/class.ilRTE.php";
127 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
128 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob) {
129 $this->svy_log->debug(
"import mob xhtml, type: " . $mob[
"type"] .
", id: " . $mob[
"mob"]);
132 $mob[
"type"] =
"svy:html";
135 $importfile = dirname($xml_file) .
"/" . $mob[
"uri"];
136 $this->svy_log->debug(
"import file: " . $importfile);
138 if (file_exists($importfile)) {
142 if ($mob[
"type"] ==
"svy:html") {
144 $this->svy_log->debug(
"old introduction: " . $newObj->getIntroduction());
145 $newObj->setIntroduction(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $newObj->getIntroduction()));
146 $newObj->setOutro(str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $newObj->getOutro()));
148 $this->svy_log->debug(
"new introduction: " . $newObj->getIntroduction());
149 } elseif ($import->questions[$mob[
"id"]]) {
150 $new_qid = $import->questions[$mob[
"id"]];
153 $qtext = $new_question->getQuestiontext();
155 $this->svy_log->debug(
"old question text: " . $qtext);
158 $qtext = str_replace(
"src=\"" . $mob[
"mob"] .
"\"",
"src=\"" .
"il_" . IL_INST_ID .
"_mob_" . $media_object->getId() .
"\"", $qtext);
160 $new_question->setQuestiontext($qtext);
161 $new_question->saveToDb();
163 $this->svy_log->debug(
"new question text: " . $qtext);
166 if ($new_question->getOriginalId()) {
168 $pool_question->setQuestiontext($qtext);
169 $pool_question->saveToDb();
173 $this->svy_log->error(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
180 $a_mapping->addMapping(
"Modules/Survey",
"svy", (
int) $a_id, (
int) $newObj->getId());
181 return $newObj->getId();
183 include_once(
"./Services/DataSet/classes/class.ilDataSetImportParser.php");
An exception for terminatinating execution or to throw for unit testing.
Survey Question Import Parser.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
Manifest parser for ILIAS standard export files.
static getLogger($a_component_id)
Get component logger.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
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...
Importer class for files.
parseXmlFileNames()
Create qti and xml file name.
__construct()
Constructor.
getSurvey()
Get current survey object.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
setSurvey(ilObjSurvey $a_val)
Set current survey object (being imported).
getSchemaVersion()
Get schema version.
getImportDirectory()
Get import directory.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
getConfig()
Get the Config.