ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilWebLinkXmlWriter Class Reference

XML writer for weblinks. More...

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

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

◆ __construct()

ilWebLinkXmlWriter::__construct (   $a_add_header)

Constructor.

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

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

Member Function Documentation

◆ buildHeader()

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().

60  {
61  $this->xmlSetDtdDef("<!DOCTYPE WebLinks PUBLIC \"-//ILIAS//DTD WebLinkAdministration//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_weblinks_5_1.dtd\">");
62  $this->xmlSetGenCmt("WebLink Object");
63  $this->xmlHeader();
64 
65  return true;
66  }
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()

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().

75  {
76  $this->xmlClear();
77 
78  if(!$this->obj_id)
79  {
80  throw new UnexpectedValueException('No obj_id given: ');
81  }
82  include_once './Services/Object/classes/class.ilObjectFactory.php';
83  if(!$this->weblink = ilObjectFactory::getInstanceByObjId($this->obj_id,false))
84  {
85  throw new UnexpectedValueException('Invalid obj_id given: '.$this->obj_id);
86  }
87  if($this->weblink->getType() != 'webr')
88  {
89  throw new UnexpectedValueException('Invalid obj_id given. Object is not of type webr');
90  }
91  }
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()

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.

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

◆ write()

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().

46  {
47  $this->init();
48  if($this->add_header)
49  {
50  $this->buildHeader();
51  }
52  $this->weblink->toXML($this);
53  }
buildHeader()
Build XML header.
+ Here is the call graph for this function:

Field Documentation

◆ $add_header

ilWebLinkXmlWriter::$add_header = true
private

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

◆ $obj_id

ilWebLinkXmlWriter::$obj_id = 0
private

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

◆ $weblink

ilWebLinkXmlWriter::$weblink = null
private

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


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