ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilGlossaryExporter.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
12 {
13  private $ds;
14 
18  public function init()
19  {
20  $this->ds = new ilGlossaryDataSet();
21  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
22  $this->ds->setDSPrefix("ds");
23  }
24 
33  public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
34  {
35  if ($a_entity == "glo") {
36  $md_ids = array();
37 
38  // glo related ids
39  foreach ($a_ids as $id) {
40  $md_ids[] = $id . ":0:glo";
41  }
42 
43  // definition related ids
44  $page_ids = array();
45  foreach ($a_ids as $id) {
46  // workaround for #0023923
47  $all_refs = ilObject::_getAllReferences($id);
48  $ref_id = current($all_refs);
49 
50  // see #29014, we include referenced terms in the export as well
52  $ref_id,
53  "",
54  "",
55  "",
56  0,
57  false,
58  null,
59  true
60  );
61 
62  foreach ($terms as $t) {
64  foreach ($defs as $d) {
65  $page_ids[] = "gdf:" . $d["id"];
66  $md_ids[] = $id . ":" . $d["id"] . ":gdf";
67  }
68  }
69  }
70  // definition pages and their metadat
71  $deps = array(
72  array(
73  "component" => "Services/COPage",
74  "entity" => "pg",
75  "ids" => $page_ids),
76  array(
77  "component" => "Services/MetaData",
78  "entity" => "md",
79  "ids" => $md_ids),
80  );
81 
82  // taxonomy
83  $tax_ids = array();
84  foreach ($a_ids as $id) {
85  $t_ids = ilObjTaxonomy::getUsageOfObject($id);
86  if (count($t_ids) > 0) {
87  $tax_ids[$t_ids[0]] = $t_ids[0];
88  }
89  }
90  if (sizeof($tax_ids)) {
91  $deps[] = array(
92  "component" => "Services/Taxonomy",
93  "entity" => "tax",
94  "ids" => $tax_ids
95  );
96  }
97 
98  // advanced metadata
99  $advmd_ids = array();
100  foreach ($a_ids as $id) {
101  $rec_ids = $this->getActiveAdvMDRecords($id);
102  if (sizeof($rec_ids)) {
103  foreach ($rec_ids as $rec_id) {
104  $advmd_ids[] = $id . ":" . $rec_id;
105  }
106  }
107  }
108  if (sizeof($advmd_ids)) {
109  $deps[] = array(
110  "component" => "Services/AdvancedMetaData",
111  "entity" => "advmd",
112  "ids" => $advmd_ids
113  );
114  }
115 
116  // style
117  $obj_ids = (is_array($a_ids))
118  ? $a_ids
119  : array($a_ids);
120  $deps[] = array(
121  "component" => "Services/Style",
122  "entity" => "object_style",
123  "ids" => $obj_ids
124  );
125 
126  // service settings
127  $deps[] = array(
128  "component" => "Services/Object",
129  "entity" => "common",
130  "ids" => $a_ids);
131 
132  return $deps;
133  }
134  return array();
135  }
136 
137  protected function getActiveAdvMDRecords($a_id)
138  {
139  $active = array();
140  // selected globals
141  $sel_globals = ilAdvancedMDRecord::getObjRecSelection($a_id, "term");
142 
143  foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType("glo", "term") as $record_obj) {
144  // local ones and globally activated for the object
145  if ($record_obj->getParentObject() == $a_id || in_array($record_obj->getRecordId(), $sel_globals)) {
146  $active[] = $record_obj->getRecordId();
147  }
148  }
149 
150  return $active;
151  }
152 
161  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
162  {
163  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
164  }
165 
173  public function getValidSchemaVersions($a_entity)
174  {
175  return array(
176  "5.4.0" => array(
177  "namespace" => "http://www.ilias.de/Modules/Glossary/htlm/5_4",
178  "xsd_file" => "ilias_glo_5_4.xsd",
179  "uses_dataset" => true,
180  "min" => "5.4.0",
181  "max" => ""),
182  "5.1.0" => array(
183  "namespace" => "http://www.ilias.de/Modules/Glossary/htlm/5_1",
184  "xsd_file" => "ilias_glo_5_1.xsd",
185  "uses_dataset" => true,
186  "min" => "5.1.0",
187  "max" => ""),
188  "4.1.0" => array(
189  "namespace" => "http://www.ilias.de/Modules/Glossary/htlm/4_1",
190  "xsd_file" => "ilias_glo_4_1.xsd",
191  "uses_dataset" => false,
192  "min" => "4.1.0",
193  "max" => "")
194  );
195  }
196 }
Glossary XML export.
static getDefinitionList($a_term_id)
static
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
static _getAllReferences($a_id)
get all reference ids of object
Xml Exporter class.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
Glossary Data set class.
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 _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
static getObjRecSelection($a_obj_id, $a_sub_type="")
Get repository object record selection.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296