ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCategoryXmlWriter Class Reference

Class for category export. More...

+ Inheritance diagram for ilCategoryXmlWriter:
+ Collaboration diagram for ilCategoryXmlWriter:

Public Member Functions

 __construct (ilObjCategory $cat=null)
 constructor More...
 
 setMode ($a_mode)
 Set export mode. More...
 
 getMode ()
 get export mode More...
 
 getCategory ()
 Get category object. More...
 
 export ($a_with_header=true)
 Start wrting xml. More...
 
 getXml ()
 get XML More...
 
- Public Member Functions inherited from ilXmlWriter
 __construct ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor More...
 
 _ilXmlWriter ()
 destructor public More...
 
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition. More...
 
 xmlSetStSheet ($stSheet)
 Sets stylesheet. More...
 
 xmlSetGenCmt ($genCmt)
 Sets generated comment. More...
 
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding. More...
 
 xmlFormatData ($data)
 Indents text for better reading. More...
 
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly. More...
 
 xmlHeader ()
 Writes xml header public. More...
 
 xmlStartTag ($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
 Writes a starttag. More...
 
 xmlEndTag ($tag)
 Writes an endtag. More...
 
 xmlComment ($comment)
 Writes a comment. More...
 
 xmlData ($data, $encode=true, $escape=true)
 Writes data. More...
 
 xmlElement ($tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile ($file, $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem ($format=true)
 Returns xml document from memory. More...
 
 appendXML ($a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr public More...
 

Data Fields

const MODE_SOAP = 1
 
const MODE_EXPORT = 2
 
- Data Fields inherited from ilXmlWriter
 $xmlStr
 
 $version
 
 $outEnc
 
 $inEnc
 
 $dtdDef = ""
 
 $stSheet = ""
 
 $genCmt = "Generated by ILIAS XmlWriter"
 

Protected Member Functions

 buildHeader ()
 Build xml header <type> $ilSetting. More...
 
 buildCategory ()
 Build category xml. More...
 
 buildFooter ()
 Add footer elements. More...
 
 buildTranslations ()
 Add Translations. More...
 

Protected Attributes

 $settings
 

Private Attributes

 $mode = self::MODE_SOAP
 
 $xml
 
 $category
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlWriter
static _xmlEscapeData ($data)
 Escapes reserved characters. More...
 

Detailed Description

Class for category export.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e $Id$

Definition at line 12 of file class.ilCategoryXmlWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilCategoryXmlWriter::__construct ( ilObjCategory  $cat = null)

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding public

Definition at line 33 of file class.ilCategoryXmlWriter.php.

References $DIC, and settings().

34  {
35  global $DIC;
36 
37  $this->settings = $DIC->settings();
38  parent::__construct();
39 
40  $this->category = $cat;
41  }
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ buildCategory()

ilCategoryXmlWriter::buildCategory ( )
protected

Build category xml.

Definition at line 119 of file class.ilCategoryXmlWriter.php.

References ilXmlWriter\xmlStartTag().

Referenced by export().

120  {
121  $this->xmlStartTag('Category');
122  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFooter()

ilCategoryXmlWriter::buildFooter ( )
protected

Add footer elements.

Definition at line 127 of file class.ilCategoryXmlWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by export().

128  {
129  $this->xmlEndTag('Category');
130  }
xmlEndTag($tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilCategoryXmlWriter::buildHeader ( )
protected

Build xml header <type> $ilSetting.

Returns
<type>

Definition at line 104 of file class.ilCategoryXmlWriter.php.

References $ilSetting, $settings, getCategory(), ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlSetGenCmt().

Referenced by export().

105  {
107 
108  $this->xmlSetDtdDef("<!DOCTYPE category PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_cat_4_5.dtd\">");
109  $this->xmlSetGenCmt("Export of ILIAS category " . $this->getCategory()->getId() . " of installation " . $ilSetting->get('inst_id') . ".");
110  $this->xmlHeader();
111 
112 
113  return true;
114  }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header public.
getCategory()
Get category object.
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTranslations()

ilCategoryXmlWriter::buildTranslations ( )
protected

Add Translations.

Definition at line 135 of file class.ilCategoryXmlWriter.php.

References array, getCategory(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by export().

136  {
137  $this->xmlStartTag('Translations');
138 
139  $translations = $this->getCategory()->getTranslations();
140 
141 
142  $first = true;
143  foreach ((array) $translations['Fobject'] as $translation) {
144  $this->xmlStartTag('Translation', array('default' => (int) $first, 'language' => $translation['lang']));
145  $this->xmlElement('Title', array(), $translation['title']);
146  $this->xmlElement('Description', array(), $translation['desc']);
147  $this->xmlEndTag('Translation');
148 
149  $first = false;
150  }
151  $this->xmlEndTag('Translations');
152  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
getCategory()
Get category object.
Create styles array
The data for the language used.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ export()

ilCategoryXmlWriter::export (   $a_with_header = true)

Start wrting xml.

Definition at line 74 of file class.ilCategoryXmlWriter.php.

References ilContainer\_exportContainerSettings(), ilContainerSortingSettings\_exportContainerSortingSettings(), buildCategory(), buildFooter(), buildHeader(), buildTranslations(), getCategory(), and getMode().

75  {
76  if ($this->getMode() == self::MODE_EXPORT) {
77  if ($a_with_header) {
78  $this->buildHeader();
79  }
80  $this->buildCategory();
81  $this->buildTranslations();
82  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
84  include_once './Services/Container/classes/class.ilContainer.php';
85  ilContainer::_exportContainerSettings($this, $this->category->getId());
86  $this->buildFooter();
87  }
88  }
buildCategory()
Build category xml.
static _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
buildTranslations()
Add Translations.
buildHeader()
Build xml header <type> $ilSetting.
getCategory()
Get category object.
buildFooter()
Add footer elements.
static _exportContainerSortingSettings(ilXmlWriter $xml, $obj_id)
sorting XML-export for all container objects
+ Here is the call graph for this function:

◆ getCategory()

ilCategoryXmlWriter::getCategory ( )

Get category object.

Returns
ilObjCategory

Definition at line 65 of file class.ilCategoryXmlWriter.php.

References $category.

Referenced by buildHeader(), buildTranslations(), and export().

+ Here is the caller graph for this function:

◆ getMode()

ilCategoryXmlWriter::getMode ( )

get export mode

Returns
int

Definition at line 56 of file class.ilCategoryXmlWriter.php.

References $mode.

Referenced by export().

57  {
58  return $this->mode;
59  }
+ Here is the caller graph for this function:

◆ getXml()

ilCategoryXmlWriter::getXml ( )

get XML

Returns
string

Definition at line 94 of file class.ilCategoryXmlWriter.php.

References ilXmlWriter\xmlDumpMem().

95  {
96  return $this->xmlDumpMem(false);
97  }
xmlDumpMem($format=true)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ setMode()

ilCategoryXmlWriter::setMode (   $a_mode)

Set export mode.

Parameters
int$a_mode

Definition at line 47 of file class.ilCategoryXmlWriter.php.

48  {
49  $this->mode = $a_mode;
50  }

Field Documentation

◆ $category

ilCategoryXmlWriter::$category
private

Definition at line 24 of file class.ilCategoryXmlWriter.php.

Referenced by getCategory().

◆ $mode

ilCategoryXmlWriter::$mode = self::MODE_SOAP
private

Definition at line 22 of file class.ilCategoryXmlWriter.php.

Referenced by getMode().

◆ $settings

ilCategoryXmlWriter::$settings
protected

Definition at line 17 of file class.ilCategoryXmlWriter.php.

Referenced by buildHeader().

◆ $xml

ilCategoryXmlWriter::$xml
private

Definition at line 23 of file class.ilCategoryXmlWriter.php.

◆ MODE_EXPORT

const ilCategoryXmlWriter::MODE_EXPORT = 2

◆ MODE_SOAP

const ilCategoryXmlWriter::MODE_SOAP = 1

Definition at line 19 of file class.ilCategoryXmlWriter.php.


The documentation for this class was generated from the following file: