ILIAS  Release_4_0_x_branch Revision 61816
 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("./setup/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  $ilDB->manipulate("DELETE FROM service_class");
65  }
66 
67 
76  function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
77  {
78  global $ilDB;
79 
80  parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
81 
82  switch ($a_name)
83  {
84  case 'service':
85  $this->current_service = $this->name;
86  $this->current_component = $this->type."/".$this->name;
87  $ilDB->manipulateF("INSERT INTO il_component (type, name, id) ".
88  "VALUES (%s,%s,%s)", array("text", "text", "text"),
89  array($this->type, $this->name, $a_attribs["id"]));
90  break;
91 
92  case 'baseclass':
93  $ilDB->manipulateF("INSERT INTO service_class (service, class, dir) ".
94  "VALUES (%s,%s,%s)", array("text", "text", "text"),
95  array($this->name, $a_attribs["name"], $a_attribs["dir"]));
96  break;
97 
98  }
99  }
100 
108  function handlerEndTag($a_xml_parser,$a_name)
109  {
110  parent::handlerEndTag($a_xml_parser,$a_name);
111  }
112 
113 
121  function handlerCharacterData($a_xml_parser,$a_data)
122  {
123  parent::handlerCharacterData($a_xml_parser,$a_data);
124 
125  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
126  $a_data = preg_replace("/\n/","",$a_data);
127  $a_data = preg_replace("/\t+/","",$a_data);
128 
129  if (!empty($a_data))
130  {
131  switch ($this->current_tag)
132  {
133  case '':
134  }
135  }
136  }
137 
138 }