ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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)
 
 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

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.

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

36  {
37  global $DIC;
38 
39  $this->settings = $DIC->settings();
41 
42  $this->category = $cat;
43  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ buildCategory()

ilCategoryXmlWriter::buildCategory ( )
protected

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

References ilXmlWriter\xmlStartTag().

Referenced by export().

91  : void
92  {
93  $this->xmlStartTag('Category');
94  }
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $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

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

References ilXmlWriter\xmlEndTag().

Referenced by export().

97  : void
98  {
99  $this->xmlEndTag('Category');
100  }
xmlEndTag(string $tag)
Writes an endtag.
+ 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.

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

Referenced by export().

80  : bool
81  {
83 
84  $this->xmlSetGenCmt("Export of ILIAS category " . $this->getCategory()->getId() . " of installation " . $ilSetting->get('inst_id') . ".");
85  $this->xmlHeader();
86 
87  return true;
88  }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlHeader()
Writes xml header.
global $ilSetting
Definition: privfeed.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTranslations()

ilCategoryXmlWriter::buildTranslations ( )
protected

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

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

Referenced by export().

103  : void
104  {
105  $this->xmlStartTag('Translations');
106 
107  $translations = $this->getCategory()->getObjectTranslation()->getLanguages();
108  foreach ($translations as $translation) {
109  $this->xmlStartTag(
110  'Translation',
111  [
112  'default' => (int) $translation->isDefault(),
113  'language' => $translation->getLanguageCode()
114  ]
115  );
116  $this->xmlElement('Title', [], $translation->getTitle());
117  $this->xmlElement('Description', [], $translation->getDescription());
118  $this->xmlEndTag('Translation');
119  }
120  $this->xmlEndTag('Translations');
121  }
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $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 ( bool  $a_with_header = true)

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

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

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)
+ Here is the call graph for this function:

◆ getCategory()

ilCategoryXmlWriter::getCategory ( )

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

References $category.

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

56  {
57  return $this->category;
58  }
Class ilObjCategory.
+ Here is the caller graph for this function:

◆ getMode()

ilCategoryXmlWriter::getMode ( )

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

References $mode.

Referenced by export().

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

◆ getXml()

ilCategoryXmlWriter::getXml ( )

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

References ilXmlWriter\xmlDumpMem().

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