ILIAS  release_8 Revision v8.23
class.ilContentPageExporter.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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->setExportDirectories($this->dir_relative, $this->dir_absolute);
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  '5.4.0' => [
50  'namespace' => 'http://www.ilias.de/Modules/ContentPage/' . self::OBJ_TYPE . '/5_4',
51  'xsd_file' => 'ilias_' . self::OBJ_TYPE . '_5_4.xsd',
52  'uses_dataset' => true,
53  'min' => '5.4.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 
64  foreach ($a_ids as $copaObjId) {
65  $copa = ilObjectFactory::getInstanceByObjId($copaObjId, false);
66  if (!$copa || !($copa instanceof ilObjContentPage)) {
67  continue;
68  }
69 
70  $copaPageObjIds = $copa->getPageObjIds();
71  foreach ($copaPageObjIds as $copaPageObjId) {
72  $pageObjectIds[] = self::OBJ_TYPE . ':' . $copaPageObjId;
73  }
74 
75  $style_id = $this->content_style_domain
76  ->styleForObjId($copa->getId())
77  ->getStyleId();
78  if ($style_id > 0) {
79  $styleIds[$style_id] = $style_id;
80  }
81  }
82 
83  $deps = [];
84 
85  if (count($pageObjectIds) > 0) {
86  $deps[] = [
87  'component' => 'Services/COPage',
88  'entity' => 'pg',
89  'ids' => $pageObjectIds,
90  ];
91  }
92 
93  if (count($styleIds) > 0) {
94  $deps[] = [
95  'component' => 'Services/Style',
96  'entity' => 'sty',
97  'ids' => array_values($styleIds),
98  ];
99  }
100 
101  if (self::OBJ_TYPE === $a_entity) {
102  $deps[] = [
103  'component' => 'Services/Object',
104  'entity' => 'common',
105  'ids' => $a_ids
106  ];
107  }
108 
109  return $deps;
110  }
111 }
Facade for consumer domain interface.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
getValidSchemaVersions(string $a_entity)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilContentPageDataSet.