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
00024
00025 require_once("./classes/class.ilSaxParser.php");
00026
00036 class ilnetucateResponse extends ilSaxParser
00037 {
00042 function ilnetucateResponse($a_xml_str)
00043 {
00044 parent::ilSaxParser($a_xml_str);
00045
00046 $this->startParsing();
00047 }
00048
00049 function isError()
00050 {
00051 if ($this->data['response']['status'] == "error" or $this->data['response']['status'] == "")
00052 {
00053 return true;
00054 }
00055
00056 return false;
00057 }
00058
00059 function getErrorMsg()
00060 {
00061 if ($this->data['response']['status'] == "error" or $this->data['response']['status'] == "")
00062 {
00063 return trim($this->data['result']['cdata']);
00064 }
00065 }
00066
00067 function getResultMsg()
00068 {
00069 return trim($this->data['result']['cdata']);
00070 }
00071
00072 function getFirstID()
00073 {
00074 reset($this->data['id']);
00075 return current($this->data['id']);
00076 }
00077
00078
00084 function setHandlers($a_xml_parser)
00085 {
00086 xml_set_object($a_xml_parser,$this);
00087 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
00088 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
00089 }
00090
00094 function startParsing()
00095 {
00096 $xml_parser = $this->createParser();
00097 $this->setOptions($xml_parser);
00098 $this->setHandlers($xml_parser);
00099 $this->parse($xml_parser,$this->xml_file);
00100 $this->freeParser($xml_parser);
00101 return true;
00102 }
00103
00109 function parse($a_xml_parser,$a_xml_str)
00110 {
00111 $parseOk = xml_parse($a_xml_parser,$a_xml_str,true);
00112
00113 if (!$parseOk && (xml_get_error_code($a_xml_parser) != XML_ERROR_NONE))
00114 {
00115 $this->ilias->raiseError("XML Parse Error: ",$this->ilias->error_obj->FATAL);
00116 }
00117 }
00118
00119
00123 function handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
00124 {
00125 global $ilErr;
00126
00127 switch($a_name)
00128 {
00129 case "netucate.API.Response":
00130 $this->data['response']['failureCount'] = $a_attribs['failureCount'];
00131 $this->data['response']['operationTotal'] = $a_attribs['operationTotal'];
00132 $this->data['response']['status'] = $a_attribs['status'];
00133 $this->data['response']['successCount'] = $a_attribs['successCount'];
00134 break;
00135
00136 case "netucate.Result":
00137 $this->data['result']['code'] = $a_attribs['code'];
00138 $this->data['result']['id'] = $a_attribs['id'];
00139 $this->data['result']['name'] = $a_attribs['name'];
00140 $this->data['result']['request'] = $a_attribs['request'];
00141 break;
00142
00143 case "netucate.ElementID":
00144 $this->data['element']['type'] = $a_attribs['type'];
00145 break;
00146
00147 case "netucate.URL":
00148 break;
00149
00150 case "netucate.ID":
00151 break;
00152
00153 case "netucate.Class.List":
00154 case "netucate.User.List":
00155 break;
00156
00157 case "netucate.Class":
00158 $this->data['classes'][$a_attribs['classid']] = array (
00159 'name' => $a_attribs['name'],
00160 'instructoruserid' => $a_attribs['instructoruserid'],
00161 'bandwidth' => $a_attribs['bandwidth'],
00162 'appsharebandwidth' => $a_attribs['appsharebandwidth'],
00163 'description' => $a_attribs['description'],
00164 'password' => $a_attribs['password'],
00165 'message' => $a_attribs['message'],
00166 'floorpolicy' => $a_attribs['floorpolicy'],
00167 'conferencetypeid' => $a_attribs['conferencetypeid'],
00168 'videobandwidth' => $a_attribs['videobandwidth'],
00169 'videoframerate' => $a_attribs['videoframerate'],
00170 'enablepush' => $a_attribs['enablepush'],
00171 'issecure' => $a_attribs['issecure'],
00172 'alwaysopen' => $a_attribs['alwaysopen'],
00173 'akclassvalue1' => $a_attribs['akclassvalue1'],
00174 'akclassvalue1' => $a_attribs['akclassvalue1']
00175 );
00176 break;
00177
00178 case "netucate.User":
00179 $this->data['users'][$a_attribs['userid']] = array (
00180 'fullname' => $a_attribs['fullname']
00181 );
00182 break;
00183 }
00184 }
00185
00186
00187 function handlerEndTag($a_xml_parser, $a_name)
00188 {
00189 switch($a_name)
00190 {
00191 case "netucate.API.Response":
00192 $this->data['response']['cdata'] = $this->cdata;
00193 break;
00194
00195 case "netucate.Result":
00196 $this->data['result']['cdata'] = $this->cdata;
00197 break;
00198
00199 case "netucate.ElementID":
00200
00201 break;
00202
00203 case "netucate.URL":
00204 $this->data['url']['cdata'] = trim($this->cdata);
00205 break;
00206
00207 case "netucate.ID":
00208 $this->data['id'][trim($this->cdata)] = trim($this->cdata);
00209 break;
00210
00211 case "netucate.Class.List":
00212 case "netucate.Class":
00213 case "netucate.User.List":
00214 case "netucate.User":
00215 break;
00216 }
00217
00218 $this->cdata = '';
00219 }
00220
00224 function handlerCharacterData($a_xml_parser, $a_data)
00225 {
00226 if(!empty($a_data))
00227 {
00228 $this->cdata .= $a_data;
00229 }
00230 }
00231
00232 }
00233 ?>