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
00034 class ilServiceReader extends ilSaxParser
00035 {
00036
00037 function ilServiceReader()
00038 {
00039 $this->executed = false;
00040 parent::ilSaxParser(ILIAS_ABSOLUTE_PATH."/services.xml");
00041 }
00042
00043 function getServices()
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 service";;
00070 $ilDB->query($q);
00071
00072 $q = "DELETE FROM service_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 'service':
00095 $this->current_module = $a_attribs["name"];
00096 $q = "INSERT INTO service (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 service_class (service, 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
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 }