ILIAS  Release_4_1_x_branch Revision 61804
 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-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 
24 include_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  static function clearTables()
60  {
61  global $ilDB;
62 
63  // only this one clears parents tables (not service reader)
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  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
83 
84  switch ($a_name)
85  {
86  case 'module':
87  $this->current_module = $this->name;
88  $this->current_component = $this->type."/".$this->name;
89  $ilDB->manipulateF("INSERT INTO il_component (type, name, id) ".
90  "VALUES (%s,%s,%s)", array("text", "text", "text"),
91  array($this->type, $this->name, $a_attribs["id"]));
92  break;
93 
94  case 'baseclass':
95  $ilDB->manipulateF("INSERT INTO module_class (module, class, dir) ".
96  "VALUES (%s,%s,%s)", array("text", "text", "text"),
97  array($this->name, $a_attribs["name"], $a_attribs["dir"]));
98  break;
99 
100  }
101  }
102 
110  function handlerEndTag($a_xml_parser,$a_name)
111  {
112  parent::handlerEndTag($a_xml_parser,$a_name);
113  }
114 
115 
123  function handlerCharacterData($a_xml_parser,$a_data)
124  {
125  parent::handlerCharacterData($a_xml_parser,$a_data);
126 
127  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
128  $a_data = preg_replace("/\n/","",$a_data);
129  $a_data = preg_replace("/\t+/","",$a_data);
130 
131  if (!empty($a_data))
132  {
133  switch ($this->current_tag)
134  {
135  case '':
136  }
137  }
138  }
139 
140 }