ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 buildSorting ()
 Add sorting. 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 112 of file class.ilCategoryXmlWriter.php.

References ilXmlWriter\xmlStartTag().

Referenced by export().

113  {
114  $this->xmlStartTag('Category');
115  }
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 120 of file class.ilCategoryXmlWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by export().

121  {
122  $this->xmlEndTag('Category');
123  }
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 97 of file class.ilCategoryXmlWriter.php.

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

Referenced by export().

98  {
99  global $ilSetting;
100 
101  $this->xmlSetDtdDef("<!DOCTYPE category PUBLIC \"-//ILIAS//DTD Group//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_category_4_3.dtd\">");
102  $this->xmlSetGenCmt("Export of ILIAS category ". $this->getCategory()->getId()." of installation ".$ilSetting->get('inst_id').".");
103  $this->xmlHeader();
104 
105 
106  return true;
107  }
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:

◆ buildSorting()

ilCategoryXmlWriter::buildSorting ( )
protected

Add sorting.

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

References getCategory(), ilContainer\SORT_MANUAL, and ilXmlWriter\xmlElement().

Referenced by export().

152  {
153  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
154  include_once './Services/Container/classes/class.ilContainer.php';
155 
156  $sorting = new ilContainerSortingSettings($this->getCategory()->getId());
157  switch($sorting->getSortMode())
158  {
160  $type = 'Manual';
161  break;
162 
163  default:
164  $type = 'Title';
165  break;
166 
167  }
168  $this->xmlElement('Sorting', array('type' => $type));
169  }
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
getCategory()
Get category object.
+ 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 128 of file class.ilCategoryXmlWriter.php.

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

Referenced by export().

129  {
130  $this->xmlStartTag('Translations');
131 
132  $translations = $this->getCategory()->getTranslations();
133 
134 
135  $first = true;
136  foreach((array) $translations['Fobject'] as $translation)
137  {
138  $this->xmlStartTag('Translation', array('default' => (int) $first, 'language' => $translation['lang']));
139  $this->xmlElement('Title', array(),$translation['title']);
140  $this->xmlElement('Description',array(),$translation['desc']);
141  $this->xmlEndTag('Translation');
142 
143  $first = false;
144  }
145  $this->xmlEndTag('Translations');
146  }
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 buildCategory(), buildFooter(), buildHeader(), buildSorting(), buildTranslations(), 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  $this->buildSorting();
79  $this->buildFooter();
80  }
81  }
buildCategory()
Build category xml.
buildTranslations()
Add Translations.
buildHeader()
Build xml header <type> $ilSetting.
buildFooter()
Add footer elements.
+ 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(), buildSorting(), and buildTranslations().

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

References ilXmlWriter\xmlDumpMem().

88  {
89  return $this->xmlDumpMem(false);
90  }
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: