ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilMediaPoolExporter.php
Go to the documentation of this file.
1 <?php
2 
25 {
28 
29  public function init(): void
30  {
31  $this->ds = new ilMediaPoolDataSet();
32  $this->ds->initByExporter($this);
33  $this->ds->setDSPrefix("ds");
35  $config = $this->getExport()->getExportConfigs()->getElementByComponent('components/ILIAS/MediaPool');
36  $this->config = $config;
37  if ($this->config->getMasterLanguageOnly()) {
39  $co_config = $this->getExport()->getExportConfigs()->getElementByComponent('components/ILIAS/COPage');
40  $conf = $co_config;
41  $conf->setMasterLanguageOnly(true, $this->config->getIncludeMedia());
42  $this->ds->setMasterLanguageOnly(true);
43  }
44  }
45 
47  string $a_entity,
48  string $a_target_release,
49  array $a_ids
50  ): array {
51  $mob_ids = array();
52 
53  foreach ($a_ids as $id) {
54  $m_ids = ilObjMediaPool::getAllMobIds($id);
55  foreach ($m_ids as $m) {
56  $mob_ids[] = $m;
57  }
58  }
59 
60  if ($this->config->getMasterLanguageOnly()) {
61  return array();
62  }
63 
64  return array(
65  array(
66  "component" => "components/ILIAS/MediaObjects",
67  "entity" => "mob",
68  "ids" => $mob_ids)
69  );
70  }
71 
73  string $a_entity,
74  string $a_target_release,
75  array $a_ids
76  ): array {
77  $pg_ids = array();
78 
79  foreach ($a_ids as $id) {
80  $pages = ilMediaPoolItem::getIdsForType($id, "pg");
81  foreach ($pages as $p) {
82  $pg_ids[] = "mep:" . $p;
83  }
84  }
85 
86  $deps = array(
87  array(
88  "component" => "components/ILIAS/COPage",
89  "entity" => "pg",
90  "ids" => $pg_ids)
91  );
92 
93  if (!$this->config->getMasterLanguageOnly()) {
94  $deps[] = array(
95  "component" => "components/ILIAS/ILIASObject",
96  "entity" => "transl",
97  "ids" => $a_ids);
98  $deps[] = array(
99  "component" => "components/ILIAS/ILIASObject",
100  "entity" => "transl_entry",
101  "ids" => $a_ids);
102  }
103 
104  $deps[] = array(
105  "component" => "components/ILIAS/ILIASObject",
106  "entity" => "tile",
107  "ids" => $a_ids);
108 
109  $md_ids = [];
110  foreach ($a_ids as $id) {
111  $md_ids[] = $id . ':0:mep';
112  }
113  if (!empty($md_ids)) {
114  $deps[] = [
115  'component' => 'components/ILIAS/MetaData',
116  'entity' => 'md',
117  'ids' => $md_ids,
118  ];
119  }
120 
121  return $deps;
122  }
123 
124  public function getXmlRepresentation(
125  string $a_entity,
126  string $a_schema_version,
127  string $a_id
128  ): string {
129  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
130  }
131 
132  public function getValidSchemaVersions(string $a_entity): array
133  {
134  return array(
135  "5.1.0" => array(
136  "namespace" => "https://www.ilias.de/Modules/MediaPool/mep/5_1",
137  "xsd_file" => "ilias_mep_5_1.xsd",
138  "uses_dataset" => true,
139  "min" => "5.1.0",
140  "max" => ""),
141  "4.1.0" => array(
142  "namespace" => "https://www.ilias.de/Modules/MediaPool/mep/4_1",
143  "xsd_file" => "ilias_mep_4_1.xsd",
144  "uses_dataset" => true,
145  "min" => "4.1.0",
146  "max" => "")
147  );
148  }
149 }
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllMobIds(int $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getValidSchemaVersions(string $a_entity)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids)
static getIdsForType(int $a_id, string $a_type)
Get all ids for type.
ilMediaPoolExportConfig $config