ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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
 ilXmlWriter ($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...
 
 _xmlEscapeData ($data)
 Escapes reserved characters. 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...
 

Private Attributes

 $mode = self::MODE_SOAP
 
 $xml
 
 $category
 

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 28 of file class.ilCategoryXmlWriter.php.

29  {
30  global $ilias;
31 
32  parent::__construct();
33 
34  $this->category = $cat;
35  }

Member Function Documentation

◆ buildCategory()

ilCategoryXmlWriter::buildCategory ( )
protected

Build category xml.

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

References ilXmlWriter\xmlStartTag().

Referenced by export().

116  {
117  $this->xmlStartTag('Category');
118  }
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 123 of file class.ilCategoryXmlWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by export().

124  {
125  $this->xmlEndTag('Category');
126  }
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 100 of file class.ilCategoryXmlWriter.php.

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

Referenced by export().

101  {
102  global $ilSetting;
103 
104  $this->xmlSetDtdDef("<!DOCTYPE category PUBLIC \"-//ILIAS//DTD Group//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_cat_4_5.dtd\">");
105  $this->xmlSetGenCmt("Export of ILIAS category ". $this->getCategory()->getId()." of installation ".$ilSetting->get('inst_id').".");
106  $this->xmlHeader();
107 
108 
109  return true;
110  }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header public.
getCategory()
Get category object.
global $ilSetting
Definition: privfeed.php:40
+ 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 131 of file class.ilCategoryXmlWriter.php.

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

Referenced by export().

132  {
133  $this->xmlStartTag('Translations');
134 
135  $translations = $this->getCategory()->getTranslations();
136 
137 
138  $first = true;
139  foreach((array) $translations['Fobject'] as $translation)
140  {
141  $this->xmlStartTag('Translation', array('default' => (int) $first, 'language' => $translation['lang']));
142  $this->xmlElement('Title', array(),$translation['title']);
143  $this->xmlElement('Description',array(),$translation['desc']);
144  $this->xmlEndTag('Translation');
145 
146  $first = false;
147  }
148  $this->xmlEndTag('Translations');
149  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
xmlEndTag($tag)
Writes an endtag.
getCategory()
Get category object.
+ 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 68 of file class.ilCategoryXmlWriter.php.

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

69  {
70  if($this->getMode() == self::MODE_EXPORT)
71  {
72  if($a_with_header)
73  {
74  $this->buildHeader();
75  }
76  $this->buildCategory();
77  $this->buildTranslations();
78  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
80  include_once './Services/Container/classes/class.ilContainer.php';
81  ilContainer::_exportContainerSettings($this, $this->category->getId());
82  $this->buildFooter();
83  }
84  }
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 59 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 50 of file class.ilCategoryXmlWriter.php.

References $mode.

Referenced by export().

51  {
52  return $this->mode;
53  }
+ Here is the caller graph for this function:

◆ getXml()

ilCategoryXmlWriter::getXml ( )

get XML

Returns
string

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

References ilXmlWriter\xmlDumpMem().

91  {
92  return $this->xmlDumpMem(false);
93  }
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 41 of file class.ilCategoryXmlWriter.php.

42  {
43  $this->mode = $a_mode;
44  }

Field Documentation

◆ $category

ilCategoryXmlWriter::$category
private

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

Referenced by getCategory().

◆ $mode

ilCategoryXmlWriter::$mode = self::MODE_SOAP
private

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

Referenced by getMode().

◆ $xml

ilCategoryXmlWriter::$xml
private

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

◆ MODE_EXPORT

const ilCategoryXmlWriter::MODE_EXPORT = 2

◆ MODE_SOAP

const ilCategoryXmlWriter::MODE_SOAP = 1

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


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