ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilOrgUnitImporter Class Reference

Class ilOrgUnitImporter. More...

+ Inheritance diagram for ilOrgUnitImporter:
+ Collaboration diagram for ilOrgUnitImporter:

Public Member Functions

 hasMoreThanOneMatch ($external_id)
 
 hasErrors ()
 
 hasWarnings ()
 
 addWarning ($lang_var, $import_id, $action=null)
 
 addError ($lang_var, $import_id, $action=null)
 
 getErrors ()
 
 getWarnings ()
 
 getStats ()
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 
- 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...
 

Data Fields

 $errors = []
 
 $warnings = []
 
 $stats
 

Protected Member Functions

 buildRef ($id, $type)
 

Additional Inherited Members

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

Detailed Description

Member Function Documentation

◆ addError()

ilOrgUnitImporter::addError (   $lang_var,
  $import_id,
  $action = null 
)
Parameters
$lang_var
$import_id
null$action

Definition at line 132 of file class.ilOrgUnitImporter.php.

133 {
134 $this->errors[] = array('lang_var' => $lang_var, 'import_id' => $import_id, 'action' => $action);
135 }

Referenced by ilOrgUnitSimpleImport\simpleImport(), ilOrgUnitSimpleImport\simpleImportElement(), ilOrgUnitSimpleUserImport\simpleUserImport(), and ilOrgUnitSimpleUserImport\simpleUserImportElement().

+ Here is the caller graph for this function:

◆ addWarning()

ilOrgUnitImporter::addWarning (   $lang_var,
  $import_id,
  $action = null 
)
Parameters
$lang_var
$import_id
null$action

Definition at line 121 of file class.ilOrgUnitImporter.php.

122 {
123 $this->warnings[] = array('lang_var' => $lang_var, 'import_id' => $import_id, 'action' => $action);
124 }

Referenced by ilOrgUnitSimpleImport\moveObject(), and ilOrgUnitSimpleImport\simpleImportElement().

+ Here is the caller graph for this function:

◆ buildRef()

ilOrgUnitImporter::buildRef (   $id,
  $type 
)
protected
Parameters
$id
$type
Returns
bool|int

Definition at line 34 of file class.ilOrgUnitImporter.php.

35 {
36 if ($type == 'reference_id') {
37 if (!ilObjOrgUnit::_exists($id, true)) {
38 return false;
39 }
40
41 return $id;
42 } elseif ($type == 'external_id') {
44
45 if(ilObject::_lookupType($obj_id) !== 'orgu') {
46 return false;
47 }
48
50 return false;
51 }
52
53 $ref_ids = ilObject::_getAllReferences($obj_id);
54
55 if (!count($ref_ids)) {
56 return false;
57 }
58
59 foreach ($ref_ids as $ref_id) {
60 if (!ilObject::_isInTrash($ref_id)) {
61 return $ref_id;
62 }
63 }
64
65 return false;
66 } else {
67 return false;
68 }
69 }
static _exists($a_id, $a_reference=false, $type="orgu")
static _getAllReferences($a_id)
get all reference ids of object
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
static _lookupObjIdByImportId($a_import_id)
static _isInTrash($a_ref_id)
checks wether object is in trash
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

References $type, ilObjOrgUnit\_exists(), ilObject\_getAllReferences(), ilObject\_hasUntrashedReference(), ilObject\_isInTrash(), ilObject\_lookupObjIdByImportId(), and ilObject\_lookupType().

Referenced by ilOrgUnitSimpleImport\simpleImportElement(), and ilOrgUnitSimpleUserImport\simpleUserImportElement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getErrors()

ilOrgUnitImporter::getErrors ( )
Returns
array

Definition at line 141 of file class.ilOrgUnitImporter.php.

142 {
143 return $this->errors;
144 }

References $errors.

◆ getStats()

ilOrgUnitImporter::getStats ( )
Returns
array

Definition at line 159 of file class.ilOrgUnitImporter.php.

160 {
161 return $this->stats;
162 }

References $stats.

◆ getWarnings()

ilOrgUnitImporter::getWarnings ( )
Returns
array

Definition at line 150 of file class.ilOrgUnitImporter.php.

151 {
152 return $this->warnings;
153 }

References $warnings.

◆ hasErrors()

ilOrgUnitImporter::hasErrors ( )
Returns
bool

Definition at line 101 of file class.ilOrgUnitImporter.php.

102 {
103 return count($this->errors) != 0;
104 }

◆ hasMoreThanOneMatch()

ilOrgUnitImporter::hasMoreThanOneMatch (   $external_id)
Parameters
string$external_id
Returns
bool

Definition at line 77 of file class.ilOrgUnitImporter.php.

78 {
79 global $DIC;
80
81 $ilDB = $DIC->database();
82
83 $query = "SELECT * FROM object_data " .
84 "INNER JOIN object_reference as ref on ref.obj_id = object_data.obj_id and ref.deleted is null ".
85 'WHERE object_data.type = "orgu" and import_id = ' . $ilDB->quote($external_id, "text") . " " .
86 "ORDER BY create_date DESC";
87
88 $res = $ilDB->query($query);
89
90 if ($ilDB->numRows($res) > 1) {
91 return true;
92 } else {
93 return false;
94 }
95 }
$query
foreach($_POST as $key=> $value) $res
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, $query, and $res.

Referenced by ilOrgUnitSimpleImport\simpleImportElement().

+ Here is the caller graph for this function:

◆ hasWarnings()

ilOrgUnitImporter::hasWarnings ( )
Returns
bool

Definition at line 110 of file class.ilOrgUnitImporter.php.

111 {
112 return count($this->warnings) != 0;
113 }

◆ importXmlRepresentation()

ilOrgUnitImporter::importXmlRepresentation (   $a_entity,
  $a_id,
  $a_xml,
  $a_mapping 
)
Parameters
$a_entity
$a_id
$a_xml
$a_mappingilImportMapping
Returns
string|void
Deprecated:

Reimplemented from ilXmlImporter.

Definition at line 175 of file class.ilOrgUnitImporter.php.

176 {
177 $container_mappings = $a_mapping->getMappingsOfEntity("Services/Container", "objs");
178 foreach ($container_mappings as $old => $new) {
179 if (ilObject2::_lookupType($new) === 'orgu') {
180 $a_mapping->addMapping('Modules/OrgUnit', 'orgu', $old, $new);
181 }
182 }
183 }
static _lookupType($a_id, $a_reference=false)
lookup object type

References ilObject2\_lookupType().

+ Here is the call graph for this function:

Field Documentation

◆ $errors

ilOrgUnitImporter::$errors = []

Definition at line 17 of file class.ilOrgUnitImporter.php.

Referenced by getErrors().

◆ $stats

ilOrgUnitImporter::$stats

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

Referenced by getStats().

◆ $warnings

ilOrgUnitImporter::$warnings = []

Definition at line 21 of file class.ilOrgUnitImporter.php.

Referenced by getWarnings().


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