ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilServiceReader.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2005 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 ilServiceReader($a_path, $a_name, $a_type)
39  {
40  parent::ilObjDefReader($a_path, $a_name, $a_type);
41  }
42 
43  function getServices()
44  {
45  $this->startParsing();
46  }
47 
48 
49  function setHandlers($a_xml_parser)
50  {
51  xml_set_object($a_xml_parser,$this);
52  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
53  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
54  }
55 
56 
60  static function clearTables()
61  {
62  global $ilDB;
63 
64  $q = "DELETE FROM service_class";;
65  $ilDB->query($q);
66 
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 'service':
87  $this->current_service = $this->name;
88  $this->current_component = $this->type."/".$this->name;
89  $q = "INSERT INTO il_component (type, name, id) VALUES ".
90  "(".$ilDB->quote($this->type).",".
91  $ilDB->quote($this->name).",".
92  $ilDB->quote($a_attribs["id"]).")";
93  $ilDB->query($q);
94  break;
95 
96  case 'baseclass':
97  $q = "INSERT INTO service_class (service, class, dir) VALUES ".
98  "(".$ilDB->quote($this->name).",".
99  $ilDB->quote($a_attribs["name"]).",".
100  $ilDB->quote($a_attribs["dir"]).")";
101  $ilDB->query($q);
102  break;
103 
104  }
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 }