ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilFolderXmlWriter Class Reference

XML writer for folders. More...

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

Public Member Functions

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

Protected Member Functions

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

Private Attributes

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

Additional Inherited Members

- 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

ilFolderXmlWriter::__construct (   $a_add_header)

Constructor.

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

{
$this->add_header = $a_add_header;
}

Member Function Documentation

ilFolderXmlWriter::buildHeader ( )
protected

Build XML header.

Returns

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

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

Referenced by write().

{
$this->xmlSetDtdDef("<!DOCTYPE WebLinks PUBLIC \"-//ILIAS//DTD WebLinkAdministration//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_weblinks_4_0.dtd\">");
$this->xmlSetGenCmt("WebLink Object");
$this->xmlHeader();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilFolderXmlWriter::init ( )
protected

Init xml writer.

Returns
bool
Exceptions
UnexpectedValueExceptionThrown if obj_id is not of type webr

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

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

Referenced by write().

{
$this->xmlClear();
if(!$this->obj_id)
{
throw new UnexpectedValueException('No obj_id given: ');
}
include_once './classes/class.ilObjectFactory.php';
if(!$this->folder = ilObjectFactory::getInstanceByObjId($this->obj_id,false))
{
throw new UnexpectedValueException('Invalid obj_id given: '.$this->obj_id);
}
if($this->folder->getType() != 'fold')
{
throw new UnexpectedValueException('Invalid obj_id given. Object is not of type folder');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

{
$this->obj_id = $a_obj_id;
}
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 buildHeader(), init(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

{
$this->init();
if($this->add_header)
{
$this->buildHeader();
}
$this->xmlStartTag('Folder',array('Id' => $this->folder->getId()));
$this->xmlElement('Title',array(),$this->folder->getTitle());
$this->xmlElement('Description',array(),$this->folder->getDescription());
$this->xmlEndTag('Folder');
}

+ Here is the call graph for this function:

Field Documentation

ilFolderXmlWriter::$add_header = true
private

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

ilFolderXmlWriter::$folder = null
private

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

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: