ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilSurveyQuestionPoolImporter 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 ilSurveyQuestionPoolImporter:
+ Collaboration diagram for ilSurveyQuestionPoolImporter:

Public Member Functions

 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
- 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

 getXmlFileName ()
 

Additional Inherited Members

- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

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
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de

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

Member Function Documentation

◆ getXmlFileName()

ilSurveyQuestionPoolImporter::getXmlFileName ( )
protected

Definition at line 64 of file class.ilSurveyQuestionPoolImporter.php.

References ilXmlImporter\getImportDirectory().

Referenced by importXmlRepresentation().

64  : string
65  {
66  $basename = basename($this->getImportDirectory());
67  return $this->getImportDirectory() . '/' . $basename . '.xml';
68  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importXmlRepresentation()

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

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

References $GLOBALS, ilImportMapping\addMapping(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), and getXmlFileName().

30  : void {
31  // Container import => test object already created
32  if ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'objs', $a_id)) {
33  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
34  } else { // case ii, non container
35  $newObj = new ilObjSurveyQuestionPool();
36  $new_id = $newObj->create();
37  }
38 
39  # Try legacy import
40  $xml_file = $this->getXmlFileName();
41  if (file_exists($xml_file)) {
42  $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $xml_file);
43  // import qti data
44  $newObj->importObject($xml_file);
45  }
46 
47  $import = new SurveyImportParser($new_id, "", true);
48  $import->setXMLContent($a_xml);
49  $import->startParsing();
50  $a_mapping->addMapping(
51  "components/ILIAS/SurveyQuestionPool",
52  "spl",
53  $a_id,
54  $newObj->getId()
55  );
56  $a_mapping->addMapping(
57  'components/ILIAS/MetaData',
58  'md',
59  $a_id . ':0:spl',
60  $newObj->getId() . ':0:spl'
61  );
62  }
Class ilObjSurveyQuestionPool.
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)
$GLOBALS["DIC"]
Definition: wac.php:54
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

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