ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilFolderXmlWriter Class Reference

XML writer for folders. More...

+ Inheritance diagram for ilFolderXmlWriter:
+ Collaboration diagram for ilFolderXmlWriter:

Public Member Functions

 __construct ($a_add_header)
 Constructor. More...
 
 setObjId ($a_obj_id)
 Set obj_id of weblink object. More...
 
 write ()
 Write 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...
 

Protected Member Functions

 buildHeader ()
 Build XML header. More...
 
 init ()
 Init xml writer. More...
 

Private Attributes

 $add_header = true
 
 $obj_id = 0
 
 $folder = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlWriter
static _xmlEscapeData ($data)
 Escapes reserved characters. More...
 
- Data Fields inherited from ilXmlWriter
 $xmlStr
 
 $version
 
 $outEnc
 
 $inEnc
 
 $dtdDef = ""
 
 $stSheet = ""
 
 $genCmt = "Generated by ILIAS XmlWriter"
 

Detailed Description

XML writer for folders.

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

Definition at line 14 of file class.ilFolderXmlWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilFolderXmlWriter::__construct (   $a_add_header)

Constructor.

Definition at line 24 of file class.ilFolderXmlWriter.php.

25  {
26  $this->add_header = $a_add_header;
27  parent::__construct();
28  }

Member Function Documentation

◆ buildHeader()

ilFolderXmlWriter::buildHeader ( )
protected

Build XML header.

Returns

Definition at line 63 of file class.ilFolderXmlWriter.php.

References ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlSetGenCmt().

Referenced by write().

64  {
65  $this->xmlSetDtdDef("<!DOCTYPE WebLinks PUBLIC \"-//ILIAS//DTD WebLinkAdministration//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_fold_4_5.dtd\">");
66  $this->xmlSetGenCmt("Export of a ILIAS Folder");
67  $this->xmlHeader();
68 
69  return true;
70  }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header public.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilFolderXmlWriter::init ( )
protected

Init xml writer.

Returns
bool
Exceptions
UnexpectedValueExceptionThrown if obj_id is not of type webr

Definition at line 78 of file class.ilFolderXmlWriter.php.

References ilObjectFactory\getInstanceByObjId(), and ilXmlWriter\xmlClear().

Referenced by write().

79  {
80  $this->xmlClear();
81 
82  if (!$this->obj_id) {
83  throw new UnexpectedValueException('No obj_id given: ');
84  }
85  include_once './Services/Object/classes/class.ilObjectFactory.php';
86  if (!$this->folder = ilObjectFactory::getInstanceByObjId($this->obj_id, false)) {
87  throw new UnexpectedValueException('Invalid obj_id given: ' . $this->obj_id);
88  }
89  if ($this->folder->getType() != 'fold') {
90  throw new UnexpectedValueException('Invalid obj_id given. Object is not of type folder');
91  }
92  }
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
xmlClear()
clears xmlStr public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObjId()

ilFolderXmlWriter::setObjId (   $a_obj_id)

Set obj_id of weblink object.

Parameters
intobj_id
Returns
bool

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

36  {
37  $this->obj_id = $a_obj_id;
38  }

◆ write()

ilFolderXmlWriter::write ( )

Write XML.

Returns
Exceptions
UnexpectedValueExceptionThrown if obj_id is not of type webr or no obj_id is given

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

References ilContainerSortingSettings\_exportContainerSortingSettings(), array, buildHeader(), init(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

46  {
47  $this->init();
48  if ($this->add_header) {
49  $this->buildHeader();
50  }
51  $this->xmlStartTag('Folder', array('Id' => $this->folder->getId()));
52  $this->xmlElement('Title', array(), $this->folder->getTitle());
53  $this->xmlElement('Description', array(), $this->folder->getDescription());
54  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
56  $this->xmlEndTag('Folder');
57  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
init()
Init xml writer.
Create styles array
The data for the language used.
buildHeader()
Build XML header.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static _exportContainerSortingSettings(ilXmlWriter $xml, $obj_id)
sorting XML-export for all container objects
+ Here is the call graph for this function:

Field Documentation

◆ $add_header

ilFolderXmlWriter::$add_header = true
private

Definition at line 16 of file class.ilFolderXmlWriter.php.

◆ $folder

ilFolderXmlWriter::$folder = null
private

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

◆ $obj_id

ilFolderXmlWriter::$obj_id = 0
private

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


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