ILIAS  release_7 Revision v7.30-3-g800a261c036
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
34{
35 public function getModules()
36 {
37 $this->startParsing();
38 }
39
40 public function setHandlers($a_xml_parser)
41 {
42 xml_set_object($a_xml_parser, $this);
43 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
44 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
45 }
46
47
51 public function clearTables()
52 {
53 // only this one clears parents tables (not service reader)
54 parent::clearTables();
55
56 $this->db->manipulate("DELETE FROM module_class");
57 }
58
59
68 public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
69 {
70 switch ($a_name) {
71 case 'module':
72 $this->current_module = $this->name;
73 $this->current_component = $this->type . "/" . $this->name;
74 $this->db->manipulateF(
75 "INSERT INTO il_component (type, name, id) " .
76 "VALUES (%s,%s,%s)",
77 array("text", "text", "text"),
78 array($this->type, $this->name, $a_attribs["id"])
79 );
80
81 $this->setComponentId($a_attribs['id']);
82 break;
83
84 case 'baseclass':
85 $this->db->manipulateF(
86 "INSERT INTO module_class (module, class, dir) " .
87 "VALUES (%s,%s,%s)",
88 array("text", "text", "text"),
89 array($this->name, $a_attribs["name"], $a_attribs["dir"])
90 );
91 break;
92
93 }
94
95 // smeyer: first read outer xml
96 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
97 }
98
106 public function handlerEndTag($a_xml_parser, $a_name)
107 {
108 parent::handlerEndTag($a_xml_parser, $a_name);
109 }
110
111
119 public function handlerCharacterData($a_xml_parser, $a_data)
120 {
121 parent::handlerCharacterData($a_xml_parser, $a_data);
122
123 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
124 $a_data = preg_replace("/\n/", "", $a_data);
125 $a_data = preg_replace("/\t+/", "", $a_data);
126
127 if (!empty($a_data)) {
128 switch ($this->current_tag) {
129 case '':
130 }
131 }
132 }
133}
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
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:230