• Main Page
  • Related Pages
  • Modules
  • 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 
00033 class ilModuleReader extends ilSaxParser
00034 {
00035 
00036         function ilModuleReader()
00037         {
00038                 $this->executed = false;
00039                 parent::ilSaxParser(ILIAS_ABSOLUTE_PATH."/modules.xml");
00040         }
00041         
00042         function getModules()
00043         {
00044                 if (!$this->executed)
00045                 {
00046                         $this->clearTables();
00047                         $this->startParsing();
00048                         $this->executed = true;
00049                 }
00050         }
00051 
00052         
00053         function setHandlers($a_xml_parser)
00054         {
00055                 xml_set_object($a_xml_parser,$this);
00056                 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
00057                 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
00058         }
00059 
00060 
00064         function clearTables()
00065         {
00066                 global $ilDB;
00067 
00068                 $q = "DELETE FROM module";;
00069                 $ilDB->query($q);
00070 
00071                 $q = "DELETE FROM module_class";;
00072                 $ilDB->query($q);
00073 
00074         }
00075 
00076 
00085         function handlerBeginTag($a_xml_parser,$a_name,$a_attribs)
00086         {
00087                 global $ilDB;
00088 
00089                 $this->current_tag = $a_name;
00090                 
00091                 switch ($a_name)
00092                 {
00093                         case 'module':
00094                                 $this->current_module = $a_attribs["name"];
00095                                 $q = "INSERT INTO module (name, dir) VALUES ".
00096                                         "(".$ilDB->quote($a_attribs["name"]).",".
00097                                         $ilDB->quote($a_attribs["dir"]).")";
00098                                 $ilDB->query($q);
00099                                 break;
00100                                 
00101                         case 'baseclass':
00102                                 $q = "INSERT INTO module_class (module, class, dir) VALUES ".
00103                                         "(".$ilDB->quote($this->current_module).",".
00104                                         $ilDB->quote($a_attribs["name"]).",".
00105                                         $ilDB->quote($a_attribs["dir"]).")";
00106                                 $ilDB->query($q);
00107                                 break;
00108                                 
00109                 }
00110         }
00111                         
00119         function handlerEndTag($a_xml_parser,$a_name)
00120         {
00121         }
00122 
00123                         
00131         function handlerCharacterData($a_xml_parser,$a_data)
00132         {
00133                 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
00134                 $a_data = preg_replace("/\n/","",$a_data);
00135                 $a_data = preg_replace("/\t+/","",$a_data);
00136 
00137                 if (!empty($a_data))
00138                 {
00139                         switch ($this->current_tag)
00140                         {
00141                                 case '':
00142                         }
00143                 }
00144         }
00145 
00146 }

Generated on Fri Dec 13 2013 17:57:03 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1