ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMediaPoolExporter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Export/classes/class.ilXmlExporter.php");
5 
14 {
15  private $ds;
19  private $config;
20 
24  public function init()
25  {
26  include_once("./Modules/MediaPool/classes/class.ilMediaPoolDataSet.php");
27  $this->ds = new ilMediaPoolDataSet();
28  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
29  $this->ds->setDSPrefix("ds");
30  $this->config = $this->getExport()->getConfig("Modules/MediaPool");
31  if ($this->config->getMasterLanguageOnly()) {
32  $conf = $this->getExport()->getConfig("Services/COPage");
33  $conf->setMasterLanguageOnly(true, $this->config->getIncludeMedia());
34  $this->ds->setMasterLanguageOnly(true);
35  }
36  }
37 
46  public function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
47  {
48  include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
49  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
50  $pg_ids = 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" => "Services/MediaObjects",
67  "entity" => "mob",
68  "ids" => $mob_ids)
69  );
70  }
71 
72 
81  public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
82  {
83  include_once("./Modules/MediaPool/classes/class.ilObjMediaPool.php");
84  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
85  $pg_ids = array();
86  $mob_ids = array();
87 
88  foreach ($a_ids as $id) {
89  $pages = ilMediaPoolItem::getIdsForType($id, "pg");
90  foreach ($pages as $p) {
91  $pg_ids[] = "mep:" . $p;
92  }
93  }
94 
95  $deps = array(
96  array(
97  "component" => "Services/COPage",
98  "entity" => "pg",
99  "ids" => $pg_ids)
100  );
101 
102  if (!$this->config->getMasterLanguageOnly()) {
103  $deps[] = array(
104  "component" => "Services/Object",
105  "entity" => "transl",
106  "ids" => $a_ids);
107  }
108 
109  $deps[] = array(
110  "component" => "Services/Object",
111  "entity" => "tile",
112  "ids" => $a_ids);
113 
114  return $deps;
115  }
116 
125  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
126  {
127  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
128  }
129 
137  public function getValidSchemaVersions($a_entity)
138  {
139  return array(
140  "5.1.0" => array(
141  "namespace" => "http://www.ilias.de/Modules/MediaPool/mep/5_1",
142  "xsd_file" => "ilias_mep_5_1.xsd",
143  "uses_dataset" => true,
144  "min" => "5.1.0",
145  "max" => ""),
146  "4.1.0" => array(
147  "namespace" => "http://www.ilias.de/Modules/MediaPool/mep/4_1",
148  "xsd_file" => "ilias_mep_4_1.xsd",
149  "uses_dataset" => true,
150  "min" => "4.1.0",
151  "max" => "")
152  );
153  }
154 }
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
Get head dependencies.
if(!array_key_exists('StateId', $_REQUEST)) $id
static getAllMobIds($a_id)
static getIdsForType($a_id, $a_type)
Get all ids for type.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
Xml Exporter class.
Media Pool Data set class.
Export2 class for media pools.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
getExport()
Get export.