ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4include_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 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
69 {
70 if ($a_entity == "cat")
71 {
72 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
73 $tax_ids = array();
74 foreach ($a_ids as $id)
75 {
77 if (count($t_ids) > 0)
78 {
79 $tax_ids[$t_ids[0]] = $t_ids[0];
80 }
81 }
82
83 return array (
84 array(
85 "component" => "Services/Taxonomy",
86 "entity" => "tax",
87 "ids" => $tax_ids)
88 );
89 }
90 return array();
91 }
92
100 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
101 {
102 $cat_ref_id = end(ilObject::_getAllReferences($a_id));
103 $category = ilObjectFactory::getInstanceByRefId($cat_ref_id,false);
104
105 if(!$category instanceof ilObjCategory)
106 {
107 $GLOBALS['ilLog']->write(__METHOD__. $a_id . ' is not instance of type category!');
108 return '';
109 }
110
111 include_once './Modules/Category/classes/class.ilCategoryXmlWriter.php';
112
113 $writer = new ilCategoryXmlWriter($category);
114 $writer->setMode(ilCategoryXmlWriter::MODE_EXPORT);
115 $writer->export(false);
116 return $writer->getXml();
117 }
118
126 public function getValidSchemaVersions($a_entity)
127 {
128 return array (
129 "4.3.0" => array(
130 "namespace" => "http://www.ilias.de/Modules/Category/cat/4_3",
131 "xsd_file" => "ilias_cat_4_3.xsd",
132 "uses_dataset" => false,
133 "min" => "4.3.0",
134 "max" => "")
135 );
136 }
137
141 public function init() {
142
143 }
144
145}
146?>
Class for category export.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml.
getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
Get head dependencies.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
Class for category export.
Class ilObjCategory.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getAllReferences($a_id)
get all reference ids of object
Xml Exporter class.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276