当前位置: 首页>>代码示例>>PHP>>正文


PHP Spotter::getAllAircraftInfo方法代码示例

本文整理汇总了PHP中Spotter::getAllAircraftInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Spotter::getAllAircraftInfo方法的具体用法?PHP Spotter::getAllAircraftInfo怎么用?PHP Spotter::getAllAircraftInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spotter的用法示例。


在下文中一共展示了Spotter::getAllAircraftInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateFieldsFromOtherTables

 public static function updateFieldsFromOtherTables()
 {
     global $globalDebug;
     $Connection = new Connection();
     // routes
     if ($globalDebug) {
         print "Routes...\n";
     }
     $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != ''";
     $sth = Connection::$db->prepare($query);
     $sth->execute();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $departure_airport_array = Spotter::getAllAirportInfo($row['fromairport_icao']);
         $arrival_airport_array = Spotter::getAllAirportInfo($row['toairport_icao']);
         if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) {
             $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id";
             $sthu = Connection::$db->prepare($update_query);
             $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country']));
         }
     }
     if ($globalDebug) {
         print "Airlines...\n";
     }
     //airlines
     $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available'";
     $sth = Connection::$db->prepare($query);
     $sth->execute();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         if (is_numeric(substr($row['ident'], -1, 1))) {
             $airline_array = Spotter::getAllAirlineInfo(substr($row['ident'], 0, 3));
             $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id";
             $sthu = Connection::$db->prepare($update_query);
             $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id']));
         }
     }
     if ($globalDebug) {
         print "Remove Duplicate in aircraft_modes...\n";
     }
     //duplicate modes
     $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL";
     $sth = Connection::$db->prepare($query);
     $sth->execute();
     if ($globalDebug) {
         print "Aircraft...\n";
     }
     //aircraft
     $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available'";
     $sth = Connection::$db->prepare($query);
     $sth->execute();
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         if ($row['aircraft_icao'] != '') {
             $aircraft_name = Spotter::getAllAircraftInfo($row['aircraft_icao']);
             if ($row['registration'] != "") {
                 Image::addSpotterImage($row['registration']);
             }
             if (count($aircraft_name) > 0) {
                 $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id";
                 $sthu = Connection::$db->prepare($update_query);
                 $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id']));
             }
         }
     }
 }
开发者ID:kletellier,项目名称:FlightAirMap,代码行数:63,代码来源:class.Spotter.php

示例2: strtolower

 if (isset($spotter_item['registration'])) {
     $output .= '"registration": "' . $spotter_item['registration'] . '",';
 }
 if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
     $output .= '"aircraft_name": "' . $spotter_item['aircraft_name'] . ' (' . $spotter_item['aircraft_type'] . ')",';
     $output .= '"aircraft_wiki": "http://' . strtolower($globalLanguage) . '.wikipedia.org/wiki/' . urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])) . '",';
 } elseif (isset($spotter_item['aircraft_type'])) {
     $output .= '"aircraft_name": "NA (' . $spotter_item['aircraft_type'] . ')",';
 } elseif (!$min) {
     $output .= '"aircraft_name": "NA",';
 }
 if (!isset($spotter_item['aircraft_shadow'])) {
     if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
         $spotter_item['aircraft_shadow'] = '';
     } else {
         $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
         if (count($aircraft_info) > 0) {
             $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
         } else {
             $spotter_item['aircraft_shadow'] = '';
         }
     }
 }
 if ($spotter_item['aircraft_shadow'] == '') {
     $output .= '"aircraft_shadow": "default.png",';
 } else {
     $output .= '"aircraft_shadow": "' . $spotter_item['aircraft_shadow'] . '",';
 }
 if (isset($spotter_item['airline_name'])) {
     $output .= '"airline_name": "' . $spotter_item['airline_name'] . '",';
 } elseif (!$min) {
开发者ID:linuxpronl,项目名称:FlightAirMap,代码行数:31,代码来源:live-geojson.php


注:本文中的Spotter::getAllAircraftInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。