ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilServiceReader.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2005 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
34{
35 public function getServices()
36 {
37 $this->startParsing();
38 }
39
40
41 public function setHandlers($a_xml_parser)
42 {
43 xml_set_object($a_xml_parser, $this);
44 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
45 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
46 }
47
48
52 public function clearTables()
53 {
54 $this->db->manipulate("DELETE FROM service_class");
55 }
56
57
66 public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
67 {
68 switch ($a_name) {
69 case 'service':
70 $this->current_service = $this->name;
71 $this->current_component = $this->type . "/" . $this->name;
72 $this->db->manipulateF(
73 "INSERT INTO il_component (type, name, id) " .
74 "VALUES (%s,%s,%s)",
75 array("text", "text", "text"),
76 array($this->type, $this->name, $a_attribs["id"])
77 );
78
79 $this->setComponentId($a_attribs['id']);
80 break;
81
82 case 'baseclass':
83 $this->db->manipulateF(
84 "INSERT INTO service_class (service, class, dir) " .
85 "VALUES (%s,%s,%s)",
86 array("text", "text", "text"),
87 array($this->name, $a_attribs["name"], $a_attribs["dir"])
88 );
89 break;
90 }
91
92 // smeyer: first read outer xml
93 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
94 }
95
103 public function handlerEndTag($a_xml_parser, $a_name)
104 {
105 parent::handlerEndTag($a_xml_parser, $a_name);
106 }
107
108
116 public function handlerCharacterData($a_xml_parser, $a_data)
117 {
118 parent::handlerCharacterData($a_xml_parser, $a_data);
119
120 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
121 $a_data = preg_replace("/\n/", "", $a_data);
122 $a_data = preg_replace("/\t+/", "", $a_data);
123
124 if (!empty($a_data)) {
125 switch ($this->current_tag) {
126 case '':
127 }
128 }
129 }
130}
An exception for terminatinating execution or to throw for unit testing.
Component definition reader (reads common tags in module.xml and service.xml files) Name is misleadin...
setComponentId($a_component_id)
Set from module or service reader.
startParsing()
stores xml data in array
Class ilServiceReader.
handlerEndTag($a_xml_parser, $a_name)
end tag handler
handlerCharacterData($a_xml_parser, $a_data)
end tag handler
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class @access private
clearTables()
clear the tables
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
if($format !==null) $name
Definition: metadata.php:230