ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilWebLinkXmlWriter Class Reference

XML writer for weblinks. More...

+ Inheritance diagram for ilWebLinkXmlWriter:
+ Collaboration diagram for ilWebLinkXmlWriter:

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
 $weblink = 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 weblinks.

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.ilWebLinkXmlWriter.php.

Constructor & Destructor Documentation

ilWebLinkXmlWriter::__construct (   $a_add_header)

Constructor.

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

{
$this->add_header = $a_add_header;
}

Member Function Documentation

ilWebLinkXmlWriter::buildHeader ( )
protected

Build XML header.

Returns

Definition at line 59 of file class.ilWebLinkXmlWriter.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:

ilWebLinkXmlWriter::init ( )
protected

Init xml writer.

Returns
bool
Exceptions
UnexpectedValueExceptionThrown if obj_id is not of type webr

Definition at line 74 of file class.ilWebLinkXmlWriter.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->weblink = ilObjectFactory::getInstanceByObjId($this->obj_id,false))
{
throw new UnexpectedValueException('Invalid obj_id given: '.$this->obj_id);
}
if($this->weblink->getType() != 'webr')
{
throw new UnexpectedValueException('Invalid obj_id given. Object is not of type webr');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilWebLinkXmlWriter::setObjId (   $a_obj_id)

Set obj_id of weblink object.

Parameters
intobj_id
Returns
bool

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

{
$this->obj_id = $a_obj_id;
}
ilWebLinkXmlWriter::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.ilWebLinkXmlWriter.php.

References buildHeader(), and init().

{
$this->init();
if($this->add_header)
{
$this->buildHeader();
}
$this->weblink->toXML($this);
}

+ Here is the call graph for this function:

Field Documentation

ilWebLinkXmlWriter::$add_header = true
private

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

ilWebLinkXmlWriter::$obj_id = 0
private

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

ilWebLinkXmlWriter::$weblink = null
private

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


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