• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

setup/classes/class.ilModuleReader.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00034 class ilModuleReader extends ilSaxParser
00035 {
00036 
00037         function ilModuleReader()
00038         {
00039                 $this->executed = false;
00040                 parent::ilSaxParser(ILIAS_ABSOLUTE_PATH."/modules.xml");
00041         }
00042         
00043         function getModules()
00044         {
00045                 if (!$this->executed)
00046                 {
00047                         $this->clearTables();
00048                         $this->startParsing();
00049                         $this->executed = true;
00050                 }
00051         }
00052 
00053         
00054         function setHandlers($a_xml_parser)
00055         {
00056                 xml_set_object($a_xml_parser,$this);
00057                 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
00058                 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
00059         }
00060 
00061 
00065         function clearTables()
00066         {
00067                 global $ilDB;
00068 
00069                 $q = "DELETE FROM module";;
00070                 $ilDB->query($q);
00071 
00072                 $q = "DELETE FROM module_class";;
00073                 $ilDB->query($q);
00074 
00075         }
00076 
00077 
00086         function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
00087         {
00088                 global $ilDB;
00089 
00090                 $this->current_tag = $a_name;
00091                 
00092                 switch ($a_name)
00093                 {
00094                         case 'module':
00095                                 $this->current_module = $a_attribs["name"];
00096                                 $q = "INSERT INTO module (name, dir) VALUES ".
00097                                         "(".$ilDB->quote($a_attribs["name"]).",".
00098                                         $ilDB->quote($a_attribs["dir"]).")";
00099                                 $ilDB->query($q);
00100                                 break;
00101                                 
00102                         case 'baseclass':
00103                                 $q = "INSERT INTO module_class (module, class, dir) VALUES ".
00104                                         "(".$ilDB->quote($this->current_module).",".
00105                                         $ilDB->quote($a_attribs["name"]).",".
00106                                         $ilDB->quote($a_attribs["dir"]).")";
00107                                 $ilDB->query($q);
00108                                 break;
00109                                 
00110                 }
00111         }
00112                         
00120         function handlerEndTag($a_xml_parser,$a_name)
00121         {
00122         }
00123 
00124                         
00132         function handlerCharacterData($a_xml_parser,$a_data)
00133         {
00134                 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
00135                 $a_data = preg_replace("/\n/","",$a_data);
00136                 $a_data = preg_replace("/\t+/","",$a_data);
00137 
00138                 if (!empty($a_data))
00139                 {
00140                         switch ($this->current_tag)
00141                         {
00142                                 case '':
00143                         }
00144                 }
00145         }
00146 
00147 
00148 }

Generated on Fri Dec 13 2013 10:18:31 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1