ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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  $deps[] = array(
108  "component" => "Services/Object",
109  "entity" => "transl_entry",
110  "ids" => $a_ids);
111  }
112 
113  $deps[] = array(
114  "component" => "Services/Object",
115  "entity" => "tile",
116  "ids" => $a_ids);
117 
118  return $deps;
119  }
120 
129  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
130  {
131  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
132  }
133 
141  public function getValidSchemaVersions($a_entity)
142  {
143  return array(
144  "5.1.0" => array(
145  "namespace" => "http://www.ilias.de/Modules/MediaPool/mep/5_1",
146  "xsd_file" => "ilias_mep_5_1.xsd",
147  "uses_dataset" => true,
148  "min" => "5.1.0",
149  "max" => ""),
150  "4.1.0" => array(
151  "namespace" => "http://www.ilias.de/Modules/MediaPool/mep/4_1",
152  "xsd_file" => "ilias_mep_4_1.xsd",
153  "uses_dataset" => true,
154  "min" => "4.1.0",
155  "max" => "")
156  );
157  }
158 }
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
Get head dependencies.
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.