ILIAS  release_8 Revision v8.24
ilCategoryXmlWriter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (ilObjCategory $cat=null)
 
 setMode (int $a_mode)
 
 getMode ()
 
 getCategory ()
 
 export (bool $a_with_header=true)
 
 getXml ()
 
- Public Member Functions inherited from ilXmlWriter
 __construct (string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
 
 xmlSetDtdDef (string $dtdDef)
 Sets dtd definition. More...
 
 xmlSetGenCmt (string $genCmt)
 Sets generated comment. More...
 
 xmlFormatData (string $data)
 Indents text for better reading. More...
 
 xmlHeader ()
 Writes xml header. More...
 
 xmlStartTag (string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
 Writes a starttag. More...
 
 xmlEndTag (string $tag)
 Writes an endtag. More...
 
 xmlData (string $data, bool $encode=true, bool $escape=true)
 Writes data. More...
 
 xmlElement (string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile (string $file, bool $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem (bool $format=true)
 Returns xml document from memory. More...
 
 appendXML (string $a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr More...
 

Data Fields

const MODE_SOAP = 1
 
const MODE_EXPORT = 2
 

Protected Member Functions

 buildHeader ()
 
 buildCategory ()
 
 buildFooter ()
 
 buildTranslations ()
 

Protected Attributes

ilSetting $settings
 

Private Attributes

int $mode = self::MODE_SOAP
 
ilObjCategory $category
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class for category export

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

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

Constructor & Destructor Documentation

◆ __construct()

ilCategoryXmlWriter::__construct ( ilObjCategory  $cat = null)

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

36 {
37 global $DIC;
38
39 $this->settings = $DIC->settings();
41
42 $this->category = $cat;
43 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildCategory()

ilCategoryXmlWriter::buildCategory ( )
protected

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

92 : void
93 {
94 $this->xmlStartTag('Category');
95 }
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References ilXmlWriter\xmlStartTag().

Referenced by export().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFooter()

ilCategoryXmlWriter::buildFooter ( )
protected

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

98 : void
99 {
100 $this->xmlEndTag('Category');
101 }
xmlEndTag(string $tag)
Writes an endtag.

References ilXmlWriter\xmlEndTag().

Referenced by export().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilCategoryXmlWriter::buildHeader ( )
protected

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

80 : bool
81 {
83
84 $this->xmlSetDtdDef("<!DOCTYPE category PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_cat_4_5.dtd\">");
85 $this->xmlSetGenCmt("Export of ILIAS category " . $this->getCategory()->getId() . " of installation " . $ilSetting->get('inst_id') . ".");
86 $this->xmlHeader();
87
88 return true;
89 }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlHeader()
Writes xml header.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
global $ilSetting
Definition: privfeed.php:17

References $ilSetting, $settings, getCategory(), ILIAS\Survey\Mode\getId(), ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlSetGenCmt().

Referenced by export().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTranslations()

ilCategoryXmlWriter::buildTranslations ( )
protected

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

104 : void
105 {
106 $this->xmlStartTag('Translations');
107
108 $translations = $this->getCategory()->getObjectTranslation()->getLanguages();
109 foreach ($translations as $translation) {
110 $this->xmlStartTag(
111 'Translation',
112 [
113 'default' => (int) $translation->isDefault(),
114 'language' => $translation->getLanguageCode()
115 ]
116 );
117 $this->xmlElement('Title', [], $translation->getTitle());
118 $this->xmlElement('Description', [], $translation->getDescription());
119 $this->xmlEndTag('Translation');
120 }
121 $this->xmlEndTag('Translations');
122 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)

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

Referenced by export().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ export()

ilCategoryXmlWriter::export ( bool  $a_with_header = true)

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

60 : void
61 {
62 if ($this->getMode() === self::MODE_EXPORT) {
63 if ($a_with_header) {
64 $this->buildHeader();
65 }
66 $this->buildCategory();
67 $this->buildTranslations();
69 ilContainer::_exportContainerSettings($this, $this->category->getId());
70 $this->buildFooter();
71 }
72 }
static _exportContainerSortingSettings(ilXmlWriter $xml, int $obj_id)
sorting XML-export for all container objects
static _exportContainerSettings(ilXmlWriter $a_xml, int $a_obj_id)

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

+ Here is the call graph for this function:

◆ getCategory()

ilCategoryXmlWriter::getCategory ( )

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

56 {
57 return $this->category;
58 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $category.

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

+ Here is the caller graph for this function:

◆ getMode()

ilCategoryXmlWriter::getMode ( )

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

50 : int
51 {
52 return $this->mode;
53 }

References $mode.

Referenced by export().

+ Here is the caller graph for this function:

◆ getXml()

ilCategoryXmlWriter::getXml ( )

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

74 : string
75 {
76 return $this->xmlDumpMem(false);
77 }
xmlDumpMem(bool $format=true)
Returns xml document from memory.

References ilXmlWriter\xmlDumpMem().

+ Here is the call graph for this function:

◆ setMode()

ilCategoryXmlWriter::setMode ( int  $a_mode)

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

45 : void
46 {
47 $this->mode = $a_mode;
48 }

Field Documentation

◆ $category

ilObjCategory ilCategoryXmlWriter::$category
private

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

Referenced by getCategory().

◆ $mode

int ilCategoryXmlWriter::$mode = self::MODE_SOAP
private

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

Referenced by getMode().

◆ $settings

ilSetting ilCategoryXmlWriter::$settings
protected

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

Referenced by buildHeader().

◆ MODE_EXPORT

const ilCategoryXmlWriter::MODE_EXPORT = 2

◆ MODE_SOAP

const ilCategoryXmlWriter::MODE_SOAP = 1

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


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