ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilContentPageExporter.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  }
22 
26  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
27  {
29  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
30 
31  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, '', true, true);
32  }
33 
37  public function getValidSchemaVersions($a_entity)
38  {
39  return array(
40  '5.4.0' => array(
41  'namespace' => 'http://www.ilias.de/Modules/ContentPage/' . self::OBJ_TYPE . '/5_4',
42  'xsd_file' => 'ilias_' . self::OBJ_TYPE . '_5_4.xsd',
43  'uses_dataset' => true,
44  'min' => '5.4.0',
45  'max' => '',
46  ),
47  );
48  }
49 
53  public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
54  {
55  $pageObjectIds = [];
56  $styleIds = [];
57 
58  foreach ($a_ids as $copaObjId) {
59  $copa = \ilObjectFactory::getInstanceByObjId($copaObjId, false);
60  if (!$copa || !($copa instanceof \ilObjContentPage)) {
61  continue;
62  }
63 
64  $copaPageObjIds = $copa->getPageObjIds();
65  foreach ($copaPageObjIds as $copaPageObjId) {
66  $pageObjectIds[] = self::OBJ_TYPE . ':' . $copaPageObjId;
67  }
68 
69  if ($copa->getStyleSheetId() > 0) {
70  $styleIds[$copa->getStyleSheetId()] = $copa->getStyleSheetId();
71  }
72  }
73 
74  $deps = [];
75 
76  if (count($pageObjectIds) > 0) {
77  $deps[] = [
78  'component' => 'Services/COPage',
79  'entity' => 'pg',
80  'ids' => $pageObjectIds,
81  ];
82  }
83 
84  if (count($styleIds) > 0) {
85  $deps[] = [
86  'component' => 'Services/Style',
87  'entity' => 'sty',
88  'ids' => array_values($styleIds),
89  ];
90  }
91 
92  return $deps;
93  }
94 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Interface ilContentPageObjectConstants.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Xml Exporter class.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Class ilContentPageExporter.
getAbsoluteExportDirectory()
Get absolute export directory.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjContentPage.