ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCOPageImporter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Export/classes/class.ilXmlImporter.php");
5 
14 {
21  function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
22  {
23 //echo $a_id;
24 //var_dump($a_xml);
25 
26  $pg_id = $a_mapping->getMapping("Services/COPage", "pg", $a_id);
27  if ($pg_id != "")
28  {
29  $id = explode(":", $pg_id);
30  if (count($id) == 2)
31  {
32  include_once("./Services/COPage/classes/class.ilPageObject.php");
33  $new_page = new ilPageObject($id[0]);
34  $new_page->setId($id[1]);
35  $new_page->setXMLContent($a_xml);
36  //$new_page->saveMobUsage($a_xml); (will be done in final processing)
37  $new_page->createFromXML();
38  }
39  }
40  }
41 
47  function finalProcessing($a_mapping)
48  {
49  $pages = $a_mapping->getMappingsOfEntity("Services/COPage", "pg");
50  $media_objects = $a_mapping->getMappingsOfEntity("Services/MediaObjects", "mob");
51  $file_objects = $a_mapping->getMappingsOfEntity("Modules/File", "file");
52  if (count($media_objects) > 0 || count($file_objects) > 0)
53  {
54  foreach ($pages as $p)
55  {
56  $id = explode(":", $p);
57  if (count($id) == 2)
58  {
59  include_once("./Services/COPage/classes/class.ilPageObject.php");
60  $new_page = new ilPageObject($id[0], $id[1]);
61  $new_page->buildDom();
62  $med = $new_page->resolveMediaAliases($media_objects);
63  $fil = $new_page->resolveFileItems($file_objects);
64 
65  if ($med || $fil)
66  {
67  $new_page->update(false, true);
68  }
69  }
70  }
71  }
72  }
73 }
74 
75 ?>