ILIAS  eassessment Revision 61809
 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  }
23 
24 
33  function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
34  {
35 
36  // get all media objects and files of the page
37  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
38  include_once("./Modules/File/classes/class.ilObjFile.php");
39  $mob_ids = array();
40  $file_ids = array();
41  foreach ($a_ids as $pg_id)
42  {
43  $pg_id = explode(":", $pg_id);
44 
45  // get media objects
46  $mids = ilObjMediaObject::_getMobsOfObject($pg_id[0].":pg", $pg_id[1]);
47  foreach ($mids as $mid)
48  {
49  if (ilObject::_lookupType($mid) == "mob")
50  {
51  $mob_ids[] = $mid;
52  }
53  }
54 
55  // get files
56  $files = ilObjFile::_getFilesOfObject($pg_id[0].":pg", $pg_id[1]);
57  foreach ($files as $file)
58  {
59  if (ilObject::_lookupType($file) == "file")
60  {
61  $file_ids[] = $file;
62  }
63  }
64  }
65 
66  return array (
67  array(
68  "component" => "Services/MediaObjects",
69  "entity" => "mob",
70  "ids" => $mob_ids),
71  array(
72  "component" => "Modules/File",
73  "entity" => "file",
74  "ids" => $file_ids)
75  );
76  }
77 
86  public function getXmlRepresentation($a_entity, $a_target_release, $a_id)
87  {
88  include_once("./Services/COPage/classes/class.ilPageObject.php");
89 
90  $id = explode(":", $a_id);
91 
92  $page_object = new ilPageObject($id[0], $id[1]);
93  $page_object->buildDom();
94  $page_object->insertInstIntoIDs(IL_INST_ID);
95  $pxml = $page_object->getXMLFromDom(false, false, false, "", true);
96  $pxml = str_replace("&","&amp;", $pxml);
97  $xml = "<PageObject>";
98  $xml.= $pxml;
99  $xml.= "</PageObject>";
100  $page_object->freeDom();
101 
102  return $xml;
103  }
104 
112  function getValidSchemaVersions($a_entity)
113  {
114  return array (
115  "4.1.0" => array(
116  "namespace" => "http://www.ilias.de/Services/COPage/pg/4_1",
117  "xsd_file" => "ilias_pg_4_1.xsd",
118  "min" => "4.1.0",
119  "max" => "")
120  );
121  }
122 
123 }
124 
125 ?>