ILIAS  release_7 Revision v7.30-3-g800a261c036
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 if (self::OBJ_TYPE === $a_entity) {
93 $deps[] = [
94 'component' => 'Services/Object',
95 'entity' => 'common',
96 'ids' => $a_ids
97 ];
98 }
99
100 return $deps;
101 }
102}
An exception for terminatinating execution or to throw for unit testing.
Class ilContentPageDataSet.
Class ilContentPageExporter.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.ILIAS chooses the first one,...
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.string xml string
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.array array of array with keys "component", entity", "ids"
Class ilObjContentPage.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Xml Exporter class.
getAbsoluteExportDirectory()
Get absolute export directory.
Interface ilContentPageObjectConstants.