ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilModuleReader.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2009 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 ilModuleReader($a_path, $a_name, $a_type)
39 {
40 parent::ilObjDefReader($a_path, $a_name, $a_type);
41 }
42
43 function getModules()
44 {
45 $this->startParsing();
46 }
47
48 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 function clearTables()
60 {
61 global $ilDB;
62
63 // only this one clears parents tables (not service reader)
64 parent::clearTables();
65
66 $ilDB->manipulate("DELETE FROM module_class");
67 }
68
69
78 function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
79 {
80 global $ilDB;
81
82
83 switch ($a_name)
84 {
85 case 'module':
86 $this->current_module = $this->name;
87 $this->current_component = $this->type."/".$this->name;
88 $ilDB->manipulateF("INSERT INTO il_component (type, name, id) ".
89 "VALUES (%s,%s,%s)", array("text", "text", "text"),
90 array($this->type, $this->name, $a_attribs["id"]));
91
92 $this->setComponentId($a_attribs['id']);
93 break;
94
95 case 'baseclass':
96 $ilDB->manipulateF("INSERT INTO module_class (module, class, dir) ".
97 "VALUES (%s,%s,%s)", array("text", "text", "text"),
98 array($this->name, $a_attribs["name"], $a_attribs["dir"]));
99 break;
100
101 }
102
103 // smeyer: first read outer xml
104 parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
105 }
106
114 function handlerEndTag($a_xml_parser,$a_name)
115 {
116 parent::handlerEndTag($a_xml_parser,$a_name);
117 }
118
119
127 function handlerCharacterData($a_xml_parser,$a_data)
128 {
129 parent::handlerCharacterData($a_xml_parser,$a_data);
130
131 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
132 $a_data = preg_replace("/\n/","",$a_data);
133 $a_data = preg_replace("/\t+/","",$a_data);
134
135 if (!empty($a_data))
136 {
137 switch ($this->current_tag)
138 {
139 case '':
140 }
141 }
142 }
143
144}
Class ilModuleReader.
handlerEndTag($a_xml_parser, $a_name)
end tag handler
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class @access private
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
ilModuleReader($a_path, $a_name, $a_type)
clearTables()
clear the tables
handlerCharacterData($a_xml_parser, $a_data)
end tag handler
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
global $ilDB