ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once("./Services/Export/classes/class.ilXmlExporter.php");
5 
14 {
15  private $ds;
16 
20  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  function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
37  {
38  if ($a_entity == "glo")
39  {
40  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
41  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
42 
43  $md_ids = array();
44 
45  // glo related ids
46  foreach ($a_ids as $id)
47  {
48  $md_ids[] = $id.":0:glo";
49  }
50 
51  // definition related ids
52  $page_ids = array();
53  foreach ($a_ids as $id)
54  {
55  $terms = ilGlossaryTerm::getTermList($id);
56  foreach ($terms as $t)
57  {
59  foreach ($defs as $d)
60  {
61  $page_ids[] = "gdf:".$d["id"];
62  $md_ids[] = $id.":".$d["id"].":gdf";
63  }
64  }
65  }
66  // definition pages and their metadat
67  $deps = array (
68  array(
69  "component" => "Services/COPage",
70  "entity" => "pg",
71  "ids" => $page_ids),
72  array(
73  "component" => "Services/MetaData",
74  "entity" => "md",
75  "ids" => $md_ids),
76  );
77 
78  // taxonomy
79  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
80  $tax_ids = array();
81  foreach ($a_ids as $id)
82  {
83  $t_ids = ilObjTaxonomy::getUsageOfObject($id);
84  if (count($t_ids) > 0)
85  {
86  $tax_ids[$t_ids[0]] = $t_ids[0];
87  }
88  }
89  if(sizeof($tax_ids))
90  {
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  {
102  $rec_ids = $this->getActiveAdvMDRecords($id);
103  if(sizeof($rec_ids))
104  {
105  foreach($rec_ids as $rec_id)
106  {
107  $advmd_ids[] = $id.":".$rec_id;
108  }
109  }
110  }
111  if(sizeof($advmd_ids))
112  {
113  $deps[] = array(
114  "component" => "Services/AdvancedMetaData",
115  "entity" => "advmd",
116  "ids" => $advmd_ids
117  );
118  }
119 
120  // style
121  $obj_ids = (is_array($a_ids))
122  ? $a_ids
123  : array($a_ids);
124  $deps[] = array(
125  "component" => "Services/Style",
126  "entity" => "object_style",
127  "ids" => $obj_ids
128  );
129 
130  // service settings
131  $deps[] = array(
132  "component" => "Services/Object",
133  "entity" => "service_settings",
134  "ids" => $a_ids);
135 
136  return $deps;
137  }
138  return array();
139  }
140 
141  protected function getActiveAdvMDRecords($a_id)
142  {
143  $active = array();
144 
145  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
146  foreach(ilAdvancedMDRecord::_getSelectedRecordsByObject("glo", $a_id, "term") as $record_obj)
147  {
148  $active[] = $record_obj->getRecordId();
149  }
150 
151  return $active;
152  }
153 
162  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
163  {
164  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
165 
166  /*include_once './Modules/Glossary/classes/class.ilObjGlossary.php';
167  $glo = new ilObjGlossary($a_id,false);
168 
169  include_once './Modules/Glossary/classes/class.ilGlossaryExport.php';
170  $exp = new ilGlossaryExport($glo,'xml');
171  $zip = $exp->buildExportFile();*/
172  }
173 
181  function getValidSchemaVersions($a_entity)
182  {
183  return array (
184  "5.1.0" => array(
185  "namespace" => "http://www.ilias.de/Modules/Glossary/htlm/4_1",
186  "xsd_file" => "ilias_glo_5_1.xsd",
187  "uses_dataset" => true,
188  "min" => "5.1.0",
189  "max" => ""),
190  "4.1.0" => array(
191  "namespace" => "http://www.ilias.de/Modules/Glossary/htlm/4_1",
192  "xsd_file" => "ilias_glo_4_1.xsd",
193  "uses_dataset" => false,
194  "min" => "4.1.0",
195  "max" => "")
196  );
197  }
198 
199 }
200 
201 ?>
Exporter class for html learning modules.
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.
for($col=0; $col< 50; $col++) $d
Xml Exporter class.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
static getTermList($a_glo_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.
Glossary Data set class.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
Create styles array
The data for the language used.