ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
8{
12 protected $ds;
13
17 public function init()
18 {
19 $this->ds = new \ilContentPageDataSet();
20 $this->ds->setDSPrefix('ds');
21 $this->ds->setImportDirectory($this->getImportDirectory());
22 }
23
27 public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
28 {
29 $parser = new \ilDataSetImportParser($a_entity, $this->getSchemaVersion(), $a_xml, $this->ds, $a_mapping);
30 }
31
35 public function finalProcessing($a_mapping)
36 {
37 parent::finalProcessing($a_mapping);
38
39 $copaMap = $a_mapping->getMappingsOfEntity('Services/COPage', 'pg');
40 foreach ($copaMap as $oldCopaId => $newCopaId) {
41 $newCopaId = substr($newCopaId, strlen(self::OBJ_TYPE) + 1);
42
43 \ilContentPagePage::_writeParentId(self::OBJ_TYPE, $newCopaId, $newCopaId);
44 }
45
46 $styleMapping = $a_mapping->getMappingsOfEntity('Modules/ContentPage', 'style');
47 foreach ($styleMapping as $newCopaId => $oldStyleId) {
48 $newStyleId = (int) $a_mapping->getMapping('Services/Style', 'sty', $oldStyleId);
49 if ($newCopaId > 0 && $newStyleId > 0) {
50 $copa = \ilObjectFactory::getInstanceByObjId($newCopaId, false);
51 if (!$copa || !($copa instanceof \ilObjContentPage)) {
52 continue;
53 }
54 $copa->writeStyleSheetId($newStyleId);
55 $copa->update();
56 }
57 }
58 }
59}
$parser
Definition: BPMN2Parser.php:23
An exception for terminatinating execution or to throw for unit testing.
Class ilContentPageImporter.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import xml representation.string xml string
finalProcessing($a_mapping)
Final processing.
Class ilObjContentPage.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
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.
Interface ilContentPageObjectConstants.