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) {
122 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
128 $this->in_metadata =
true;
134 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
139 $this->current_sorting_position = ($a_attribs[
'position'] ? $a_attribs[
'position'] : 0);
140 $this->current_link_update =
false;
141 $this->current_link_delete =
false;
142 $this->current_parameters =
array();
144 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') {
148 $this->current_link_delete =
true;
150 $this->current_link->delete($a_attribs[
'id']);
152 } elseif ($this->
getMode() == self::MODE_UPDATE and ($a_attribs[
'action'] ==
'Update' or !isset($a_attribs[
'action']))) {
154 $this->current_link->readItem($a_attribs[
'id']);
155 $this->current_link_update =
true;
158 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
161 $param->delete($param_id);
168 $this->current_link->setActiveStatus($a_attribs[
'active'] ? 1 : 0);
171 if (!isset($a_attribs[
'valid'])) {
174 $valid = $a_attribs[
'valid'] ? 1 : 0;
176 $this->current_link->setValidStatus(
$valid);
179 $this->current_link->setDisableCheckStatus($a_attribs[
'disableValidation'] ? 1 : 0);
182 if (isset($a_attribs[
'internal'])) {
183 $this->current_link->setInternal($a_attribs[
'internal']);
190 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
194 switch ($a_attribs[
'type']) {
207 $this->sorting_positions =
array();
215 case 'DynamicParameter':
218 $param->setName($a_attribs[
'name']);
220 switch ($a_attribs[
'type']) {
222 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_LOGIN); 227 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_USER_ID); 231 case 'matriculation':
232 # $GLOBALS['ilLog']->write("VALUE: ".LINKS_MATRICULATION); 241 $this->current_parameters[] = $param;
256 if ($this->in_metadata) {
257 parent::handlerEndTag($a_xml_parser, $a_name);
260 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Called ' . $a_name);
264 $this->in_metadata =
false;
265 parent::handlerEndTag($a_xml_parser, $a_name);
269 $this->
getWebLink()->MDUpdateListener(
'General');
273 include_once
'./Services/Container/classes/class.ilContainerSorting.php';
275 $sorting->savePost($this->sorting_positions);
281 if ($this->current_link_delete) {
284 if (!$this->current_link) {
287 if (!$this->current_link->validate()) {
291 if ($this->current_link_update) {
292 $this->current_link->update();
294 $this->current_link->add();
298 foreach ($this->current_parameters as $param) {
299 $param->add($this->current_link->getLinkId());
304 $this->sorting_positions[$this->current_link->getLinkId()] = (int) $this->current_sorting_position;
306 unset($this->current_link);
310 if ($this->current_link) {
311 $this->current_link->setTitle(trim($this->cdata));
316 if ($this->current_link) {
317 $this->current_link->setDescription(trim($this->cdata));
322 if ($this->current_link) {
323 $this->current_link->setTarget(trim($this->cdata));
342 if ($this->in_metadata) {
343 parent::handlerCharacterData($a_xml_parser, $a_data);
346 if ($a_data !=
"\n") {
348 $a_data = preg_replace(
"/\t+/",
" ", $a_data);
349 $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.
$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