ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilContentPageImporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
7
12{
14 protected $ds;
17
21 public function init()
22 {
23 global $DIC;
24
25 $this->ds = new ilContentPageDataSet();
26 $this->ds->setDSPrefix('ds');
27 $this->ds->setImportDirectory($this->getImportDirectory());
28
29 $this->pageMetricsService = new PageMetricsService(
30 new PageMetricsRepositoryImp($DIC->database()),
31 $DIC->refinery()
32 );
33 }
34
38 public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
39 {
40 $parser = new ilDataSetImportParser($a_entity, $this->getSchemaVersion(), $a_xml, $this->ds, $a_mapping);
41 }
42
46 public function finalProcessing($a_mapping)
47 {
48 parent::finalProcessing($a_mapping);
49
50 $copaMap = $a_mapping->getMappingsOfEntity('Services/COPage', 'pg');
51 foreach ($copaMap as $oldCopaId => $newCopaId) {
52 $newCopaId = substr($newCopaId, strlen(self::OBJ_TYPE) + 1);
53
54 ilContentPagePage::_writeParentId(self::OBJ_TYPE, $newCopaId, $newCopaId);
55
56 $translations = ilContentPagePage::lookupTranslations(self::OBJ_TYPE, $newCopaId);
57 foreach ($translations as $language) {
58 $this->pageMetricsService->store(
60 (int) $newCopaId,
61 $language
62 )
63 );
64 }
65 }
66
67 $styleMapping = $a_mapping->getMappingsOfEntity('Modules/ContentPage', 'style');
68 foreach ($styleMapping as $newCopaId => $oldStyleId) {
69 $newStyleId = (int) $a_mapping->getMapping('Services/Style', 'sty', $oldStyleId);
70 if ($newCopaId > 0 && $newStyleId > 0) {
71 $copa = ilObjectFactory::getInstanceByObjId($newCopaId, false);
72 if (!$copa || !($copa instanceof ilObjContentPage)) {
73 continue;
74 }
75 $copa->writeStyleSheetId($newStyleId);
76 $copa->update();
77 }
78 }
79 }
80}
An exception for terminatinating execution or to throw for unit testing.
Class ilContentPageDataSet.
Class ilContentPageImporter.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import xml representation.string xml string
finalProcessing($a_mapping)
Final processing.
Manifest parser for ILIAS standard export files.
Class ilObjContentPage.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static lookupTranslations($a_parent_type, $a_id)
Lookup translations.
static _writeParentId($a_parent_type, $a_pg_id, $a_par_id)
Write parent id.
Xml importer class.
getSchemaVersion()
Get schema version.
getImportDirectory()
Get import directory.
global $DIC
Definition: goto.php:24
Interface ilContentPageObjectConstants.