ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 public function __construct($a_path, $a_name, $a_type)
38 {
39 parent::__construct($a_path, $a_name, $a_type);
40 }
41
42 public function getModules()
43 {
44 $this->startParsing();
45 }
46
47 public function setHandlers($a_xml_parser)
48 {
49 xml_set_object($a_xml_parser, $this);
50 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
51 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
52 }
53
54
58 public function clearTables()
59 {
60 global $ilDB;
61
62 // only this one clears parents tables (not service reader)
63 parent::clearTables();
64
65 $ilDB->manipulate("DELETE FROM module_class");
66 }
67
68
77 public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
78 {
79 global $ilDB;
80
81
82 switch ($a_name) {
83 case 'module':
84 $this->current_module = $this->name;
85 $this->current_component = $this->type . "/" . $this->name;
86 $ilDB->manipulateF(
87 "INSERT INTO il_component (type, name, id) " .
88 "VALUES (%s,%s,%s)",
89 array("text", "text", "text"),
90 array($this->type, $this->name, $a_attribs["id"])
91 );
92
93 $this->setComponentId($a_attribs['id']);
94 break;
95
96 case 'baseclass':
97 $ilDB->manipulateF(
98 "INSERT INTO module_class (module, class, dir) " .
99 "VALUES (%s,%s,%s)",
100 array("text", "text", "text"),
101 array($this->name, $a_attribs["name"], $a_attribs["dir"])
102 );
103 break;
104
105 }
106
107 // smeyer: first read outer xml
108 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
109 }
110
118 public function handlerEndTag($a_xml_parser, $a_name)
119 {
120 parent::handlerEndTag($a_xml_parser, $a_name);
121 }
122
123
131 public function handlerCharacterData($a_xml_parser, $a_data)
132 {
133 parent::handlerCharacterData($a_xml_parser, $a_data);
134
135 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
136 $a_data = preg_replace("/\n/", "", $a_data);
137 $a_data = preg_replace("/\t+/", "", $a_data);
138
139 if (!empty($a_data)) {
140 switch ($this->current_tag) {
141 case '':
142 }
143 }
144 }
145}
An exception for terminatinating execution or to throw for unit testing.
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
__construct($a_path, $a_name, $a_type)
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
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
if($format !==null) $name
Definition: metadata.php:146
global $ilDB
$a_type
Definition: workflow.php:92