ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCategoryExporter.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.ilXmlExporter.php';
5 
13 {
22  public function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
23  {
24  // always trigger container because of co-page(s)
25  return array(
26  array(
27  'component' => 'Services/Container',
28  'entity' => 'struct',
29  'ids' => $a_ids
30  )
31  );
32 
33  /*
34  include_once './Services/Export/classes/class.ilExportOptions.php';
35  $eo = ilExportOptions::getInstance();
36 
37  $obj_id = end($a_ids);
38 
39 
40  $GLOBALS['ilLog']->write(__METHOD__.': '.$obj_id);
41  if($eo->getOption(ilExportOptions::KEY_ROOT) != $obj_id)
42  {
43  return array();
44  }
45 
46  if(count(ilExportOptions::getInstance()->getSubitemsForExport()) > 1)
47  {
48  return array(
49  array(
50  'component' => 'Services/Container',
51  'entity' => 'struct',
52  'ids' => $a_ids
53  )
54  );
55  }
56  return array();
57  */
58  }
59 
68  public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
69  {
70  if ($a_entity == "cat") {
71  include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
72  $tax_ids = array();
73  foreach ($a_ids as $id) {
74  $t_ids = ilObjTaxonomy::getUsageOfObject($id);
75  if (count($t_ids) > 0) {
76  $tax_ids[$t_ids[0]] = $t_ids[0];
77  }
78  }
79 
80  return array(
81  array(
82  "component" => "Services/Taxonomy",
83  "entity" => "tax",
84  "ids" => $tax_ids)
85  );
86  }
87  return array();
88  }
89 
97  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
98  {
99  $cat_ref_id = end(ilObject::_getAllReferences($a_id));
100  $category = ilObjectFactory::getInstanceByRefId($cat_ref_id, false);
101 
102  if (!$category instanceof ilObjCategory) {
103  $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type category!');
104  return '';
105  }
106 
107  include_once './Modules/Category/classes/class.ilCategoryXmlWriter.php';
108 
109  $writer = new ilCategoryXmlWriter($category);
110  $writer->setMode(ilCategoryXmlWriter::MODE_EXPORT);
111  $writer->export(false);
112  return $writer->getXml();
113  }
114 
122  public function getValidSchemaVersions($a_entity)
123  {
124  return array(
125  "4.3.0" => array(
126  "namespace" => "http://www.ilias.de/Modules/Category/cat/4_3",
127  "xsd_file" => "ilias_cat_4_3.xsd",
128  "uses_dataset" => false,
129  "min" => "4.3.0",
130  "max" => "")
131  );
132  }
133 
137  public function init()
138  {
139  }
140 }
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
Class for category export.
getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
Get head dependencies.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml.
Class for category export.
if(!array_key_exists('StateId', $_REQUEST)) $id
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
static _getAllReferences($a_id)
get all reference ids of object
Xml Exporter class.
Class ilObjCategory.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.