ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilWebLinkXmlWriter Class Reference
+ Inheritance diagram for ilWebLinkXmlWriter:
+ Collaboration diagram for ilWebLinkXmlWriter:

Public Member Functions

 __construct (bool $a_add_header)
 
 setObjId (int $a_obj_id)
 
 write ()
 
- Public Member Functions inherited from ilXmlWriter
 __construct (string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
 
 xmlSetDtdDef (string $dtdDef)
 Sets dtd definition. More...
 
 xmlSetGenCmt (string $genCmt)
 Sets generated comment. More...
 
 xmlFormatData (string $data)
 Indents text for better reading. More...
 
 xmlHeader ()
 Writes xml header. More...
 
 xmlStartTag (string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
 Writes a starttag. More...
 
 xmlEndTag (string $tag)
 Writes an endtag. More...
 
 xmlData (string $data, bool $encode=true, bool $escape=true)
 Writes data. More...
 
 xmlElement (string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile (string $file, bool $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem (bool $format=true)
 Returns xml document from memory. More...
 
 appendXML (string $a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr More...
 

Protected Member Functions

 buildHeader ()
 
 init ()
 

Private Attributes

bool $add_header = true
 
int $obj_id = 0
 
ilObjLinkResource $weblink = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebLinkXmlWriter::__construct ( bool  $a_add_header)

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

References ILIAS\GlobalScreen\Provider\__construct().

32  {
33  $this->add_header = $a_add_header;
35  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ buildHeader()

ilWebLinkXmlWriter::buildHeader ( )
protected

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

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

Referenced by write().

56  : bool
57  {
58  $this->xmlSetGenCmt("WebLink Object");
59  $this->xmlHeader();
60  return true;
61  }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlHeader()
Writes xml header.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilWebLinkXmlWriter::init ( )
protected
Exceptions
UnexpectedValueExceptionThrown if obj_id is not of type webr

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

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

Referenced by write().

66  : void
67  {
68  $this->xmlClear();
69 
70  if (!$this->obj_id) {
71  throw new UnexpectedValueException('No obj_id given: ');
72  }
73  if (!$this->weblink = ilObjectFactory::getInstanceByObjId(
74  $this->obj_id,
75  false
76  )) {
77  throw new UnexpectedValueException(
78  'Invalid obj_id given: ' . $this->obj_id
79  );
80  }
81  if ($this->weblink->getType() != 'webr') {
82  throw new UnexpectedValueException(
83  'Invalid obj_id given. Object is not of type webr'
84  );
85  }
86  }
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
xmlClear()
clears xmlStr
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObjId()

ilWebLinkXmlWriter::setObjId ( int  $a_obj_id)

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

37  : void
38  {
39  $this->obj_id = $a_obj_id;
40  }

◆ write()

ilWebLinkXmlWriter::write ( )
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().

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

Field Documentation

◆ $add_header

bool ilWebLinkXmlWriter::$add_header = true
private

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

◆ $obj_id

int ilWebLinkXmlWriter::$obj_id = 0
private

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

◆ $weblink

ilObjLinkResource ilWebLinkXmlWriter::$weblink = null
private

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


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