ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilContentPageImporter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24
26{
29 private \ILIAS\Style\Content\DomainService $content_style_domain;
30
31 public function init(): void
32 {
33 global $DIC;
34
35 $this->ds = new ilContentPageDataSet();
36 $this->ds->setDSPrefix('ds');
37 $this->ds->setImportDirectory($this->getImportDirectory());
38
39 $this->content_style_domain = $DIC
40 ->contentStyle()
41 ->domain();
42
43 $this->pageMetricsService = new PageMetricsService(
44 new PageMetricsRepositoryImp($DIC->database()),
45 $DIC->refinery()
46 );
47 }
48
49 public function importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping): void
50 {
51 $parser = new ilDataSetImportParser($a_entity, $this->getSchemaVersion(), $a_xml, $this->ds, $a_mapping);
52 }
53
54 public function finalProcessing(ilImportMapping $a_mapping): void
55 {
56 parent::finalProcessing($a_mapping);
57
58 $copaMap = $a_mapping->getMappingsOfEntity('components/ILIAS/COPage', 'pg');
59 foreach ($copaMap as $oldCopaId => $newCopaId) {
60 $newCopaId = (int) substr($newCopaId, strlen(self::OBJ_TYPE) + 1);
61
62 ilContentPagePage::_writeParentId(self::OBJ_TYPE, $newCopaId, $newCopaId);
63
64 $translations = ilContentPagePage::lookupTranslations(self::OBJ_TYPE, $newCopaId);
65 foreach ($translations as $language) {
66 $this->pageMetricsService->store(
68 $newCopaId,
69 $language
70 )
71 );
72 }
73 }
74
75 $style_map = $a_mapping->getMappingsOfEntity('components/ILIAS/Style', 'sty');
76 foreach ($style_map as $old_style_id => $new_style_id) {
77 if (isset(ilContentPageDataSet::$style_map[$old_style_id]) &&
78 is_array(ilContentPageDataSet::$style_map[$old_style_id])) {
79 foreach (ilContentPageDataSet::$style_map[$old_style_id] as $new_copa_id) {
80 $this->content_style_domain
81 ->styleForObjId($new_copa_id)
82 ->updateStyleId((int) $new_style_id);
83 }
84 }
85 }
86 }
87}
PageMetricsService $pageMetricsService
importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
ILIAS Style Content DomainService $content_style_domain
finalProcessing(ilImportMapping $a_mapping)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getMappingsOfEntity(string $a_comp, string $a_entity)
static _writeParentId(string $a_parent_type, int $a_pg_id, int $a_par_id)
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
Xml importer class.
Interface ilContentPageObjectConstants.
global $DIC
Definition: shib_login.php:26