ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilFolderXmlParser.php
Go to the documentation of this file.
1<?php
2
29{
33 protected $error;
34
35 private $folder = null;
36
37
41 public function __construct($folder, $xml)
42 {
43 global $DIC;
44
45 $this->error = $DIC["ilErr"];
47 $this->setXMLContent($xml);
48 $this->setFolder($folder);
49 $this->setThrowException(true);
50 }
51
57 public function setFolder(ilObject $folder)
58 {
59 $this->folder = $folder;
60 }
61
66 public function getFolder()
67 {
68 return $this->folder;
69 }
70
71
79 public function start()
80 {
81 return $this->startParsing();
82 }
83
90 public function setHandlers($a_xml_parser)
91 {
92 xml_set_object($a_xml_parser, $this);
93 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
94 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
95 }
96
104 public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
105 {
107
108 switch ($a_name) {
109
110 case 'Folder':
111 break;
112
113
114 case 'Sorting':
115 case 'Sort':
116 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
118 break;
119
120 case 'Title':
121 case 'Description':
122 break;
123 }
124 }
125
134 public function handlerEndTag($a_xml_parser, $a_name)
135 {
136 $GLOBALS['ilLog']->write(__METHOD__ . ': Called ' . $a_name);
137
138 switch ($a_name) {
139
140 case 'Folder':
141 $this->getFolder()->update();
142 break;
143
144 case 'Title':
145 $this->getFolder()->setTitle($this->trimAndStrip((string) $this->cdata));
146 break;
147
148 case 'Description':
149 $this->getFolder()->setDescription($this->trimAndStrip((string) $this->cdata));
150 break;
151
152 }
153
154 // Reset cdata
155 $this->cdata = '';
156 }
157
158
159
166 public function handlerCharacterData($a_xml_parser, $a_data)
167 {
168 if ($a_data != "\n") {
169 // Replace multiple tabs with one space
170 $a_data = preg_replace("/\t+/", " ", $a_data);
171 $this->cdata .= $a_data;
172 }
173 }
174}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _importContainerSortingSettings($attibs, $obj_id)
sorting import for all container objects
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFolder()
Get folder object.
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
setFolder(ilObject $folder)
set weblink
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
setHandlers($a_xml_parser)
set event handlers
__construct($folder, $xml)
Constructor.
Class ilObject Basic functions for all objects.
setThrowException($throwException)
set error handling
setXMLContent($a_xml_content)
startParsing()
stores xml data in array
global $DIC
Definition: goto.php:24
$xml
Definition: metadata.php:332
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilErr
Definition: raiseError.php:18