ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilImportMapping.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 {
13  public $mappings;
14  public $install_id;
15  public $install_url;
16  public $log;
17 
18  protected $target_id = 0;
19 
26  public function __construct()
27  {
28  $this->mappings = array();
29  $this->log = ilLoggerFactory::getLogger("exp");
30  $this->log->debug("ilImportMapping Construct this->mappings = array()");
31  }
32 
38  final public function setInstallId($a_val)
39  {
40  $this->install_id = $a_val;
41  }
42 
48  final public function getInstallId()
49  {
50  return $this->install_id;
51  }
52 
58  final public function setInstallUrl($a_val)
59  {
60  $this->install_url = $a_val;
61  }
62 
68  final public function getInstallUrl()
69  {
70  return $this->install_url;
71  }
72 
78  final public function setTargetId($a_target_id)
79  {
80  $this->target_id = $a_target_id;
81  $this->log->debug("a_target_id=" . $a_target_id);
82  }
83 
88  final public function getTargetId()
89  {
90  return $this->target_id;
91  }
92 
101  public function addMapping($a_comp, $a_entity, $a_old_id, $a_new_id)
102  {
103  $this->mappings[$a_comp][$a_entity][$a_old_id] = $a_new_id;
104  $this->log->debug("ADD MAPPING this->mappings = ", $this->mappings);
105  }
106 
116  public function getMapping($a_comp, $a_entity, $a_old_id)
117  {
118  $this->log->debug("a_comp = $a_comp, a_entity = $a_entity , a_old_id = $a_old_id");
119 
120  if (!isset($this->mappings[$a_comp]) or !isset($this->mappings[$a_comp][$a_entity])) {
121  return false;
122  }
123  if (isset($this->mappings[$a_comp][$a_entity][$a_old_id])) {
124  return $this->mappings[$a_comp][$a_entity][$a_old_id];
125  }
126 
127  return false;
128  }
129 
135  public function getAllMappings()
136  {
137  return $this->mappings;
138  }
139 
147  public function getMappingsOfEntity($a_comp, $a_entity)
148  {
149  if (isset($this->mappings[$a_comp][$a_entity])) {
150  return $this->mappings[$a_comp][$a_entity];
151  }
152  return array();
153  }
154 }
getMapping($a_comp, $a_entity, $a_old_id)
Get a mapping.
getAllMappings()
Get mapping.
setInstallUrl($a_val)
Set Installation Url.
setInstallId($a_val)
Set Installation ID.
getInstallUrl()
Get Installation Url.
setTargetId($a_target_id)
set target id
__construct()
Constructor.
addMapping($a_comp, $a_entity, $a_old_id, $a_new_id)
Add mapping.
getTargetId()
get target id
getInstallId()
Get Installation ID.
getMappingsOfEntity($a_comp, $a_entity)
Get mappings for entity.
static getLogger($a_component_id)
Get component logger.