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');
121 if($this->in_metadata)
123 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'))
151 elseif($this->
getMode() == self::MODE_UPDATE
and $a_attribs[
'action'] ==
'Delete')
153 $this->current_link_delete =
true;
155 $this->current_link->delete($a_attribs[
'id']);
158 elseif($this->
getMode() == self::MODE_UPDATE
and ($a_attribs[
'action'] ==
'Update' or !isset($a_attribs[
'action'])))
161 $this->current_link->readItem($a_attribs[
'id']);
162 $this->current_link_update =
true;
165 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
169 $param->delete($param_id);
178 $this->current_link->setActiveStatus($a_attribs[
'active'] ? 1 : 0);
181 if(!isset($a_attribs[
'valid']))
187 $valid = $a_attribs[
'valid'] ? 1 : 0;
189 $this->current_link->setValidStatus(
$valid);
192 $this->current_link->setDisableCheckStatus($a_attribs[
'disableValidation'] ? 1 : 0);
195 if(isset($a_attribs[
'internal']))
197 $this->current_link->setInternal($a_attribs[
'internal']);
204 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
208 switch($a_attribs[
'type'])
222 $this->sorting_positions =
array();
229 case 'DynamicParameter':
232 $param->setName($a_attribs[
'name']);
234 switch($a_attribs[
'type'])
237 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_LOGIN); 242 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_USER_ID); 246 case 'matriculation':
247 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_MATRICULATION); 256 $this->current_parameters[] = $param;
271 if($this->in_metadata)
273 parent::handlerEndTag($a_xml_parser,$a_name);
276 $GLOBALS[
'ilLog']->write(__METHOD__.
': Called '.$a_name);
281 $this->in_metadata =
false;
282 parent::handlerEndTag($a_xml_parser,$a_name);
286 $this->
getWebLink()->MDUpdateListener(
'General');
290 include_once
'./Services/Container/classes/class.ilContainerSorting.php';
292 $sorting->savePost($this->sorting_positions);
298 if($this->current_link_delete)
302 if(!$this->current_link)
306 if(!$this->current_link->validate())
311 if($this->current_link_update)
313 $this->current_link->update();
317 $this->current_link->add();
321 foreach($this->current_parameters as $param)
323 $param->add($this->current_link->getLinkId());
328 $this->sorting_positions[$this->current_link->getLinkId()] = (int) $this->current_sorting_position;
330 unset($this->current_link);
334 if($this->current_link)
336 $this->current_link->setTitle(trim($this->cdata));
341 if($this->current_link)
343 $this->current_link->setDescription(trim($this->cdata));
348 if($this->current_link)
350 $this->current_link->setTarget(trim($this->cdata));
369 if($this->in_metadata)
371 parent::handlerCharacterData($a_xml_parser,$a_data);
377 $a_data = preg_replace(
"/\t+/",
" ",$a_data);
378 $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.
Class ilObject Basic functions for all objects.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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
Create styles array
The data for the language used.
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