ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  public function __construct($a_path, $a_name, $a_type)
38  {
39  parent::__construct($a_path, $a_name, $a_type);
40  }
41 
42  public function getServices()
43  {
44  $this->startParsing();
45  }
46 
47 
48  public 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  public function clearTables()
60  {
61  global $ilDB;
62 
63  $ilDB->manipulate("DELETE FROM service_class");
64  }
65 
66 
75  public function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
76  {
77  global $ilDB;
78 
79 
80  switch ($a_name) {
81  case 'service':
82  $this->current_service = $this->name;
83  $this->current_component = $this->type . "/" . $this->name;
84  $ilDB->manipulateF(
85  "INSERT INTO il_component (type, name, id) " .
86  "VALUES (%s,%s,%s)",
87  array("text", "text", "text"),
88  array($this->type, $this->name, $a_attribs["id"])
89  );
90 
91  $this->setComponentId($a_attribs['id']);
92  break;
93 
94  case 'baseclass':
95  $ilDB->manipulateF(
96  "INSERT INTO service_class (service, class, dir) " .
97  "VALUES (%s,%s,%s)",
98  array("text", "text", "text"),
99  array($this->name, $a_attribs["name"], $a_attribs["dir"])
100  );
101  break;
102 
103  }
104 
105  // smeyer: first read outer xml
106  parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
107  }
108 
116  public function handlerEndTag($a_xml_parser, $a_name)
117  {
118  parent::handlerEndTag($a_xml_parser, $a_name);
119  }
120 
121 
129  public function handlerCharacterData($a_xml_parser, $a_data)
130  {
131  parent::handlerCharacterData($a_xml_parser, $a_data);
132 
133  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
134  $a_data = preg_replace("/\n/", "", $a_data);
135  $a_data = preg_replace("/\t+/", "", $a_data);
136 
137  if (!empty($a_data)) {
138  switch ($this->current_tag) {
139  case '':
140  }
141  }
142  }
143 }
setComponentId($a_component_id)
Set from module or service reader.
handlerCharacterData($a_xml_parser, $a_data)
end tag handler
startParsing()
stores xml data in array
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
start tag handler
Class ilServiceReader.
$a_type
Definition: workflow.php:92
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
setHandlers($a_xml_parser)
Component definition reader (reads common tags in module.xml and service.xml files) Name is misleadin...
global $ilDB
__construct($a_path, $a_name, $a_type)
clearTables()
clear the tables
handlerEndTag($a_xml_parser, $a_name)
end tag handler