本文整理匯總了PHP中OperationsData::RetrieveAirportInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP OperationsData::RetrieveAirportInfo方法的具體用法?PHP OperationsData::RetrieveAirportInfo怎麽用?PHP OperationsData::RetrieveAirportInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OperationsData
的用法示例。
在下文中一共展示了OperationsData::RetrieveAirportInfo方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRetrieveAirport
public function testRetrieveAirport()
{
echo '<h3>Core API Tests</h3>';
echo "<strong>Checking geonames server</strong><br />";
Config::Set('AIRPORT_LOOKUP_SERVER', 'geonames');
OperationsData::RemoveAirport('PANC');
$return = OperationsData::RetrieveAirportInfo('PANC');
$this->assertNotEqual($return, false);
echo "<strong>Checking phpVMS API server</strong><br />";
Config::Set('AIRPORT_LOOKUP_SERVER', 'phpvms');
Config::Set('PHPVMS_API_SERVER', 'http://apidev.phpvms.net');
OperationsData::RemoveAirport('PANC');
$return = OperationsData::RetrieveAirportInfo('PANC');
$this->assertNotEqual($return, false);
}
示例2: index
public function index()
{
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$postText = file_get_contents('php://input');
$rec_xml = trim(utf8_encode(file_get_contents('php://input')));
$xml = simplexml_load_string($rec_xml);
if (!$xml) {
#$this->log("Invalid XML Sent: \n".$rec_xml, 'kacars');
return;
}
#$this->log(print_r($xml->asXML(), true), 'kacars');
$case = strtolower($xml->switch->data);
switch ($case) {
case 'verify':
$results = Auth::ProcessLogin($xml->verify->pilotID, $xml->verify->password);
if ($results) {
$params = array('loginStatus' => '1');
//echo 1;
} else {
$params = array('loginStatus' => '0');
//echo 0;
}
$send = self::sendXML($params);
break;
case 'getbid':
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
$pilotinfo = PilotData::getPilotData($pilotid);
$biddata = SchedulesData::getLatestBid($pilotid);
$aircraftinfo = OperationsData::getAircraftByReg($biddata->registration);
if (count($biddata) == 1) {
if ($aircraftinfo->enabled == 1) {
$params = array('flightStatus' => '1', 'flightNumber' => $biddata->code . $biddata->flightnum, 'aircraftReg' => $biddata->registration, 'aircraftICAO' => $aircraftinfo->icao, 'aircraftFullName' => $aircraftinfo->fullname, 'flightLevel' => $biddata->flightlevel, 'aircraftMaxPax' => $aircraftinfo->maxpax, 'aircraftCargo' => $aircraftinfo->maxcargo, 'depICAO' => $biddata->depicao, 'arrICAO' => $biddata->arricao, 'route' => $biddata->route, 'depTime' => $biddata->deptime, 'arrTime' => $biddata->arrtime, 'flightTime' => $biddata->flighttime, 'flightType' => $biddata->flighttype, 'aircraftName' => $aircraftinfo->name, 'aircraftRange' => $aircraftinfo->range, 'aircraftWeight' => $aircraftinfo->weight, 'aircraftCruise' => $aircraftinfo->cruise);
} else {
$params = array('flightStatus' => '3');
// Aircraft Out of Service.
}
} else {
$params = array('flightStatus' => '2');
// You have no bids!
}
$send = $this->sendXML($params);
break;
case 'getflight':
$flightinfo = SchedulesData::getProperFlightNum($xml->pirep->flightNumber);
$params = array('s.code' => $flightinfo['code'], 's.flightnum' => $flightinfo['flightnum'], 's.enabled' => 1);
$biddata = SchedulesData::findSchedules($params, 1);
$aircraftinfo = OperationsData::getAircraftByReg($biddata[0]->registration);
if (count($biddata) == 1) {
$params = array('flightStatus' => '1', 'flightNumber' => $biddata[0]->code . $biddata[0]->flightnum, 'aircraftReg' => $biddata[0]->registration, 'aircraftICAO' => $aircraftinfo->icao, 'aircraftFullName' => $aircraftinfo->fullname, 'flightLevel' => $biddata[0]->flightlevel, 'aircraftMaxPax' => $aircraftinfo->maxpax, 'aircraftCargo' => $aircraftinfo->maxcargo, 'depICAO' => $biddata[0]->depicao, 'arrICAO' => $biddata[0]->arricao, 'route' => $biddata[0]->route, 'depTime' => $biddata[0]->deptime, 'arrTime' => $biddata[0]->arrtime, 'flightTime' => $biddata[0]->flighttime, 'flightType' => $biddata[0]->flighttype, 'aircraftName' => $aircraftinfo->name, 'aircraftRange' => $aircraftinfo->range, 'aircraftWeight' => $aircraftinfo->weight, 'aircraftCruise' => $aircraftinfo->cruise);
} else {
$params = array('flightStatus' => '2');
}
$send = $this->sendXML($params);
break;
case 'liveupdate':
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
# Get the distance remaining
$depapt = OperationsData::GetAirportInfo($xml->liveupdate->depICAO);
$arrapt = OperationsData::GetAirportInfo($xml->liveupdate->arrICAO);
$dist_remain = round(SchedulesData::distanceBetweenPoints($xml->liveupdate->latitude, $xml->liveupdate->longitude, $arrapt->lat, $arrapt->lng));
# Estimate the time remaining
if ($xml->liveupdate->groundSpeed > 0) {
$Minutes = round($dist_remain / $xml->liveupdate->groundSpeed * 60);
$time_remain = self::ConvertMinutes2Hours($Minutes);
} else {
$time_remain = '00:00';
}
$lat = str_replace(",", ".", $xml->liveupdate->latitude);
$lon = str_replace(",", ".", $xml->liveupdate->longitude);
$fields = array('pilotid' => $pilotid, 'flightnum' => $xml->liveupdate->flightNumber, 'pilotname' => '', 'aircraft' => $xml->liveupdate->registration, 'lat' => $lat, 'lng' => $lon, 'heading' => $xml->liveupdate->heading, 'alt' => $xml->liveupdate->altitude, 'gs' => $xml->liveupdate->groundSpeed, 'depicao' => $xml->liveupdate->depICAO, 'arricao' => $xml->liveupdate->arrICAO, 'deptime' => $xml->liveupdate->depTime, 'arrtime' => '', 'route' => $xml->liveupdate->route, 'distremain' => $dist_remain, 'timeremaining' => $time_remain, 'phasedetail' => $xml->liveupdate->status, 'online' => '', 'client' => 'kACARS');
#$this->log("UpdateFlightData: \n".print_r($fields, true), 'kacars');
ACARSData::UpdateFlightData($pilotid, $fields);
break;
case 'pirep':
$flightinfo = SchedulesData::getProperFlightNum($xml->pirep->flightNumber);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
$pilotid = PilotData::parsePilotID($xml->verify->pilotID);
# Make sure airports exist:
# If not, add them.
if (!OperationsData::GetAirportInfo($xml->pirep->depICAO)) {
OperationsData::RetrieveAirportInfo($xml->pirep->depICAO);
}
if (!OperationsData::GetAirportInfo($xml->pirep->arrICAO)) {
OperationsData::RetrieveAirportInfo($xml->pirep->arrICAO);
}
# Get aircraft information
$reg = trim($xml->pirep->registration);
$ac = OperationsData::GetAircraftByReg($reg);
# Load info
/* If no passengers set, then set it to the cargo */
$load = $xml->pirep->pax;
if (empty($load)) {
$load = $xml->pirep->cargo;
}
/* Fuel conversion - kAcars only reports in lbs */
$fuelused = $xml->pirep->fuelUsed;
if (Config::Get('LiquidUnit') == '0') {
# Convert to KGs, divide by density since d = mass * volume
$fuelused = $fuelused * 0.45359237 / 0.8075;
//.........這裏部分代碼省略.........
示例3: routeinfo
public function routeinfo()
{
if ($this->get->depicao == '' || $this->get->arricao == '') {
return;
}
$depinfo = OperationsData::GetAirportInfo($this->get->depicao);
if (!$depinfo) {
$depinfo = OperationsData::RetrieveAirportInfo($this->get->depicao);
}
$arrinfo = OperationsData::GetAirportInfo($this->get->arricao);
if (!$arrinfo) {
$arrinfo = OperationsData::RetrieveAirportInfo($this->get->arricao);
}
// Convert to json format
$c = array();
$c['depapt'] = (array) $depinfo;
$c['arrapt'] = (array) $arrinfo;
echo json_encode($c);
}
示例4: pirep
/**
* File PIREP
*
*/
public function pirep()
{
$data = "<?xml version=\"1.0\" encoding='UTF-8'?>" . trim(utf8_encode($_REQUEST['DATA2']));
$xml = simplexml_load_string($data);
$this->log($data, 'fsfk');
$this->log(print_r($xml, true), 'fsfk');
#$this->log(serialize($xml), 'fsfk');
$pilotid = PilotData::parsePilotID($xml->PilotID);
/*preg_match('/^([A-Za-z]*)(\d*)/', $xml->PilotID, $matches);
$code = $matches[1];
$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');*/
$flightinfo = SchedulesData::getProperFlightNum($xml->FlightNumber);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
# Extract the ICAO of the airport
$depicao = strtoupper(substr($xml->OriginICAO, 0, 4));
$arricao = strtoupper(substr($xml->DestinationICAO, 0, 4));
if (!OperationsData::GetAirportInfo($depicao)) {
OperationsData::RetrieveAirportInfo($depicao);
}
if (!OperationsData::GetAirportInfo($arricao)) {
OperationsData::RetrieveAirportInfo($arricao);
}
$load = (string) $xml->Passenger;
if ($load == '' || $load == 0) {
$load = (string) $xml->Cargo;
}
$flighttime = str_replace(':', '.', (string) $xml->BlockTime);
# Get the proper aircraft
$ac = OperationsData::GetAircraftByReg((string) $xml->AircraftTailNumber);
if (!$ac) {
$aircraft = 0;
} else {
$aircraft = $ac->id;
unset($ac);
}
/* Process the report, to put into the log */
$log = '';
$images = '';
$rawdata = array();
# Setup the base things
$rawdata['FLIGHTMAPS'] = array();
$rawdata['FLIGHTDATA'] = array();
foreach ($xml as $key => $value) {
/* Add the map images in */
if ($key == 'FLIGHTMAPS') {
$img = (string) $xml->FLIGHTMAPS->FlightMapJPG;
if ($img) {
$rawdata['FLIGHTMAPS']['FlightMap'] = $img;
}
$img = (string) $xml->FLIGHTMAPS->FlightMapWeatherJPG;
if ($img) {
$rawdata['FLIGHTMAPS']['FlightMapWeather'] = $img;
}
$img = (string) $xml->FLIGHTMAPS->FlightMapTaxiOutJPG;
if ($img) {
$rawdata['FLIGHTMAPS']['FlightMapTaxiOut'] = $img;
}
$img = (string) $xml->FLIGHTMAPS->FlightMapTaxiInJPG;
if ($img) {
$rawdata['FLIGHTMAPS']['FlightMapTaxiIn'] = $img;
}
$img = (string) $xml->FLIGHTMAPS->FlightMapVerticalProfileJPG;
if ($img) {
$rawdata['FLIGHTMAPS']['FlightMapVerticalProfile'] = $img;
}
$img = (string) $xml->FLIGHTMAPS->FlightMapLandingProfileJPG;
if ($img) {
$rawdata['FLIGHTMAPS']['FlightMapLandingProfile'] = $img;
}
continue;
} elseif ($key == 'FLIGHTPLAN') {
$rawdata['FLIGHTPLAN'] = (string) $value;
continue;
} elseif ($key == 'FLIGHTCRITIQUE') {
$value = trim((string) $value);
$rawdata['FLIGHTCRITIQUE'] = $value;
continue;
} else {
$key = trim($key);
$value = (string) $value;
$value = str_replace('¯Â', '', $value);
$rawdata['FLIGHTDATA'][$key] = $value;
}
}
/* Our data to send to the submit PIREP function */
$data = array('pilotid' => $pilotid, 'code' => $code, 'flightnum' => $flightnum, 'depicao' => $depicao, 'arricao' => $arricao, 'aircraft' => $aircraft, 'registration' => (string) $xml->AircraftTailNumber, 'flighttime' => $flighttime, 'landingrate' => (string) $xml->ONVS, 'submitdate' => 'NOW()', 'comment' => trim((string) $xml->COMMENT), 'fuelused' => (string) $xml->BlockFuel, 'source' => 'fsfk', 'load' => $load, 'log' => $log, 'rawdata' => $rawdata);
$this->log(print_r($data, true), 'fsfk');
$ret = ACARSData::FilePIREP($pilotid, $data);
if (!$ret) {
echo PIREPData::$lasterror;
} else {
echo '<script type="text/javascript">window.location="' . url('/pireps/view/' . ACARSData::$pirepid) . '";</script>';
}
}
示例5: routeinfo
public function routeinfo($depicao = '', $arricao = '')
{
header('Content-type: text/xml');
if ($depicao == '') {
$depicao = $_GET['depicao'];
}
if ($arricao == '') {
$arricao = $_GET['arricao'];
}
if ($depicao == '' || $arricao == '') {
return;
}
$depinfo = OperationsData::GetAirportInfo($depicao);
if (!$depinfo) {
$depinfo = OperationsData::RetrieveAirportInfo($depicao);
}
$arrinfo = OperationsData::GetAirportInfo($arricao);
if (!$arrinfo) {
$arrinfo = OperationsData::RetrieveAirportInfo($arricao);
}
$xml = new SimpleXMLElement('<flightinfo/>');
$dep = $xml->addChild('departure');
$dep->addAttribute('icao', $depinfo->icao);
$dep->addAttribute('name', $depinfo->name);
$dep->addAttribute('country', $depinfo->country);
$dep->addAttribute('lat', $depinfo->lat);
$dep->addAttribute('lng', $depinfo->lng);
$arr = $xml->addChild('arrival');
$arr->addAttribute('icao', $arrinfo->icao);
$arr->addAttribute('name', $arrinfo->name);
$arr->addAttribute('country', $arrinfo->country);
$arr->addAttribute('lat', $arrinfo->lat);
$arr->addAttribute('lng', $arrinfo->lng);
header('Content-type: text/xml');
echo $xml->asXML();
}
示例6: array
$_GET['dest'] = DB::escape($_GET['dest']);
# Get schedule info, using minimal information
# Check if they forgot the flight code
if ($code == '') {
# Find a flight using just the flight code
$sched = SchedulesData::FindFlight($flightnum);
# Can't do it. They completely fucked this up
if (!$sched) {
return;
}
$code = $sched->code;
$flightnum = $sched->flightnum;
if ($_GET['origin'] != $sched->depicao || $_GET['dest'] != $sched->arricao) {
$comment = 'phpVMS Message: Arrival or Departure does not match schedule';
}
}
# Make sure airports exist:
# If not, add them.
if (!OperationsData::GetAirportInfo($_GET['origin'])) {
OperationsData::RetrieveAirportInfo($_GET['origin']);
}
if (!OperationsData::GetAirportInfo($_GET['dest'])) {
OperationsData::RetrieveAirportInfo($_GET['dest']);
}
# Convert the time to xx.xx
$flighttime = number_format(floatval(str_replace(':', '.', $_GET['duration'])), 2);
$data = array('pilotid' => $pilotid, 'code' => $code, 'flightnum' => $flightnum, 'depicao' => $_GET['origin'], 'arricao' => $_GET['dest'], 'aircraft' => $ac->id, 'flighttime' => $flighttime, 'landingrate' => $landingrate, 'submitdate' => 'NOW()', 'comment' => $comment, 'fuelused' => $_GET['fuel'], 'source' => 'fsacars', 'route' => $route, 'load' => $load, 'rawdata' => $log, 'log' => $_GET['log']);
$ret = ACARSData::FilePIREP($pilotid, $data);
echo 'OK';
break;
}
示例7: intval
$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');
}
else
{
$pilotid = $data[0];
}*/
$pilotid = PilotData::parsePilotID($data[0]);
# Make sure airports exist:
# If not, add them.
$depicao = $data[6];
$arricao = $data[7];
if (!OperationsData::GetAirportInfo($depicao)) {
OperationsData::RetrieveAirportInfo($depicao);
}
if (!OperationsData::GetAirportInfo($arricao)) {
OperationsData::RetrieveAirportInfo($arricao);
}
# Get aircraft information
$reg = trim($data[3]);
$ac = OperationsData::GetAircraftByReg($reg);
# Load info
/* If no passengers set, then set it to the cargo */
$load = $data[14];
if (empty($load)) {
$load = $data[15];
}
# Convert the time to xx.xx
$flighttime = floatval(str_replace(':', '.', $data[11])) * 1.0;
/* Fuel conversion - XAcars only reports in lbs */
$fuelused = $data[12];
if (Config::Get('LiquidUnit') == '0') {
示例8: get_airport_info
protected function get_airport_info($icao)
{
echo "ICAO {$icao} not added... retriving information: <br />";
$aptinfo = OperationsData::RetrieveAirportInfo($icao);
if ($aptinfo === false) {
echo 'Could not retrieve information for ' . $icao . ', add it manually <br />';
} else {
echo "Found: {$icao} - " . $aptinfo->name . ' (' . $aptinfo->lat . ',' . $aptinfo->lng . '), airport added<br /><br />';
return $aptinfo;
}
}
示例9: fileReport
/**
* PIREPData::fileReport()
*
* @param mixed $pirepdata
* @return
*/
public static function fileReport($pirepdata)
{
/*$pirepdata = array('pilotid'=>'',
'code'=>'',
'flightnum'=>'',
'depicao'=>'',
'arricao'=>'',
'aircraft'=>'',
'flighttime'=>'',
'submitdate'=>'',
'comment'=>'',
'fuelused'=>'',
'source'=>''
'log'=>''
);*/
if (!is_array($pirepdata)) {
return false;
}
$pirepdata['code'] = strtoupper($pirepdata['code']);
$pirepdata['flightnum'] = strtoupper($pirepdata['flightnum']);
$pirepdata['depicao'] = strtoupper($pirepdata['depicao']);
$pirepdata['arricao'] = strtoupper($pirepdata['arricao']);
/* Check if this PIREP was just submitted, check the last 10 minutes
*/
if (Config::Get('PIREP_CHECK_DUPLICATE') == true) {
$time_limit = Config::Get('PIREP_TIME_CHECK');
if (empty($time_limit)) {
$time_limit = 1;
}
$sql = "SELECT `pirepid` FROM " . TABLE_PREFIX . "pireps\n\t\t\t\t\tWHERE `pilotid` = {$pirepdata['pilotid']} \n\t\t\t\t\t\tAND `code` = '{$pirepdata['code']}'\n\t\t\t\t\t\tAND `flightnum` = '{$pirepdata['flightnum']}' \n\t\t\t\t\t\tAND DATE_SUB(NOW(), INTERVAL {$time_limit} MINUTE) <= `submitdate`";
$res = DB::get_row($sql);
if ($res) {
self::$lasterror = 'This PIREP was just submitted!';
return $res->pirepid;
}
}
if ($pirepdata['depicao'] == '' || $pirepdata['arricao'] == '') {
self::$lasterror = 'The departure or arrival airports are blank';
return false;
}
# Check the aircraft
if (!is_numeric($pirepdata['aircraft'])) {
// Check by registration
$ac = OperationsData::getAircraftByReg($pirepdata['aircraft']);
if ($ac) {
$pirepdata['aircraft'] = $ac->id;
} else {
// Check by name
$ac = OperationsData::getAircraftByName($pirepdata['aircraft']);
if ($ac) {
$pirepdata['aircraft'] = $ac->id;
} else {
$pirepdata['aircraft'] = '0';
}
}
}
# Check the airports, add to database if they don't exist
$depapt = OperationsData::getAirportInfo($pirepdata['depicao']);
if (!$depapt) {
$depapt = OperationsData::RetrieveAirportInfo($pirepdata['depicao']);
}
$arrapt = OperationsData::getAirportInfo($pirepdata['arricao']);
if (!$arrapt) {
$arrapt = OperationsData::RetrieveAirportInfo($pirepdata['arricao']);
}
# Look up the schedule
$sched = SchedulesData::getScheduleByFlight($pirepdata['code'], $pirepdata['flightnum']);
/* Get route information, and also the detailed layout of the route
Store it cached, in case the schedule changes later, then the route
information remains intact. Also, if the nav data changes, then
the route is saved as it was
*/
if (!empty($pirepdata['route'])) {
/* They supplied some route information, so build up the data
based on that. It needs a certain structure passed, so build that */
$pirepdata['route'] = str_replace('SID', '', $pirepdata['route']);
$pirepdata['route'] = str_replace('STAR', '', $pirepdata['route']);
$pirepdata['route'] = str_replace('DCT', '', $pirepdata['route']);
$pirepdata['route'] = trim($pirepdata['route']);
$tmp = new stdClass();
$tmp->deplat = $depapt->lat;
$tmp->deplng = $depapt->lng;
$tmp->route = $pirepdata['route'];
$pirepdata['route_details'] = NavData::parseRoute($tmp);
$pirepdata['route_details'] = serialize($pirepdata['route_details']);
unset($tmp);
}
if (empty($pirepdata['route']) && !empty($sched->route)) {
$pirepdata['route'] = $sched->route;
$pirepdata['route'] = str_replace('SID', '', $pirepdata['route']);
$pirepdata['route'] = str_replace('STAR', '', $pirepdata['route']);
$pirepdata['route'] = str_replace('DCT', '', $pirepdata['route']);
$pirepdata['route'] = trim($pirepdata['route']);
/* The schedule doesn't have any route_details, so let's populate
//.........這裏部分代碼省略.........
示例10: stdClass
?>
</textarea>
<br />
<input type="submit" name="submit" value="View Route" />
</form>
<pre>
<?php
$data = new stdClass();
$data->route = $_GET['route'];
$depicao = OperationsData::getAirportInfo($_GET['depicao']);
if (!$depicao) {
$depicao = OperationsData::RetrieveAirportInfo($_GET['depicao']);
}
$arricao = OperationsData::getAirportInfo($_GET['arricao']);
if (!$arricao) {
$arricao = OperationsData::RetrieveAirportInfo($_GET['arricao']);
}
$data->deplat = $depicao->lat;
$data->deplng = $depicao->lng;
$data->depname = $depicao->name;
$data->arrlat = $arricao->lat;
$data->arrlng = $arricao->lng;
$data->arrname = $arricao->name;
unset($depicao);
unset($arricao);
$data->route_details = NavData::parseRoute($data);
print_r($data->route_details);
$mapdata = $data;
?>
</pre>
<h4>Route Map</h4>