ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilForumExporter.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
29  protected \ILIAS\Style\Content\DomainService $content_style_domain;
30 
31  public function init(): void
32  {
33  global $DIC;
34  $this->content_style_domain = $DIC
35  ->contentStyle()
36  ->domain();
37  }
38 
39 
40  public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
41  {
42  $xml = '';
43 
44  if (ilObject::_lookupType((int) $a_id) === 'frm') {
45  $writer = new ilForumXMLWriter();
46  $writer->setForumId((int) $a_id);
48  $writer->setFileTargetDirectories(
49  $this->exp->getExportDirInContainer(),
51  );
52  $writer->start();
53  $xml .= $writer->getXML();
54  }
55 
56  return $xml;
57  }
58 
59  public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
60  {
61  $deps = [];
62 
63  if ('frm' === $a_entity) {
64  $deps[] = [
65  'component' => 'components/ILIAS/ILIASObject',
66  'entity' => 'common',
67  'ids' => $a_ids
68  ];
69 
70  $deps[] = [
71  "component" => "components/ILIAS/News",
72  "entity" => "news_settings",
73  "ids" => $a_ids
74  ];
75  }
76 
77  $pageObjectIds = [];
78  $styleIds = [];
79 
80  foreach ($a_ids as $frmObjId) {
81  $frm = ilObjectFactory::getInstanceByObjId($frmObjId, false);
82  if (!$frm || !($frm instanceof ilObjForum)) {
83  continue;
84  }
85 
86  $frmPageObjIds = $frm->getPageObjIds();
87  foreach ($frmPageObjIds as $frmPageObjId) {
88  $pageObjectIds[] = self::OBJ_TYPE . ':' . $frmPageObjId;
89  }
90 
91  $style_id = $this->content_style_domain->styleForObjId((int) $frmObjId)->getStyleId();
92  if ($style_id > 0) {
93  $styleIds[$style_id] = $style_id;
94  }
95  }
96 
97  if ($pageObjectIds !== []) {
98  $deps[] = [
99  'component' => 'components/ILIAS/COPage',
100  'entity' => 'pg',
101  'ids' => $pageObjectIds,
102  ];
103  }
104 
105  if ($styleIds !== []) {
106  $deps[] = [
107  'component' => 'components/ILIAS/Style',
108  'entity' => 'sty',
109  'ids' => array_values($styleIds),
110  ];
111  }
112 
113  return $deps;
114  }
115 
121  public function getValidSchemaVersions(string $a_entity): array
122  {
123  return [
124  "5.1.0" => [
125  "namespace" => "http://www.ilias.de/Modules/Forum/frm/5_1",
126  "xsd_file" => "ilias_frm_5_1.xsd",
127  "uses_dataset" => false,
128  "min" => "7.0",
129  "max" => "7.999"
130  ],
131  "8.0" => [
132  "namespace" => "http://www.ilias.de/Modules/Forum/frm/8",
133  "xsd_file" => "ilias_frm_8.xsd",
134  "uses_dataset" => false,
135  "min" => "8.0",
136  "max" => "8.999"
137  ],
138  "9.0" => [
139  "namespace" => "http://www.ilias.de/Modules/Forum/frm/9",
140  "xsd_file" => "ilias_frm_9.xsd",
141  "uses_dataset" => false,
142  "min" => "9.0",
143  "max" => ""
144  ]
145  ];
146  }
147 }
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
XML writer class Class to simplify manual writing of xml documents.
Exporter class for sessions.
global $DIC
Definition: shib_login.php:22
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
ILIAS Style Content DomainService $content_style_domain
static _lookupType(int $id, bool $reference=false)