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;
36 parent::__construct();
70 $this->mode = $a_mode;
102 xml_set_object($a_xml_parser,$this);
103 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
104 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
118 if($this->in_metadata)
120 parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
127 $this->in_metadata =
true;
133 parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
138 $this->current_link_update =
false;
139 $this->current_link_delete =
false;
140 $this->current_parameters = array();
142 if($this->
getMode() == self::MODE_CREATE or (isset($a_attribs[
'action']) and $a_attribs[
'action'] ==
'Create'))
147 elseif($this->
getMode() == self::MODE_UPDATE and $a_attribs[
'action'] ==
'Delete')
149 $this->current_link_delete =
true;
151 $this->current_link->delete($a_attribs[
'id']);
154 elseif($this->
getMode() == self::MODE_UPDATE and ($a_attribs[
'action'] ==
'Update' or !isset($a_attribs[
'action'])))
157 $this->current_link->readItem($a_attribs[
'id']);
158 $this->current_link_update =
true;
161 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
165 $param->delete($param_id);
174 $this->current_link->setActiveStatus($a_attribs[
'active'] ? 1 : 0);
177 if(!isset($a_attribs[
'valid']))
183 $valid = $a_attribs[
'valid'] ? 1 : 0;
185 $this->current_link->setValidStatus(
$valid);
188 $this->current_link->setDisableCheckStatus($a_attribs[
'disableValidation'] ? 1 : 0);
194 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
198 switch($a_attribs[
'type'])
218 case 'DynamicParameter':
221 $param->setName($a_attribs[
'name']);
223 switch($a_attribs[
'type'])
226 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_LOGIN); 231 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_USER_ID); 235 case 'matriculation':
236 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_MATRICULATION); 245 $this->current_parameters[] = $param;
260 if($this->in_metadata)
262 parent::handlerEndTag($a_xml_parser,$a_name);
265 $GLOBALS[
'ilLog']->write(__METHOD__.
': Called '.$a_name);
270 $this->in_metadata =
false;
271 parent::handlerEndTag($a_xml_parser,$a_name);
275 $this->
getWebLink()->MDUpdateListener(
'General');
281 if($this->current_link_delete)
285 if(!$this->current_link)
289 if(!$this->current_link->validate())
294 if($this->current_link_update)
296 $this->current_link->update();
300 $this->current_link->add();
304 foreach($this->current_parameters as $param)
306 $param->add($this->current_link->getLinkId());
309 unset($this->current_link);
313 if($this->current_link)
315 $this->current_link->setTitle(trim($this->cdata));
320 if($this->current_link)
322 $this->current_link->setDescription(trim($this->cdata));
327 if($this->current_link)
329 $this->current_link->setTarget(trim($this->cdata));
348 if($this->in_metadata)
350 parent::handlerCharacterData($a_xml_parser,$a_data);
356 $a_data = preg_replace(
"/\t+/",
" ",$a_data);
357 $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.
const LINKS_MATRICULATION
setThrowException($throwException)
set error handling
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
setXMLContent($a_xml_content)
handlerEndTag($a_xml_parser, $a_name)
handler for end of element