ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSurveyImporter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilSurveyImporter:
+ Collaboration diagram for ilSurveyImporter:

Public Member Functions

 __construct ()
 
 init ()
 
 setSurvey (ilObjSurvey $a_val)
 Set current survey object (being imported). More...
 
 getSurvey ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 Import XML. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 
 setImport (ilImport $a_val)
 
 getImport ()
 
 init ()
 
 setInstallId (string $a_val)
 
 getInstallId ()
 
 setInstallUrl (string $a_val)
 
 getInstallUrl ()
 
 setSchemaVersion (string $a_val)
 
 getSchemaVersion ()
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setSkipEntities (array $a_val)
 
 getSkipEntities ()
 
 exportedFromSameInstallation ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 

Protected Member Functions

 parseXmlFileNames ()
 Create qti and xml file name. More...
 

Protected Attributes

ilSurveyDataSet $ds
 
ilLogger $log
 
ilLogger $svy_log
 
ILIAS SurveyQuestionPool Export ImportManager $spl_import_manager
 
- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

Static Protected Attributes

static ilObjSurvey $survey
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Importer class for files

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 23 of file class.ilSurveyImporter.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyImporter::__construct ( )

Reimplemented from ilXmlImporter.

Definition at line 31 of file class.ilSurveyImporter.php.

32 {
34 global $DIC;
35
36 $this->log = $DIC["ilLog"];
37
38 $this->spl_import_manager = $DIC->surveyQuestionPool()
39 ->internal()
40 ->domain()
41 ->import();
42 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getSurvey()

ilSurveyImporter::getSurvey ( )

Definition at line 65 of file class.ilSurveyImporter.php.

66 {
67 return self::$survey;
68 }
static ilObjSurvey $survey

References $survey.

◆ importXmlRepresentation()

ilSurveyImporter::importXmlRepresentation ( string  $a_entity,
string  $a_id,
string  $a_xml,
ilImportMapping  $a_mapping 
)

Import XML.

Exceptions
ilDatabaseException
ilImportException
ilObjectNotFoundException

Reimplemented from ilXmlImporter.

Definition at line 76 of file class.ilSurveyImporter.php.

81 : void {
82 if ($a_entity === "svy") {
83
84 // container import
85 if ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'objs', $a_id)) {
86 $newObj = ilObjectFactory::getInstanceByObjId((int) $new_id, false);
87 } else {
88 $newObj = new ilObjSurvey(); // direct survey import
89 $newObj->setType('svy');
90 $newObj->setTitle("dummy");
91 $newObj->create(true);
92 }
93 $a_mapping->addMapping('components/ILIAS/Survey', 'svy', $a_id, (string) $newObj->getId());
94 $this->setSurvey($newObj);
95
96
97 [$xml_file] = $this->parseXmlFileNames();
98
99 if (!file_exists($xml_file)) {
100 $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $xml_file);
101 return;
102 }
103 $GLOBALS['ilLog']->write("getQuestionPoolID = " . $this->getImport()->getConfig("components/ILIAS/Survey")->getQuestionPoolID());
104
105 $import = new SurveyImportParser(
106 $this->getImport()->getConfig("components/ILIAS/Survey")->getQuestionPoolID(),
107 $xml_file,
108 true,
109 $a_mapping
110 );
111
112 $import->setSurveyObject($newObj);
113 $import->startParsing();
114
115 $a_mapping->addMapping("components/ILIAS/Survey", "svy", (int) $a_id, $newObj->getId());
116 $a_mapping->addMapping(
117 "components/ILIAS/MetaData",
118 "md",
119 $a_id . ":0:svy",
120 $newObj->getId() . ":0:svy"
121 );
122 } else {
123 $parser = new ilDataSetImportParser(
124 $a_entity,
125 $this->getSchemaVersion(),
126 $a_xml,
127 $this->ds,
128 $a_mapping
129 );
130 }
131 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
parseXmlFileNames()
Create qti and xml file name.
setSurvey(ilObjSurvey $a_val)
Set current survey object (being imported).
$GLOBALS["DIC"]
Definition: wac.php:54

References $GLOBALS, ilImportMapping\addMapping(), ilXmlImporter\getImport(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), parseXmlFileNames(), and setSurvey().

+ Here is the call graph for this function:

◆ init()

ilSurveyImporter::init ( )

Reimplemented from ilXmlImporter.

Definition at line 45 of file class.ilSurveyImporter.php.

45 : void
46 {
47 $this->ds = new ilSurveyDataSet();
48 $this->ds->setDSPrefix("ds");
49 $this->ds->setImport($this);
50
51 $this->svy_log = ilLoggerFactory::getLogger("svy");
52 }
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilLoggerFactory\getLogger().

+ Here is the call graph for this function:

◆ parseXmlFileNames()

ilSurveyImporter::parseXmlFileNames ( )
protected

Create qti and xml file name.

Definition at line 137 of file class.ilSurveyImporter.php.

137 : array
138 {
139 $GLOBALS['ilLog']->write(__METHOD__ . ': ' . $this->getImportDirectory());
140
141 $basename = basename($this->getImportDirectory());
142 $xml = $this->getImportDirectory() . '/' . $basename . '.xml';
143
144 return array($xml);
145 }

References $GLOBALS.

Referenced by importXmlRepresentation().

+ Here is the caller graph for this function:

◆ setSurvey()

ilSurveyImporter::setSurvey ( ilObjSurvey  $a_val)

Set current survey object (being imported).

This is done statically, since the survey import uses multiple input files being processed for every survey and all of these need the current survey object (ilSurveyImporter is intantiated multiple times)

Definition at line 60 of file class.ilSurveyImporter.php.

60 : void
61 {
62 self::$survey = $a_val;
63 }

Referenced by importXmlRepresentation().

+ Here is the caller graph for this function:

Field Documentation

◆ $ds

ilSurveyDataSet ilSurveyImporter::$ds
protected

Definition at line 25 of file class.ilSurveyImporter.php.

◆ $log

ilLogger ilSurveyImporter::$log
protected

Definition at line 26 of file class.ilSurveyImporter.php.

◆ $spl_import_manager

ILIAS SurveyQuestionPool Export ImportManager ilSurveyImporter::$spl_import_manager
protected

Definition at line 29 of file class.ilSurveyImporter.php.

◆ $survey

ilObjSurvey ilSurveyImporter::$survey
staticprotected

Definition at line 27 of file class.ilSurveyImporter.php.

Referenced by getSurvey().

◆ $svy_log

ilLogger ilSurveyImporter::$svy_log
protected

Definition at line 28 of file class.ilSurveyImporter.php.


The documentation for this class was generated from the following file: