ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPluginReader.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.ilSaxParser.php");
25 
36 {
37 
38  function ilPluginReader($a_path, $a_ctype, $a_cname, $a_slot_id, $a_pname)
39  {
40  parent::ilSaxParser($a_path);
41 
42 die("Deprecated. Plugin information is stored in plugin.php");
43 
44  $this->ctype = $a_ctype;
45  $this->cname = $a_cname;
46  $this->slot_id = $a_slot_id;
47  $this->pname = $a_pname;
48  }
49 
50  function startParsing()
51  {
53  }
54 
55  function setHandlers($a_xml_parser)
56  {
57  xml_set_object($a_xml_parser,$this);
58  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
59  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
60  }
61 
70  function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
71  {
72  global $ilDB;
73 
74  switch ($a_name)
75  {
76  case 'plugin':
77 
78  // check whether record exists
79  $q = "SELECT * FROM il_plugin WHERE ".
80  " component_type = ".$ilDB->quote($this->ctype).
81  " AND component_name = ".$ilDB->quote($this->cname).
82  " AND slot_id = ".$ilDB->quote($this->slot_id).
83  " AND name = ".$ilDB->quote($this->pname);
84  $set = $ilDB->query($q);
85  if ($set->numRows() == 0)
86  {
87  $q = "REPLACE INTO il_plugin (component_type,component_name,slot_id,".
88  "name, id, last_update_version, current_version, ilias_min_version,".
89  " ilias_max_version, active) VALUES ".
90  "(".$ilDB->quote($this->ctype).",".
91  $ilDB->quote($this->cname).",".
92  $ilDB->quote($this->slot_id).",".
93  $ilDB->quote($this->pname).",".
94  $ilDB->quote($a_attribs["id"]).",".
95  $ilDB->quote("0.0.0").",".
96  $ilDB->quote($a_attribs["version"]).",".
97  $ilDB->quote($a_attribs["ilias_min_version"]).",".
98  $ilDB->quote($a_attribs["ilias_max_version"]).",".
99  "0)";
100  $ilDB->query($q);
101  }
102  else
103  {
104  $q = "UPDATE il_plugin SET ".
105  " id = ".$ilDB->quote($a_attribs["id"]).",".
106  " current_version = ".$ilDB->quote($a_attribs["version"]).",".
107  " ilias_min_version = ".$ilDB->quote($a_attribs["ilias_min_version"]).",".
108  " ilias_max_version = ".$ilDB->quote($a_attribs["ilias_max_version"]).
109  " WHERE ".
110  " component_type = ".$ilDB->quote($this->ctype).
111  " AND component_name = ".$ilDB->quote($this->cname).
112  " AND slot_id = ".$ilDB->quote($this->slot_id).
113  " AND name = ".$ilDB->quote($this->pname);
114  $ilDB->query($q);
115  }
116  break;
117  }
118  }
119 
127  function handlerEndTag($a_xml_parser,$a_name)
128  {
129 
130  }
131 
132 
140  function handlerCharacterData($a_xml_parser,$a_data)
141  {
142  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
143  $a_data = preg_replace("/\n/","",$a_data);
144  $a_data = preg_replace("/\t+/","",$a_data);
145 
146  if (!empty($a_data))
147  {
148  switch ($this->current_tag)
149  {
150  case '':
151  }
152  }
153  }
154 
155 }