Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
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 }