4 include_once(
"Services/MetaData/classes/class.ilMDSaxParser.php");
5 include_once(
"Services/MetaData/classes/class.ilMD.php");
6 include_once(
'Services/Utilities/interfaces/interface.ilSaxSubsetParser.php');
8 include_once
'./Modules/WebResource/classes/class.ilLinkResourceItems.php';
9 include_once
'./Modules/WebResource/classes/class.ilWebLinkXmlParserException.php';
10 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
27 private $mode = self::MODE_UNDEFINED;
39 parent::__construct();
73 $this->mode = $a_mode;
105 xml_set_object($a_xml_parser, $this);
106 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
107 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
123 if ($this->in_metadata) {
124 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
130 $this->in_metadata =
true;
136 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
141 $this->current_sorting_position = ($a_attribs[
'position'] ? $a_attribs[
'position'] : 0);
142 $this->current_link_update =
false;
143 $this->current_link_delete =
false;
144 $this->current_parameters = array();
146 if ($this->
getMode() == self::MODE_CREATE
or (isset($a_attribs[
'action'])
and $a_attribs[
'action'] ==
'Create')) {
149 } elseif ($this->
getMode() == self::MODE_UPDATE
and $a_attribs[
'action'] ==
'Delete') {
150 $this->current_link_delete =
true;
152 $this->current_link->delete($a_attribs[
'id']);
154 } elseif ($this->
getMode() == self::MODE_UPDATE
and ($a_attribs[
'action'] ==
'Update' or !isset($a_attribs[
'action']))) {
156 $this->current_link->readItem($a_attribs[
'id']);
157 $this->current_link_update =
true;
160 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
163 $param->delete($param_id);
170 $this->current_link->setActiveStatus($a_attribs[
'active'] ? 1 : 0);
173 if (!isset($a_attribs[
'valid'])) {
176 $valid = $a_attribs[
'valid'] ? 1 : 0;
178 $this->current_link->setValidStatus(
$valid);
181 $this->current_link->setDisableCheckStatus($a_attribs[
'disableValidation'] ? 1 : 0);
184 if (isset($a_attribs[
'internal'])) {
185 $this->current_link->setInternal($a_attribs[
'internal']);
192 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
196 switch ($a_attribs[
'type']) {
209 $this->sorting_positions = array();
217 case 'DynamicParameter':
220 $param->setName($a_attribs[
'name']);
222 switch ($a_attribs[
'type']) {
231 case 'matriculation':
240 $this->current_parameters[] = $param;
255 if ($this->in_metadata) {
256 parent::handlerEndTag($a_xml_parser, $a_name);
262 $this->in_metadata =
false;
263 parent::handlerEndTag($a_xml_parser, $a_name);
267 $this->
getWebLink()->MDUpdateListener(
'General');
271 include_once
'./Services/Container/classes/class.ilContainerSorting.php';
273 $sorting->savePost($this->sorting_positions);
279 if ($this->current_link_delete) {
282 if (!$this->current_link) {
285 if (!$this->current_link->validate()) {
289 if ($this->current_link_update) {
290 $this->current_link->update();
292 $this->current_link->add();
296 foreach ($this->current_parameters as $param) {
297 $param->add($this->current_link->getLinkId());
302 $this->sorting_positions[$this->current_link->getLinkId()] = (int) $this->current_sorting_position;
304 unset($this->current_link);
308 if ($this->current_link) {
309 $this->current_link->setTitle(trim($this->cdata));
314 if ($this->current_link) {
315 $this->current_link->setDescription(trim($this->cdata));
320 if ($this->current_link) {
321 $this->current_link->setTarget(trim($this->cdata));
340 if ($this->in_metadata) {
341 parent::handlerCharacterData($a_xml_parser, $a_data);
344 if ($a_data !=
"\n") {
346 $a_data = preg_replace(
"/\t+/",
" ", $a_data);
347 $this->cdata .= $a_data;
XML parser for weblink xml.
static getParameterIds($a_webr_id, $a_link_id)
Get Parameter ids of link.
startParsing()
stores xml data in array
setMode($a_mode)
Set parsing mode.
const LINKS_MATRICULATION
setThrowException($throwException)
set error handling
$current_sorting_position
SaxParserException thrown by ilSaxParser if property throwException is set.
getMode()
Return parsing mode.
setHandlers($a_xml_parser)
set event handlers
getWebLink()
Get weblink object.
__construct($webr, $xml)
Constructor.
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
Class ilObjLinkResourceGUI.
Class ilParameterAppender.
setWebLink(ilObject $webl)
set weblink
static getLogger($a_component_id)
Get component logger.
static _getInstance($a_obj_id)
get instance by obj_id
setXMLContent($a_xml_content)
handlerEndTag($a_xml_parser, $a_name)
handler for end of element