168 : void {
169 $this->current_value = null;
170
171
172 $new_parent_id = (
int) $this->mapping->getMapping(
"components/ILIAS/AdvancedMetaData",
"parent", (
string)
$this->obj_id);
173 $this->log->notice('Found new parent id:' . $new_parent_id);
174 if (!$new_parent_id) {
175 return;
176 }
177 $new_sub_id = '';
178 if ($a_sub_type && strcmp($a_sub_type, '-') !== 0) {
179 $new_sub_id = $this->mapping->getMapping(
180 "components/ILIAS/AdvancedMetaData",
181 "advmd_sub_item",
182 "advmd:" . $a_sub_type . ":" . $a_sub_id
183 );
184 if (!$new_sub_id) {
185 return;
186 }
187 }
188
189
190
191 if (is_array($this->local_record)) {
193 (int) $this->local_record['id'],
194 $this->local_record['xml'],
195 $new_parent_id,
196 $a_sub_type
197 );
198 $this->local_record = null;
199 }
200
202
203
204 if (!$a_local_rec_id) {
206 $rec_id = $field->getRecordId();
207 }
208 }
209 else {
210 $rec_id = $this->local_rec_map[$a_local_rec_id];
211 }
212
214 return;
215 }
216
217
218 if ($a_sub_type) {
219 $rec_idx =
$rec_id .
";" . $a_sub_type .
";" . $new_sub_id;
220 if (!array_key_exists($rec_idx, $this->value_records)) {
223 $new_parent_id,
224 $a_sub_type,
225 $new_sub_id
226 );
227 }
228 } else {
230 if (!array_key_exists($rec_idx, $this->value_records)) {
232 }
233 }
234
235
236 $this->value_records[$rec_idx]->getADTGroup();
237
238
239 $this->log->debug("Find element: " . $a_import_id . ", local rec_id: " . $a_local_rec_id);
240 if (!$a_local_rec_id) {
241 foreach ($this->value_records[$rec_idx]->getDefinitions() as $def) {
242 if ($a_import_id == $def->getImportId()) {
243 $this->current_value = $def;
244 break;
245 }
246 }
247 } else {
248
249 $field_id = $this->local_rec_fields_map[
$rec_id][$a_import_id];
250 if ($field_id) {
251 $this->log->debug("- Field id: " . $field_id);
252 foreach ($this->value_records[$rec_idx]->getDefinitions() as $def) {
253 $this->log->debug("- Def field id: " . $def->getFieldId());
254 if ($field_id == $def->getFieldId()) {
255 $this->current_value = $def;
256 break;
257 }
258 }
259 } else {
260 $this->log->debug("- No Field id. local rec: " . $a_local_rec_id .
261 ", rec id:" .
$rec_id .
", import id: " . $a_import_id .
", map: " . print_r(
262 $this->local_rec_fields_map,
263 true
264 ));
265 }
266 }
267
268
269
270 if ($this->current_value &&
271 !$a_local_rec_id) {
272 $this->record_ids[$new_parent_id][$a_sub_type][] =
$rec_id;
273 }
274 }
static getInstanceByImportId(string $a_import_id)
createLocalRecord(int $a_old_id, string $a_xml, int $a_obj_id, ?string $a_sub_type=null)