ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 125 of file class.ilOrgUnitImporter.php.

References $action.

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

126  {
127  $this->errors[] = array( 'lang_var' => $lang_var, 'import_id' => $import_id, 'action' => $action );
128  }
$action
+ 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 114 of file class.ilOrgUnitImporter.php.

References $action.

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

115  {
116  $this->warnings[] = array( 'lang_var' => $lang_var, 'import_id' => $import_id, 'action' => $action );
117  }
$action
+ 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.

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

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

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::_hasUntrashedReference($obj_id)) {
46  return false;
47  }
48 
49  $ref_ids = ilObject::_getAllReferences($obj_id);
50 
51  if (!count($ref_ids)) {
52  return false;
53  }
54 
55  foreach ($ref_ids as $ref_id) {
56  if (!ilObject::_isInTrash($ref_id)) {
57  return $ref_id;
58  }
59  }
60  return false;
61  } else {
62  return false;
63  }
64  }
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
$type
if(!array_key_exists('StateId', $_REQUEST)) $id
static _exists($a_id, $a_reference=false, $type="orgu")
static _isInTrash($a_ref_id)
checks wether object is in trash
static _getAllReferences($a_id)
get all reference ids of object
static _lookupObjIdByImportId($a_import_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getErrors()

ilOrgUnitImporter::getErrors ( )
Returns
array

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

References $errors.

135  {
136  return $this->errors;
137  }

◆ getStats()

ilOrgUnitImporter::getStats ( )
Returns
array

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

References $stats.

153  {
154  return $this->stats;
155  }

◆ getWarnings()

ilOrgUnitImporter::getWarnings ( )
Returns
array

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

References $warnings.

144  {
145  return $this->warnings;
146  }

◆ hasErrors()

ilOrgUnitImporter::hasErrors ( )
Returns
bool

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

95  {
96  return count($this->errors) != 0;
97  }

◆ hasMoreThanOneMatch()

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

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

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

Referenced by ilOrgUnitSimpleImport\simpleImportElement().

71  {
72  global $DIC;
73 
74  $ilDB = $DIC->database();
75 
76  $query = "SELECT * FROM object_data " .
77  "INNER JOIN object_reference as ref on ref.obj_id = object_data.obj_id and ref.deleted is null ".
78  'WHERE object_data.type = "orgu" and import_id = ' . $ilDB->quote($external_id, "text") . " " .
79  "ORDER BY create_date DESC";
80  $res = $ilDB->query($query);
81 
82  if ($ilDB->numRows($res) > 1) {
83  return true;
84  } else {
85  return false;
86  }
87  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ hasWarnings()

ilOrgUnitImporter::hasWarnings ( )
Returns
bool

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

104  {
105  return count($this->warnings) != 0;
106  }

◆ importXmlRepresentation()

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

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

References ilObject2\_lookupType().

169  {
170  $container_mappings = $a_mapping->getMappingsOfEntity("Services/Container", "objs");
171  foreach ($container_mappings as $old => $new) {
173  if (ilObject2::_lookupType($new) == "orgu") {
174  $a_mapping->addMapping("Modules/OrgUnit", "orgu", $old, $new);
175  }
176  }
177  }
static _lookupType($a_id, $a_reference=false)
+ 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: