ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilOrgUnitImporter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once('./Services/Export/classes/class.ilXmlImporter.php');
4 
13 
17  public $errors;
21  public $warnings;
25  public $stats;
26 
27 
34  protected function buildRef($id, $type) {
35  if ($type == 'reference_id') {
36  if (!ilObjOrgUnit::_exists($id, true)) {
37  return false;
38  }
39 
40  return $id;
41  } elseif ($type == 'external_id') {
42  $obj_id = ilObject::_lookupObjIdByImportId($id);
43 
44  if (!ilObject::_hasUntrashedReference($obj_id)) {
45  return false;
46  }
47 
48  $ref_ids = ilObject::_getAllReferences($obj_id);
49 
50  if (!count($ref_ids)) {
51  return false;
52  }
53 
54  foreach($ref_ids as $ref_id) {
55  if(!ilObject::_isInTrash($ref_id))
56  return $ref_id;
57  }
58  return false;
59  } else {
60  return false;
61  }
62  }
63 
64 
68  public function hasErrors() {
69  return count($this->errors) != 0;
70  }
71 
72 
76  public function hasWarnings() {
77  return count($this->warnings) != 0;
78  }
79 
80 
86  public function addWarning($lang_var, $import_id, $action = NULL) {
87  $this->warnings[] = array( 'lang_var' => $lang_var, 'import_id' => $import_id, 'action' => $action );
88  }
89 
90 
96  public function addError($lang_var, $import_id, $action = NULL) {
97  $this->errors[] = array( 'lang_var' => $lang_var, 'import_id' => $import_id, 'action' => $action );
98  }
99 
100 
104  public function getErrors() {
105  return $this->errors;
106  }
107 
108 
112  public function getWarnings() {
113  return $this->warnings;
114  }
115 
116 
120  public function getStats() {
121  return $this->stats;
122  }
123 
124 
135  public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping) {
136  }
137 }
138 
139 ?>
static _getAllReferences($a_id)
get all reference ids of object
static _exists($a_id, $a_reference=false)
Class ilOrgUnitImporter.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
_isInTrash($a_ref_id)
checks wether object is in trash
addError($lang_var, $import_id, $action=NULL)
addWarning($lang_var, $import_id, $action=NULL)
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
$ref_id
Definition: sahs_server.php:39
static _lookupObjIdByImportId($a_import_id)
Xml importer class.