ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 public function __construct($a_path, $a_name, $a_type)
38 {
39 parent::__construct($a_path, $a_name, $a_type);
40 }
41
42 public function getServices()
43 {
44 $this->startParsing();
45 }
46
47
48 public function setHandlers($a_xml_parser)
49 {
50 xml_set_object($a_xml_parser, $this);
51 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
52 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
53 }
54
55
59 public function clearTables()
60 {
61 global $ilDB;
62
63 $ilDB->manipulate("DELETE FROM service_class");
64 }
65
66
75 public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
76 {
77 global $ilDB;
78
79
80 switch ($a_name) {
81 case 'service':
82 $this->current_service = $this->name;
83 $this->current_component = $this->type . "/" . $this->name;
84 $ilDB->manipulateF(
85 "INSERT INTO il_component (type, name, id) " .
86 "VALUES (%s,%s,%s)",
87 array("text", "text", "text"),
88 array($this->type, $this->name, $a_attribs["id"])
89 );
90
91 $this->setComponentId($a_attribs['id']);
92 break;
93
94 case 'baseclass':
95 $ilDB->manipulateF(
96 "INSERT INTO service_class (service, class, dir) " .
97 "VALUES (%s,%s,%s)",
98 array("text", "text", "text"),
99 array($this->name, $a_attribs["name"], $a_attribs["dir"])
100 );
101 break;
102
103 }
104
105 // smeyer: first read outer xml
106 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
107 }
108
116 public function handlerEndTag($a_xml_parser, $a_name)
117 {
118 parent::handlerEndTag($a_xml_parser, $a_name);
119 }
120
121
129 public function handlerCharacterData($a_xml_parser, $a_data)
130 {
131 parent::handlerCharacterData($a_xml_parser, $a_data);
132
133 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
134 $a_data = preg_replace("/\n/", "", $a_data);
135 $a_data = preg_replace("/\t+/", "", $a_data);
136
137 if (!empty($a_data)) {
138 switch ($this->current_tag) {
139 case '':
140 }
141 }
142 }
143}
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
__construct($a_path, $a_name, $a_type)
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
global $ilDB
$a_type
Definition: workflow.php:92