ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 }
getSchemaVersion()
Get schema version.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
getImportDirectory()
Get import directory.
Interface ilContentPageObjectConstants.
static _writeParentId($a_parent_type, $a_pg_id, $a_par_id)
Write parent id.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjContentPage.
$parser
Definition: BPMN2Parser.php:23
Class ilContentPageImporter.
Xml importer class.