ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSurveyQuestionPoolImporter Class Reference

Importer class for files. More...

+ Inheritance diagram for ilSurveyQuestionPoolImporter:
+ Collaboration diagram for ilSurveyQuestionPoolImporter:

Public Member Functions

 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import XML. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. More...
 
 setImport ($a_val)
 Set import. More...
 
 getImport ()
 Get import. More...
 
 init ()
 Init. More...
 
 setInstallId ($a_val)
 Set installation id. More...
 
 getInstallId ()
 Get installation id. More...
 
 setInstallUrl ($a_val)
 Set installation url. More...
 
 getInstallUrl ()
 Get installation url. More...
 
 setSchemaVersion ($a_val)
 Set schema version. More...
 
 getSchemaVersion ()
 Get schema version. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setSkipEntities ($a_val)
 Set skip entities. More...
 
 getSkipEntities ()
 Get skip entities. More...
 
 exportedFromSameInstallation ()
 Is exporting and importing installation identical? More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 Called after all container objects have been implemented. More...
 

Protected Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from ilXmlImporter
 $skip_entities = array()
 
 $imp
 

Detailed Description

Importer class for files.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de

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

Member Function Documentation

◆ importXmlRepresentation()

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

Import XML.

Parameters

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

References $GLOBALS, ilObjectFactory\getInstanceByObjId(), and parseXmlFileNames().

19  {
20  // Container import => test object already created
21  if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
22  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
23  #$newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(),'/')));
24  } else { // case ii, non container
25  // Shouldn't happen
26  $GLOBALS['ilLog']->write(__METHOD__ . ': Called in non container mode');
27  return false;
28  }
29 
30 
31  list($xml_file) = $this->parseXmlFileNames();
32 
33  if (!@file_exists($xml_file)) {
34  $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $xml_file);
35  return false;
36  }
37 
38  // import qti data
39  $qtiresult = $newObj->importObject($xml_file);
40 
41  $a_mapping->addMapping("Modules/SurveyQuestionPool", "spl", $a_id, $newObj->getId());
42 
43  return true;
44  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
parseXmlFileNames()
Create qti and xml file name.
+ Here is the call graph for this function:

◆ parseXmlFileNames()

ilSurveyQuestionPoolImporter::parseXmlFileNames ( )
protected

Create qti and xml file name.

Returns
array

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

References $GLOBALS, $xml, and ilXmlImporter\getImportDirectory().

Referenced by importXmlRepresentation().

52  {
53  $GLOBALS['ilLog']->write(__METHOD__ . ': ' . $this->getImportDirectory());
54 
55  $basename = basename($this->getImportDirectory());
56  $xml = $this->getImportDirectory() . '/' . $basename . '.xml';
57 
58  return array($xml);
59  }
getImportDirectory()
Get import directory.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$xml
Definition: metadata.php:332
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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