ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilContainerReferenceXmlWriter Class Reference

Class for container reference export. More...

+ Inheritance diagram for ilContainerReferenceXmlWriter:
+ Collaboration diagram for ilContainerReferenceXmlWriter:

Public Member Functions

 __construct (ilContainerReference $ref=null)
 constructor More...
 
 setMode ($a_mode)
 Set export mode. More...
 
 getMode ()
 get export mode More...
 
 getReference ()
 Get category object. More...
 
 export ($a_with_header=true)
 Start wrting xml. More...
 
 getXml ()
 get XML More...
 
- Public Member Functions inherited from ilXmlWriter
 __construct ($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...
 
 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. More...
 
 buildTarget ()
 Build target element. More...
 
 buildTitle ()
 Build title element. More...
 
 buildReference ()
 Build category xml. More...
 
 buildFooter ()
 Add footer elements. More...
 

Protected Attributes

 $settings
 

Private Attributes

 $mode = self::MODE_SOAP
 
 $xml
 
 $ref
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlWriter
static _xmlEscapeData ($data)
 Escapes reserved characters. More...
 

Detailed Description

Class for container reference 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.ilContainerReferenceXmlWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerReferenceXmlWriter::__construct ( ilContainerReference  $ref = null)

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding public

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

References $DIC, $ref, and settings().

34  {
35  global $DIC;
36 
37  $this->settings = $DIC->settings();
38  parent::__construct();
39  $this->ref = $ref;
40  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ buildFooter()

ilContainerReferenceXmlWriter::buildFooter ( )
protected

Add footer elements.

Definition at line 148 of file class.ilContainerReferenceXmlWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by export().

149  {
150  $this->xmlEndTag('ContainerReference');
151  }
xmlEndTag($tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilContainerReferenceXmlWriter::buildHeader ( )
protected

Build xml header.

Returns
bool

Definition at line 99 of file class.ilContainerReferenceXmlWriter.php.

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

Referenced by export().

100  {
102 
103  $this->xmlSetDtdDef("<!DOCTYPE container reference PUBLIC \"-//ILIAS//DTD Group//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_container_reference_4_3.dtd\">");
104  $this->xmlSetGenCmt("Export of ILIAS container reference " . $this->getReference()->getId() . " of installation " . $ilSetting->get('inst_id') . ".");
105  $this->xmlHeader();
106 
107  return true;
108  }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header public.
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildReference()

ilContainerReferenceXmlWriter::buildReference ( )
protected

Build category xml.

Definition at line 140 of file class.ilContainerReferenceXmlWriter.php.

References ilXmlWriter\xmlStartTag().

Referenced by export().

141  {
142  $this->xmlStartTag('ContainerReference');
143  }
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:

◆ buildTarget()

ilContainerReferenceXmlWriter::buildTarget ( )
protected

Build target element.

Definition at line 113 of file class.ilContainerReferenceXmlWriter.php.

References getReference(), and ilXmlWriter\xmlElement().

Referenced by export().

114  {
115  $this->xmlElement('Target', array('id' => $this->getReference()->getTargetId()));
116  }
xmlElement($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:

◆ buildTitle()

ilContainerReferenceXmlWriter::buildTitle ( )
protected

Build title element.

Definition at line 121 of file class.ilContainerReferenceXmlWriter.php.

References $title, getReference(), ilContainerReference\TITLE_TYPE_CUSTOM, and ilXmlWriter\xmlElement().

Referenced by export().

122  {
123  $title = '';
124  if ($this->getReference()->getTitleType() == ilContainerReference::TITLE_TYPE_CUSTOM) {
125  $title = $this->getReference()->getTitle();
126  }
127 
128  $this->xmlElement(
129  'Title',
130  array(
131  'type' => $this->getReference()->getTitleType()
132  ),
133  $title
134  );
135  }
xmlElement($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()

ilContainerReferenceXmlWriter::export (   $a_with_header = true)

Start wrting xml.

Definition at line 73 of file class.ilContainerReferenceXmlWriter.php.

References buildFooter(), buildHeader(), buildReference(), buildTarget(), buildTitle(), and getMode().

74  {
75  if ($this->getMode() == self::MODE_EXPORT) {
76  if ($a_with_header) {
77  $this->buildHeader();
78  }
79  $this->buildReference();
80  $this->buildTarget();
81  $this->buildTitle();
82  $this->buildFooter();
83  }
84  }
+ Here is the call graph for this function:

◆ getMode()

ilContainerReferenceXmlWriter::getMode ( )

get export mode

Returns
int

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

References $mode.

Referenced by export().

+ Here is the caller graph for this function:

◆ getReference()

ilContainerReferenceXmlWriter::getReference ( )

◆ getXml()

ilContainerReferenceXmlWriter::getXml ( )

get XML

Returns
string

Definition at line 90 of file class.ilContainerReferenceXmlWriter.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()

ilContainerReferenceXmlWriter::setMode (   $a_mode)

Set export mode.

Parameters
int$a_mode

Definition at line 46 of file class.ilContainerReferenceXmlWriter.php.

47  {
48  $this->mode = $a_mode;
49  }

Field Documentation

◆ $mode

ilContainerReferenceXmlWriter::$mode = self::MODE_SOAP
private

Definition at line 22 of file class.ilContainerReferenceXmlWriter.php.

Referenced by getMode().

◆ $ref

◆ $settings

ilContainerReferenceXmlWriter::$settings
protected

◆ $xml

ilContainerReferenceXmlWriter::$xml
private

Definition at line 23 of file class.ilContainerReferenceXmlWriter.php.

◆ MODE_EXPORT

const ilContainerReferenceXmlWriter::MODE_EXPORT = 2

◆ MODE_SOAP

const ilContainerReferenceXmlWriter::MODE_SOAP = 1

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


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