ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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
 setMode ($a_mode)
 Set export mode.
 getMode ()
 get export mode
 getCategory ()
 Get category object.
 export ($a_with_header=true)
 Start wrting xml.
 getXml ()
 get XML
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor
 _ilXmlWriter ()
 destructor public
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition.
 xmlSetStSheet ($stSheet)
 Sets stylesheet.
 xmlSetGenCmt ($genCmt)
 Sets generated comment.
 _xmlEscapeData ($data)
 Escapes reserved characters.
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding.
 xmlFormatData ($data)
 Indents text for better reading.
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly.
 xmlHeader ()
 Writes xml header public.
 xmlStartTag ($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
 Writes a starttag.
 xmlEndTag ($tag)
 Writes an endtag.
 xmlComment ($comment)
 Writes a comment.
 xmlData ($data, $encode=TRUE, $escape=TRUE)
 Writes data.
 xmlElement ($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
 Writes a basic element (no children, just textual content)
 xmlDumpFile ($file, $format=TRUE)
 Dumps xml document from memory into a file.
 xmlDumpMem ($format=TRUE)
 Returns xml document from memory.
 appendXML ($a_str)
 append xml string to document
 xmlClear ()
 clears xmlStr public

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.
 buildCategory ()
 Build category xml.
 buildFooter ()
 Add footer elements.
 buildTranslations ()
 Add Translations.
 buildSorting ()
 Add sorting.

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:
class.ilCategoryXmlWriter.php 35366 2012-07-04 09:55:01Z smeyer

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

Constructor & Destructor Documentation

ilCategoryXmlWriter::__construct ( ilObjCategory  $cat = null)

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding public

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

{
global $ilias;
$this->category = $cat;
}

Member Function Documentation

ilCategoryXmlWriter::buildCategory ( )
protected

Build category xml.

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

References ilXmlWriter\xmlStartTag().

Referenced by export().

{
$this->xmlStartTag('Category');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCategoryXmlWriter::buildFooter ( )
protected

Add footer elements.

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

References ilXmlWriter\xmlEndTag().

Referenced by export().

{
$this->xmlEndTag('Category');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
global $ilSetting;
$this->xmlSetDtdDef("<!DOCTYPE category PUBLIC \"-//ILIAS//DTD Group//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_category_4_3.dtd\">");
$this->xmlSetGenCmt("Export of ILIAS category ". $this->getCategory()->getId()." of installation ".$ilSetting->get('inst_id').".");
$this->xmlHeader();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
include_once './Services/Container/classes/class.ilContainer.php';
$sorting = new ilContainerSortingSettings($this->getCategory()->getId());
switch($sorting->getSortMode())
{
$type = 'Manual';
break;
default:
$type = 'Title';
break;
}
$this->xmlElement('Sorting', array('type' => $type));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
$this->xmlStartTag('Translations');
$translations = $this->getCategory()->getTranslations();
$first = true;
foreach((array) $translations['Fobject'] as $translation)
{
$this->xmlStartTag('Translation', array('default' => (int) $first, 'language' => $translation['lang']));
$this->xmlElement('Title', array(),$translation['title']);
$this->xmlElement('Description',array(),$translation['desc']);
$this->xmlEndTag('Translation');
$first = false;
}
$this->xmlEndTag('Translations');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
if($this->getMode() == self::MODE_EXPORT)
{
if($a_with_header)
{
$this->buildHeader();
}
$this->buildCategory();
$this->buildSorting();
$this->buildFooter();
}
}

+ Here is the call graph for this function:

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:

ilCategoryXmlWriter::getMode ( )

get export mode

Returns
int

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

References $mode.

Referenced by export().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilCategoryXmlWriter::getXml ( )

get XML

Returns
string

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

References ilXmlWriter\xmlDumpMem().

{
return $this->xmlDumpMem(false);
}

+ Here is the call graph for this function:

ilCategoryXmlWriter::setMode (   $a_mode)

Set export mode.

Parameters
int$a_mode

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

{
$this->mode = $a_mode;
}

Field Documentation

ilCategoryXmlWriter::$category
private

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

Referenced by getCategory().

ilCategoryXmlWriter::$mode = self::MODE_SOAP
private

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

Referenced by getMode().

ilCategoryXmlWriter::$xml
private

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

const ilCategoryXmlWriter::MODE_EXPORT = 2
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: