ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilContentPageExporter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
27
28 public function init(): void
29 {
30 global $DIC;
31
32 $this->ds = new ilContentPageDataSet();
33 $this->ds->setDSPrefix('ds');
34 $this->content_style_domain = $DIC->contentStyle()
35 ->domain();
36 }
37
38 public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
39 {
41 $this->ds->initByExporter($this);
42
43 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], '', true, true);
44 }
45
46 public function getValidSchemaVersions(string $a_entity): array
47 {
48 return [
49 '9.0' => [
50 'namespace' => 'http://www.ilias.de/Modules/ContentPage/' . self::OBJ_TYPE . '/9',
51 'xsd_file' => 'ilias_' . self::OBJ_TYPE . '_9.xsd',
52 'uses_dataset' => true,
53 'min' => '9.0',
54 'max' => '',
55 ],
56 ];
57 }
58
59 public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
60 {
61 $pageObjectIds = [];
62 $styleIds = [];
63 $metadataIds = [];
64
65 foreach ($a_ids as $copaObjId) {
66 $copa = ilObjectFactory::getInstanceByObjId($copaObjId, false);
67 if (!$copa || !($copa instanceof ilObjContentPage)) {
68 continue;
69 }
70
71 $metadataIds[] = $copaObjId . ':0:' . self::OBJ_TYPE;
72
73 $copaPageObjIds = $copa->getPageObjIds();
74 foreach ($copaPageObjIds as $copaPageObjId) {
75 $pageObjectIds[] = self::OBJ_TYPE . ':' . $copaPageObjId;
76 }
77
78 $style_id = $this->content_style_domain
79 ->styleForObjId($copa->getId())
80 ->getStyleId();
81 if ($style_id > 0) {
82 $styleIds[$style_id] = $style_id;
83 }
84 }
85
86 $deps = [];
87
88 if (count($pageObjectIds) > 0) {
89 $deps[] = [
90 'component' => 'components/ILIAS/COPage',
91 'entity' => 'pg',
92 'ids' => $pageObjectIds,
93 ];
94 }
95
96 if (count($metadataIds) > 0) {
97 $deps[] = [
98 'component' => 'components/ILIAS/MetaData',
99 'entity' => 'md',
100 'ids' => $metadataIds,
101 ];
102 }
103
104 if (count($styleIds) > 0) {
105 $deps[] = [
106 'component' => 'components/ILIAS/Style',
107 'entity' => 'sty',
108 'ids' => array_values($styleIds),
109 ];
110 }
111
112 if (self::OBJ_TYPE === $a_entity) {
113 $deps[] = [
114 'component' => 'components/ILIAS/ILIASObject',
115 'entity' => 'common',
116 'ids' => $a_ids
117 ];
118 }
119
120 return $deps;
121 }
122}
Facade for consumer domain interface.
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Xml Exporter class.
Interface ilContentPageObjectConstants.
global $DIC
Definition: shib_login.php:26