ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilWikiExporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Export/classes/class.ilXmlExporter.php");
5
14{
15 private $ds;
16
20 function init()
21 {
22 include_once("./Modules/Wiki/classes/class.ilWikiDataSet.php");
23 $this->ds = new ilWikiDataSet();
24 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
25 $this->ds->setDSPrefix("ds");
26 }
27
28
37 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
38 {
39 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
40 $pg_ids = array();
41 foreach ($a_ids as $id)
42 {
43 $pages = ilWikiPage::getAllPages($id);
44 foreach ($pages as $p)
45 {
46 if (ilWikiPage::_exists("wpg", $p["id"]))
47 {
48 $pg_ids[] = "wpg:".$p["id"];
49 }
50 }
51 }
52
53 $deps = array (
54 array(
55 "component" => "Services/COPage",
56 "entity" => "pg",
57 "ids" => $pg_ids),
58 array(
59 "component" => "Services/Rating",
60 "entity" => "rating_category",
61 "ids" => $a_ids
62 )
63 );
64
65 $advmd_ids = array();
66 foreach($a_ids as $id)
67 {
68 $rec_ids = $this->getActiveAdvMDRecords($id);
69 if(sizeof($rec_ids))
70 {
71 foreach($rec_ids as $rec_id)
72 {
73 $advmd_ids[] = $id.":".$rec_id;
74 }
75 }
76 }
77 if(sizeof($advmd_ids))
78 {
79 $deps[] = array(
80 "component" => "Services/AdvancedMetaData",
81 "entity" => "advmd",
82 "ids" => $advmd_ids
83 );
84 }
85
86 return $deps;
87 }
88
89 protected function getActiveAdvMDRecords($a_id)
90 {
91 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
92 $active = array();
93 foreach(ilAdvancedMDRecord::_getActivatedRecordsByObjectType("wiki", "wpg") as $record_obj)
94 {
95 $active[] = $record_obj->getRecordId();
96 }
97 return array_intersect($active, ilAdvancedMDRecord::getObjRecSelection($a_id, "wpg"));
98 }
99
108 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
109 {
110 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
111 }
112
120 function getValidSchemaVersions($a_entity)
121 {
122 return array (
123 "4.1.0" => array(
124 "namespace" => "http://www.ilias.de/Modules/Wiki/wiki/4_1",
125 "xsd_file" => "ilias_wiki_4_1.xsd",
126 "uses_dataset" => true,
127 "min" => "4.1.0",
128 "max" => "4.2.99"),
129 "4.3.0" => array(
130 "namespace" => "http://www.ilias.de/Modules/Wiki/wiki/4_3",
131 "xsd_file" => "ilias_wiki_4_3.xsd",
132 "uses_dataset" => true,
133 "min" => "4.3.0",
134 "max" => "")
135 );
136 }
137
138}
139
140?>
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="")
Get activated records by object type.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
Wiki Data set class.
Exporter class for wikis.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
init()
Initialisation.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
static getAllPages($a_wiki_id)
Get all pages of wiki
Xml Exporter class.