ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilCOPageExporter.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;
16 
20  function init()
21  {
22  include_once("./Services/COPage/classes/class.ilCOPageDataSet.php");
23  $this->ds = new ilCOPageDataSet();
24  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
25  $this->ds->setDSPrefix("ds");
26  }
27 
28 
37  function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
38  {
39  if ($a_entity == "pg")
40  {
41  // get all media objects and files of the page
42  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
43  include_once("./Modules/File/classes/class.ilObjFile.php");
44  $mob_ids = array();
45  $file_ids = array();
46  foreach ($a_ids as $pg_id)
47  {
48  $pg_id = explode(":", $pg_id);
49 
50  // get media objects
51  $mids = ilObjMediaObject::_getMobsOfObject($pg_id[0].":pg", $pg_id[1]);
52  foreach ($mids as $mid)
53  {
54  if (ilObject::_lookupType($mid) == "mob")
55  {
56  $mob_ids[] = $mid;
57  }
58  }
59 
60  // get files
61  $files = ilObjFile::_getFilesOfObject($pg_id[0].":pg", $pg_id[1]);
62  foreach ($files as $file)
63  {
64  if (ilObject::_lookupType($file) == "file")
65  {
66  $file_ids[] = $file;
67  }
68  }
69  }
70 
71  return array (
72  array(
73  "component" => "Services/MediaObjects",
74  "entity" => "mob",
75  "ids" => $mob_ids),
76  array(
77  "component" => "Modules/File",
78  "entity" => "file",
79  "ids" => $file_ids)
80  );
81  }
82 
83  return array();
84  }
85 
94  function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
95  {
96  if ($a_entity == "pgtp")
97  {
98  $pg_ids = array();
99  foreach ($a_ids as $id)
100  {
101  $pg_ids[] = "stys:".$id;
102  }
103 
104  return array(
105  array(
106  "component" => "Services/COPage",
107  "entity" => "pg",
108  "ids" => $pg_ids)
109  );
110  }
111 
112  return array();
113  }
114 
115 
124  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
125  {
126  if ($a_entity == "pg")
127  {
128  include_once("./Services/COPage/classes/class.ilPageObject.php");
129 
130  $id = explode(":", $a_id);
131 
132  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
133  $page_object = ilPageObjectFactory::getInstance($id[0], $id[1]);
134  $page_object->buildDom();
135  $page_object->insertInstIntoIDs(IL_INST_ID);
136  $pxml = $page_object->getXMLFromDom(false, false, false, "", true);
137  $pxml = str_replace("&","&amp;", $pxml);
138  $xml = "<PageObject>";
139  $xml.= $pxml;
140  $xml.= "</PageObject>";
141  $page_object->freeDom();
142 
143  return $xml;
144  }
145  if ($a_entity == "pgtp")
146  {
147  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
148  }
149  }
150 
158  function getValidSchemaVersions($a_entity)
159  {
160  if ($a_entity == "pg")
161  {
162  return array (
163  "4.2.0" => array(
164  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_2",
165  "xsd_file" => "ilias_pg_4_2.xsd",
166  "min" => "4.2.0",
167  "max" => ""),
168  "4.1.0" => array(
169  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_1",
170  "xsd_file" => "ilias_pg_4_1.xsd",
171  "min" => "4.1.0",
172  "max" => "4.1.99")
173  );
174  }
175  if ($a_entity == "pgtp")
176  {
177  return array (
178  "4.2.0" => array(
179  "namespace" => "http://www.ilias.de/Services/COPage/pgtp/4_1",
180  "xsd_file" => "ilias_pgtp_4_1.xsd",
181  "uses_dataset" => true,
182  "min" => "4.2.0",
183  "max" => "")
184  );
185  }
186  }
187 
188 }
189 
190 ?>
print $file
getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
Get head dependencies.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
COPage Data set class.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
_getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
Xml Exporter class.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
init()
Initialisation.
static _lookupType($a_id, $a_reference=false)
lookup object type
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
Exporter class for meta data.