ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilModuleReader.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 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 
24 include_once("./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  static function clearTables()
60  {
61  global $ilDB;
62 
63  // only this one clears parents tables (not service reader)
65 
66  $q = "DELETE FROM module_class";
67  $ilDB->query($q);
68  }
69 
70 
79  function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
80  {
81  global $ilDB;
82 
83  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
84 
85  switch ($a_name)
86  {
87  case 'module':
88  $this->current_module = $this->name;
89  $this->current_component = $this->type."/".$this->name;
90  $q = "INSERT INTO il_component (type, name, id) VALUES ".
91  "(".$ilDB->quote($this->type).",".
92  $ilDB->quote($this->name).",".
93  $ilDB->quote($a_attribs["id"]).")";
94  $ilDB->query($q);
95  break;
96 
97  case 'baseclass':
98  $q = "INSERT INTO module_class (module, class, dir) VALUES ".
99  "(".$ilDB->quote($this->name).",".
100  $ilDB->quote($a_attribs["name"]).",".
101  $ilDB->quote($a_attribs["dir"]).")";
102  $ilDB->query($q);
103  break;
104 
105  }
106  }
107 
115  function handlerEndTag($a_xml_parser,$a_name)
116  {
117  parent::handlerEndTag($a_xml_parser,$a_name);
118  }
119 
120 
128  function handlerCharacterData($a_xml_parser,$a_data)
129  {
130  parent::handlerCharacterData($a_xml_parser,$a_data);
131 
132  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
133  $a_data = preg_replace("/\n/","",$a_data);
134  $a_data = preg_replace("/\t+/","",$a_data);
135 
136  if (!empty($a_data))
137  {
138  switch ($this->current_tag)
139  {
140  case '':
141  }
142  }
143  }
144 
145 }