ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilFolderXmlWriter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

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
 
int $obj_id = 0
 
ilObject $folder = null
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too. If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning XML writer for folders

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

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

Constructor & Destructor Documentation

◆ __construct()

ilFolderXmlWriter::__construct ( bool  $a_add_header)

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

References ILIAS\GlobalScreen\Provider\__construct().

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

Member Function Documentation

◆ buildHeader()

ilFolderXmlWriter::buildHeader ( )
protected

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

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

Referenced by write().

53  : void
54  {
55  $this->xmlSetDtdDef("<!DOCTYPE WebLinks PUBLIC \"-//ILIAS//DTD WebLinkAdministration//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_fold_4_5.dtd\">");
56  $this->xmlSetGenCmt("Export of a ILIAS Folder");
57  $this->xmlHeader();
58  }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilFolderXmlWriter::init ( )
protected

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

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

Referenced by write().

60  : void
61  {
62  $this->xmlClear();
63 
64  if (!$this->obj_id) {
65  throw new UnexpectedValueException('No obj_id given: ');
66  }
67  if (!$this->folder = ilObjectFactory::getInstanceByObjId($this->obj_id, false)) {
68  throw new UnexpectedValueException('Invalid obj_id given: ' . $this->obj_id);
69  }
70  if ($this->folder->getType() !== 'fold') {
71  throw new UnexpectedValueException('Invalid obj_id given. Object is not of type folder');
72  }
73  }
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()

ilFolderXmlWriter::setObjId ( int  $a_obj_id)

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

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

◆ write()

ilFolderXmlWriter::write ( )

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

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

40  : void
41  {
42  $this->init();
43  if ($this->add_header) {
44  $this->buildHeader();
45  }
46  $this->xmlStartTag('Folder', ['Id' => $this->folder->getId()]);
47  $this->xmlElement('Title', [], $this->folder->getTitle());
48  $this->xmlElement('Description', [], $this->folder->getDescription());
50  $this->xmlEndTag('Folder');
51  }
xmlEndTag(string $tag)
Writes an endtag.
static _exportContainerSortingSettings(ilXmlWriter $xml, int $obj_id)
sorting XML-export for all container objects
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

Field Documentation

◆ $add_header

bool ilFolderXmlWriter::$add_header
private

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

◆ $folder

ilObject ilFolderXmlWriter::$folder = null
private

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

◆ $obj_id

int ilFolderXmlWriter::$obj_id = 0
private

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


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