ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilImportContainer Class Reference

Import class. More...

+ Inheritance diagram for ilImportContainer:
+ Collaboration diagram for ilImportContainer:

Public Member Functions

 __construct ($a_target_id)
 Constructor. More...
 
- Public Member Functions inherited from ilImport
 __construct ($a_target_id=0)
 Constructor. More...
 
 getConfig ($a_comp)
 Get configuration (note that configurations are optional, null may be returned!) More...
 
 getMapping ()
 Get mapping object. More...
 
 setEntityTypes ($a_val)
 Set entity types. More...
 
 getEntityTypes ()
 Get entity types. More...
 
 addSkipEntity ($a_component, $a_entity, $skip=true)
 Add skip entity. More...
 
 setCurrentDataset ($a_val)
 Set currrent dataset. More...
 
 getCurrentDataset ()
 Get currrent dataset. More...
 
 afterEntityTypes ()
 After entity types are parsed. More...
 
 importRecord ($a_entity, $a_types, $a_record)
 After entity types are parsed. More...
 
 importEntity ( $a_tmp_file, $a_filename, $a_entity, $a_component, $a_copy_file=false)
 Import entity. More...
 
 importObject ( $a_new_obj, $a_tmp_file, $a_filename, $a_type, $a_comp="", $a_copy_file=false)
 Import repository object export file. More...
 
 importFromDirectory ($dir, $a_type, $a_comp)
 Import from directory. More...
 
 getTemporaryImportDir ()
 Get temporary import directory. More...
 
 processItemXml ($a_entity, $a_schema_version, $a_id, $a_xml, $a_install_id, $a_install_url)
 Process item xml. More...
 

Protected Member Functions

 doImportObject ($dir, $type, $a_component="", $a_tmpdir="")
 Import a container. More...
 
 createDummy ($a_type)
 Create dummy object. More...
 
- Protected Member Functions inherited from ilImport
 setTemporaryImportDir ($a_val)
 Set temporary import directory. More...
 
 doImportObject ($dir, $a_type, $a_component="", $a_tmpdir="")
 Import repository object export file. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilImport
 $log
 
 $install_id = ""
 
 $install_url = ""
 
 $entities = ""
 
 $tmp_import_dir = ""
 
 $mapping = null
 
 $skip_entity = array()
 
 $configs = array()
 

Detailed Description

Import class.

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

Definition at line 13 of file class.ilImportContainer.php.

Constructor & Destructor Documentation

◆ __construct()

ilImportContainer::__construct (   $a_target_id)

Constructor.

Parameters
int$a_target_idId of parent node
Returns

Definition at line 20 of file class.ilImportContainer.php.

21  {
22  parent::__construct($a_target_id);
23  }

Member Function Documentation

◆ createDummy()

ilImportContainer::createDummy (   $a_type)
protected

Create dummy object.

Parameters
object$a_type
Returns

Definition at line 86 of file class.ilImportContainer.php.

References $a_type, $location, $new, and ilImport\getMapping().

Referenced by doImportObject().

87  {
88  global $objDefinition;
89 
90  $class_name = "ilObj" . $objDefinition->getClassName($a_type);
91  $location = $objDefinition->getLocation($a_type);
92 
93  include_once($location . "/class." . $class_name . ".php");
94  $new = new $class_name();
95  $new->setTitle('Import');
96  $new->create(true);
97  $new->createReference();
98  $new->putInTree($this->getMapping()->getTargetId());
99  $new->setPermissions($this->getMapping()->getTargetId());
100 
101  $this->getMapping()->addMapping('Services/Container', 'objs', 0, $new->getId());
102  $this->getMapping()->addMapping('Services/Container', 'refs', 0, $new->getRefId());
103 
104  return $new;
105  }
$location
Definition: buildRTE.php:44
getMapping()
Get mapping object.
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doImportObject()

ilImportContainer::doImportObject (   $dir,
  $type,
  $a_component = "",
  $a_tmpdir = "" 
)
protected

Import a container.

Parameters
object$dir
object$type
Returns

Definition at line 32 of file class.ilImportContainer.php.

References $parser, $ret, $type, array, createDummy(), and ilImport\getMapping().

33  {
34  $manifest_file = $dir . "/manifest.xml";
35  if (!file_exists($manifest_file)) {
36  return false;
37  }
38 
39  include_once("./Services/Export/classes/class.ilManifestParser.php");
40  $parser = new ilManifestParser($manifest_file);
41 
42 
43  // begin-patch optes_lok_export
44 
45  // Handling single containers without subitems
46 
47  // @todo: check if this is required
48  // all container have container export sets
49  $all_importers = array();
50 
51  if (!$parser->getExportSets()) {
52  $this->createDummy($type);
53  $import_info = parent::doImportObject($dir, $type);
54 
55  $all_importers = array_merge($all_importers, $import_info['importers']);
56  return $import_info;
57  //return $import_info['new_id'];
58  }
59 
60  // Handling containers with subitems
61  $first = true;
62  foreach ($parser->getExportSets() as $set) {
63  $import_info = parent::doImportObject($dir . DIRECTORY_SEPARATOR . $set['path'], $set['type']);
64 
65  $all_importers = array_merge($all_importers, $import_info['importers']);
66  if ($first) {
67  $ret = $import_info;
68  //$ret = $import_info['new_id'];
69  $first = false;
70  }
71  }
72  // after container import is finished, call all importers to perform a final processing
73  foreach ((array) $all_importers as $importer) {
74  $importer->afterContainerImportProcessing($this->getMapping());
75  }
76  // end-patch optes_lok_export
77 
78  return $ret;
79  }
createDummy($a_type)
Create dummy object.
$type
getMapping()
Get mapping object.
Create styles array
The data for the language used.
Manifest parser for ILIAS standard export files.
$parser
Definition: BPMN2Parser.php:23
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

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