ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
24include_once("./setup/classes/class.ilObjDefReader.php");
25
36{
37
38 function ilServiceReader($a_path, $a_name, $a_type)
39 {
40 parent::ilObjDefReader($a_path, $a_name, $a_type);
41 }
42
43 function getServices()
44 {
45 $this->startParsing();
46 }
47
48
49 function setHandlers($a_xml_parser)
50 {
51 xml_set_object($a_xml_parser,$this);
52 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
53 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
54 }
55
56
60 function clearTables()
61 {
62 global $ilDB;
63
64 $ilDB->manipulate("DELETE FROM service_class");
65 }
66
67
76 function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
77 {
78 global $ilDB;
79
80
81 switch ($a_name)
82 {
83 case 'service':
84 $this->current_service = $this->name;
85 $this->current_component = $this->type."/".$this->name;
86 $ilDB->manipulateF("INSERT INTO il_component (type, name, id) ".
87 "VALUES (%s,%s,%s)", array("text", "text", "text"),
88 array($this->type, $this->name, $a_attribs["id"]));
89
90 $this->setComponentId($a_attribs['id']);
91 break;
92
93 case 'baseclass':
94 $ilDB->manipulateF("INSERT INTO service_class (service, class, dir) ".
95 "VALUES (%s,%s,%s)", array("text", "text", "text"),
96 array($this->name, $a_attribs["name"], $a_attribs["dir"]));
97 break;
98
99 }
100
101 // smeyer: first read outer xml
102 parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
103 }
104
112 function handlerEndTag($a_xml_parser,$a_name)
113 {
114 parent::handlerEndTag($a_xml_parser,$a_name);
115 }
116
117
125 function handlerCharacterData($a_xml_parser,$a_data)
126 {
127 parent::handlerCharacterData($a_xml_parser,$a_data);
128
129 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
130 $a_data = preg_replace("/\n/","",$a_data);
131 $a_data = preg_replace("/\t+/","",$a_data);
132
133 if (!empty($a_data))
134 {
135 switch ($this->current_tag)
136 {
137 case '':
138 }
139 }
140 }
141
142}
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
ilServiceReader($a_path, $a_name, $a_type)
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
global $ilDB