ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilGlossaryExporter.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 public function init()
21 {
22 include_once("./Modules/Glossary/classes/class.ilGlossaryDataSet.php");
23 $this->ds = new ilGlossaryDataSet();
24 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
25 $this->ds->setDSPrefix("ds");
26 }
27
36 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
37 {
38 if ($a_entity == "glo") {
39 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
40 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
41
42 $md_ids = array();
43
44 // glo related ids
45 foreach ($a_ids as $id) {
46 $md_ids[] = $id . ":0:glo";
47 }
48
49 // definition related ids
50 $page_ids = array();
51 foreach ($a_ids as $id) {
52 // workaround for #0023923
54 $ref_id = current($all_refs);
55 $terms = ilGlossaryTerm::getTermList($ref_id);
56 foreach ($terms as $t) {
58 foreach ($defs as $d) {
59 $page_ids[] = "gdf:" . $d["id"];
60 $md_ids[] = $id . ":" . $d["id"] . ":gdf";
61 }
62 }
63 }
64 // definition pages and their metadat
65 $deps = array(
66 array(
67 "component" => "Services/COPage",
68 "entity" => "pg",
69 "ids" => $page_ids),
70 array(
71 "component" => "Services/MetaData",
72 "entity" => "md",
73 "ids" => $md_ids),
74 );
75
76 // taxonomy
77 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
78 $tax_ids = array();
79 foreach ($a_ids as $id) {
81 if (count($t_ids) > 0) {
82 $tax_ids[$t_ids[0]] = $t_ids[0];
83 }
84 }
85 if (sizeof($tax_ids)) {
86 $deps[] = array(
87 "component" => "Services/Taxonomy",
88 "entity" => "tax",
89 "ids" => $tax_ids
90 );
91 }
92
93 // advanced metadata
94 $advmd_ids = array();
95 foreach ($a_ids as $id) {
96 $rec_ids = $this->getActiveAdvMDRecords($id);
97 if (sizeof($rec_ids)) {
98 foreach ($rec_ids as $rec_id) {
99 $advmd_ids[] = $id . ":" . $rec_id;
100 }
101 }
102 }
103 if (sizeof($advmd_ids)) {
104 $deps[] = array(
105 "component" => "Services/AdvancedMetaData",
106 "entity" => "advmd",
107 "ids" => $advmd_ids
108 );
109 }
110
111 // style
112 $obj_ids = (is_array($a_ids))
113 ? $a_ids
114 : array($a_ids);
115 $deps[] = array(
116 "component" => "Services/Style",
117 "entity" => "object_style",
118 "ids" => $obj_ids
119 );
120
121 // service settings
122 $deps[] = array(
123 "component" => "Services/Object",
124 "entity" => "service_settings",
125 "ids" => $a_ids);
126
127 return $deps;
128 }
129 return array();
130 }
131
132 protected function getActiveAdvMDRecords($a_id)
133 {
134 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
135 $active = array();
136 // selected globals
137 $sel_globals = ilAdvancedMDRecord::getObjRecSelection($a_id, "term");
138
139 foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType("glo", "term") as $record_obj) {
140 // local ones and globally activated for the object
141 if ($record_obj->getParentObject() == $a_id || in_array($record_obj->getRecordId(), $sel_globals)) {
142 $active[] = $record_obj->getRecordId();
143 }
144 }
145
146 return $active;
147 }
148
157 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
158 {
159 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
160
161 /*include_once './Modules/Glossary/classes/class.ilObjGlossary.php';
162 $glo = new ilObjGlossary($a_id,false);
163
164 include_once './Modules/Glossary/classes/class.ilGlossaryExport.php';
165 $exp = new ilGlossaryExport($glo,'xml');
166 $zip = $exp->buildExportFile();*/
167 }
168
176 public function getValidSchemaVersions($a_entity)
177 {
178 return array(
179 "5.1.0" => array(
180 "namespace" => "http://www.ilias.de/Modules/Glossary/htlm/4_1",
181 "xsd_file" => "ilias_glo_5_1.xsd",
182 "uses_dataset" => true,
183 "min" => "5.1.0",
184 "max" => ""),
185 "4.1.0" => array(
186 "namespace" => "http://www.ilias.de/Modules/Glossary/htlm/4_1",
187 "xsd_file" => "ilias_glo_4_1.xsd",
188 "uses_dataset" => false,
189 "min" => "4.1.0",
190 "max" => "")
191 );
192 }
193}
An exception for terminatinating execution or to throw for unit testing.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
Glossary Data set class.
static getDefinitionList($a_term_id)
static
Exporter class for html learning modules.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
static getTermList( $a_glo_ref_id, $searchterm="", $a_first_letter="", $a_def="", $a_tax_node=0, $a_add_amet_fields=false, array $a_amet_filter=null, $a_include_references=false)
Get all terms for given set of glossary ids.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static _getAllReferences($a_id)
get all reference ids of object
Xml Exporter class.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
if(!array_key_exists('StateId', $_REQUEST)) $id