ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups 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  $page_object = new ilPageObject($id[0], $id[1]);
133  $page_object->buildDom();
134  $page_object->insertInstIntoIDs(IL_INST_ID);
135  $pxml = $page_object->getXMLFromDom(false, false, false, "", true);
136  $pxml = str_replace("&","&amp;", $pxml);
137  $xml = "<PageObject>";
138  $xml.= $pxml;
139  $xml.= "</PageObject>";
140  $page_object->freeDom();
141 
142  return $xml;
143  }
144  if ($a_entity == "pgtp")
145  {
146  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
147  }
148  }
149 
157  function getValidSchemaVersions($a_entity)
158  {
159  if ($a_entity == "pg")
160  {
161  return array (
162  "4.2.0" => array(
163  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_2",
164  "xsd_file" => "ilias_pg_4_2.xsd",
165  "min" => "4.2.0",
166  "max" => ""),
167  "4.1.0" => array(
168  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_1",
169  "xsd_file" => "ilias_pg_4_1.xsd",
170  "min" => "4.1.0",
171  "max" => "4.1.99")
172  );
173  }
174  if ($a_entity == "pgtp")
175  {
176  return array (
177  "4.2.0" => array(
178  "namespace" => "http://www.ilias.de/Services/COPage/pgtp/4_1",
179  "xsd_file" => "ilias_pgtp_4_1.xsd",
180  "uses_dataset" => true,
181  "min" => "4.2.0",
182  "max" => "")
183  );
184  }
185  }
186 
187 }
188 
189 ?>