本文整理汇总了PHP中Spotter类的典型用法代码示例。如果您正苦于以下问题:PHP Spotter类的具体用法?PHP Spotter怎么用?PHP Spotter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Spotter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ident2icao
/**
* Change IATA to ICAO value for ident
*
* @param String $ident ident
* @return String the icao
*/
public function ident2icao($ident)
{
$Spotter = new Spotter();
if (!is_numeric(substr($ident, 0, 3))) {
if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) {
$airline_icao = substr($ident, 0, 2);
} elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) {
//$airline_icao = substr($ident, 0, 3);
return $ident;
} else {
return $ident;
}
} else {
return $ident;
}
if ($airline_icao == 'AF') {
if (filter_var(substr($ident, 2), FILTER_VALIDATE_INT, array("flags" => FILTER_FLAG_ALLOW_OCTAL))) {
$icao = $ident;
} else {
$icao = 'AFR' . ltrim(substr($ident, 2), '0');
}
} else {
$identicao = $Spotter->getAllAirlineInfo($airline_icao);
if (isset($identicao[0])) {
$icao = $identicao[0]['icao'] . ltrim(substr($ident, 2), '0');
} else {
$icao = $ident;
}
}
return $icao;
}
示例2: getLastLiveSpotterDataById
/**
* Gets last spotter information based on a particular callsign
*
* @return Array the spotter information
*
*/
public static function getLastLiveSpotterDataById($id)
{
date_default_timezone_set('UTC');
$id = filter_var($id, FILTER_SANITIZE_STRING);
$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
$spotter_array = Spotter::getDataFromDB($query, array(':id' => $id));
return $spotter_array;
}
示例3: drawCharts
print '<div><span class="label">Coordinates</span><a href="http://maps.google.ca/maps?z=10&t=k&q=' . $airport_array[0]['latitude'] . ',' . $airport_array[0]['longitude'] . '" target="_blank">Google Map<i class="fa fa-angle-double-right"></i></a></div>';
print '</div>';
} else {
print '<div class="alert alert-warning">This special airport profile shows all flights that do <u>not</u> have a departure and/or arrival airport associated with them.</div>';
}
include 'airport-sub-menu.php';
print '<div class="column">';
print '<h2>Most Common Arrival Airports</h2>';
?>
<p>The statistic below shows all arrival airports of flights from <strong><?php
print $airport_array[0]['city'] . ', ' . $airport_array[0]['name'] . ' (' . $airport_array[0]['icao'] . ')';
?>
</strong>.</p>
<?php
$airport_airport_array = Spotter::countAllArrivalAirportsByAirport($_GET['airport']);
?>
<script>
google.load("visualization", "1", {packages:["geochart"]});
google.setOnLoadCallback(drawCharts);
$(window).resize(function(){
drawCharts();
});
function drawCharts() {
var data = google.visualization.arrayToDataTable([
["Airport", "# of Times"],
<?php
foreach ($airport_airport_array as $airport_item) {
$name = $airport_item['airport_arrival_city'] . ', ' . $airport_item['airport_arrival_country'] . ' (' . $airport_item['airport_arrival_icao'] . ')';
$name = str_replace("'", "", $name);
示例4: Spotter
<?php
require 'require/class.Connection.php';
require 'require/class.Spotter.php';
$Spotter = new Spotter();
if ($_GET['flightaware_id'] != "") {
$spotter_id = $Spotter->getSpotterIDBasedOnFlightAwareID($_GET['flightaware_id']);
if ($spotter_id != "") {
header('Location: ' . $globalURL . '/flightid/' . $spotter_id);
} else {
header('Location: ' . $globalURL);
}
}
示例5: drawChart
require 'require/class.Connection.php';
require 'require/class.Spotter.php';
$spotter_array = Spotter::getSpotterDataByRoute($_GET['departure_airport'], $_GET['arrival_airport'], "0,1", $_GET['sort']);
if (!empty($spotter_array)) {
$title = 'Most Common Time of Day between ' . $spotter_array[0]['departure_airport_name'] . ' (' . $spotter_array[0]['departure_airport_icao'] . '), ' . $spotter_array[0]['departure_airport_country'] . ' - ' . $spotter_array[0]['arrival_airport_name'] . ' (' . $spotter_array[0]['arrival_airport_icao'] . '), ' . $spotter_array[0]['arrival_airport_country'];
require 'header.php';
print '<div class="info column">';
print '<h1>Flights between ' . $spotter_array[0]['departure_airport_name'] . ' (' . $spotter_array[0]['departure_airport_icao'] . '), ' . $spotter_array[0]['departure_airport_country'] . ' - ' . $spotter_array[0]['arrival_airport_name'] . ' (' . $spotter_array[0]['arrival_airport_icao'] . '), ' . $spotter_array[0]['arrival_airport_country'] . '</h1>';
print '<div><span class="label">Coming From</span><a href="' . $globalURL . '/airport/' . $spotter_array[0]['departure_airport_icao'] . '">' . $spotter_array[0]['departure_airport_name'] . ' (' . $spotter_array[0]['departure_airport_icao'] . '), ' . $spotter_array[0]['departure_airport_country'] . '</a></div>';
print '<div><span class="label">Flying To</span><a href="' . $globalURL . '/airport/' . $spotter_array[0]['arrival_airport_icao'] . '">' . $spotter_array[0]['arrival_airport_name'] . ' (' . $spotter_array[0]['arrival_airport_icao'] . '), ' . $spotter_array[0]['arrival_airport_country'] . '</a></div>';
print '</div>';
include 'route-sub-menu.php';
print '<div class="column">';
print '<h2>Most Common Time of Day</h2>';
print '<p>The statistic below shows the most common time of day of flights between <strong>' . $spotter_array[0]['departure_airport_name'] . ' (' . $spotter_array[0]['departure_airport_icao'] . '), ' . $spotter_array[0]['departure_airport_country'] . '</strong> and <strong>' . $spotter_array[0]['arrival_airport_name'] . ' (' . $spotter_array[0]['arrival_airport_icao'] . '), ' . $spotter_array[0]['arrival_airport_country'] . '</strong>.</p>';
$hour_array = Spotter::countAllHoursByRoute($_GET['departure_airport'], $_GET['arrival_airport']);
print '<div id="chartHour" class="chart" width="100%"></div>
<script>
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
["Hour", "# of Flights"], ';
foreach ($hour_array as $hour_item) {
$hour_data .= '[ "' . date("ga", strtotime($hour_item['hour_name'] . ":00")) . '",' . $hour_item['hour_count'] . '],';
}
$hour_data = substr($hour_data, 0, -1);
print $hour_data;
print ']);
var options = {
示例6:
$limit_next = $limit_end + $absolute_difference;
$limit_previous_1 = $limit_start - $absolute_difference;
$limit_previous_2 = $limit_end - $absolute_difference;
$page_url = $globalURL . '/latest';
?>
<?php
print '<div class="info column">';
print '<h1>Latest Activity</h1>';
print '</div>';
print '<div class="table column">';
print '<p>The table below shows the detailed information of all recent flights.</p>';
if (isset($_GET['sort'])) {
$spotter_array = Spotter::getLatestSpotterData($limit_start . "," . $absolute_difference, $_GET['sort']);
} else {
$spotter_array = Spotter::getLatestSpotterData($limit_start . "," . $absolute_difference);
}
if (!empty($spotter_array)) {
include 'table-output.php';
print '<div class="pagination">';
if ($limit_previous_1 >= 0) {
print '<a href="' . $page_url . '/' . $limit_previous_1 . ',' . $limit_previous_2 . '/' . $_GET['sort'] . '">«Previous Page</a>';
}
if ($spotter_array[0]['query_number_rows'] == $absolute_difference) {
print '<a href="' . $page_url . '/' . $limit_end . ',' . $limit_next . '/' . $_GET['sort'] . '">Next Page»</a>';
}
print '</div>';
print '</div>';
}
?>
示例7: header
<?php
require 'require/class.Connection.php';
require 'require/class.Spotter.php';
if (!isset($_GET['aircraft_manufacturer'])) {
header('Location: ' . $globalURL . '/manufacturer');
die;
}
$Spotter = new Spotter();
$manufacturer = ucwords(str_replace("-", " ", $_GET['aircraft_manufacturer']));
$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $_GET['sort']);
if (!empty($spotter_array)) {
$title = 'Most Common Time of Day from ' . $manufacturer;
require 'header.php';
print '<div class="select-item">';
print '<form action="' . $globalURL . '/manufacturer" method="post">';
print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
print '<option></option>';
$all_manufacturers = $Spotter->getAllManufacturers();
foreach ($all_manufacturers as $all_manufacturer) {
if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) {
print '<option value="' . strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])) . '" selected="selected">' . $all_manufacturer['aircraft_manufacturer'] . '</option>';
} else {
print '<option value="' . strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])) . '">' . $all_manufacturer['aircraft_manufacturer'] . '</option>';
}
}
print '</select>';
print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
print '</form>';
print '</div>';
print '<div class="info column">';
示例8: ucwords
$limit_previous_2 = $limit_end - $absolute_difference;
$manufacturer = ucwords(str_replace("-", " ", $_GET['aircraft_manufacturer']));
$page_url = $globalURL . '/manufacturer/' . $_GET['aircraft_manufacturer'];
if (isset($_GET['sort'])) {
$spotter_array = Spotter::getSpotterDataByManufacturer($manufacturer, $limit_start . "," . $absolute_difference, $_GET['sort']);
} else {
$spotter_array = Spotter::getSpotterDataByManufacturer($manufacturer, $limit_start . "," . $absolute_difference, '');
}
if (!empty($spotter_array)) {
$title = 'Detailed View for ' . $manufacturer;
require 'header.php';
print '<div class="select-item">';
print '<form action="' . $globalURL . '/manufacturer" method="post">';
print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
print '<option></option>';
$all_manufacturers = Spotter::getAllManufacturers();
foreach ($all_manufacturers as $all_manufacturer) {
if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) {
print '<option value="' . strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])) . '" selected="selected">' . $all_manufacturer['aircraft_manufacturer'] . '</option>';
} else {
print '<option value="' . strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])) . '">' . $all_manufacturer['aircraft_manufacturer'] . '</option>';
}
}
print '</select>';
print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
print '</form>';
print '</div>';
print '<div class="info column">';
print '<h1>' . $manufacturer . '</h1>';
print '</div>';
print '<div class="table column">';
示例9: foreach
}
$spotter_array = Spotter::getSpotterDataByIdent($_GET['ident'], "0,1", $sort);
if (!empty($spotter_array)) {
$title = 'Most Common Aircraft Manufacturer of ' . $spotter_array[0]['ident'];
require 'header.php';
print '<div class="info column">';
print '<h1>' . $spotter_array[0]['ident'] . '</h1>';
print '<div><span class="label">Ident</span>' . $spotter_array[0]['ident'] . '</div>';
print '<div><span class="label">Airline</span><a href="' . $globalURL . '/airline/' . $spotter_array[0]['airline_icao'] . '">' . $spotter_array[0]['airline_name'] . '</a></div>';
print '<div><span class="label">Flight History</span><a href="http://flightaware.com/live/flight/' . $spotter_array[0]['ident'] . '" target="_blank">View the Flight History of this callsign</a></div>';
print '</div>';
include 'ident-sub-menu.php';
print '<div class="column">';
print '<h2>Most Common Aircraft Manufacturer</h2>';
print '<p>The statistic below shows the most common Aircraft Manufacturer of flights using the ident/callsign <strong>' . $spotter_array[0]['ident'] . '</strong>.</p>';
$manufacturers_array = Spotter::countAllAircraftManufacturerByIdent($_GET['ident']);
if (!empty($manufacturers_array)) {
print '<div class="table-responsive">';
print '<table class="common-manufacturer table-striped">';
print '<thead>';
print '<th></th>';
print '<th>Aircraft Manufacturer</th>';
print '<th># of Times</th>';
print '<th></th>';
print '</thead>';
print '<tbody>';
$i = 1;
foreach ($manufacturers_array as $manufacturer_item) {
print '<tr>';
print '<td><strong>' . $i . '</strong></td>';
print '<td>';
示例10: getSpotteArchiveData
/**
* Gets all the archive spotter information
*
* @return Array the spotter information
*
*/
public function getSpotteArchiveData($ident, $flightaware_id, $date)
{
$Spotter = new Spotter();
$ident = filter_var($ident, FILTER_SANITIZE_STRING);
$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
$spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date . '%'));
return $spotter_array;
}
示例11: dirname
<?php
/**
* This script is used to import data from FlightAware. Not tested anymore, deprecated because no account available.
*/
require dirname(__FILE__) . '/../require/class.Connection.php';
require dirname(__FILE__) . '/../require/class.Spotter.php';
require dirname(__FILE__) . '/../require/class.SpotterLive.php';
require dirname(__FILE__) . '/../require/settings.php';
//checks to see if FlightAware import is set
if ($globalFlightAware == TRUE) {
$SpotterLive = new SpotterLive();
$Spotter = new Spotter();
//deletes the spotter LIVE data
$SpotterLive->deleteLiveSpotterData();
//imports the new data from FlightAware
$Spotter->importFromFlightAware();
}
示例12: Spotter
<?php
require 'require/class.Connection.php';
require 'require/class.Spotter.php';
require 'require/class.METAR.php';
$Spotter = new Spotter();
if (isset($_GET['airport_icao'])) {
$icao = filter_input(INPUT_GET, 'airport_icao', FILTER_SANITIZE_STRING);
$spotter_array = $Spotter->getAllAirportInfo($icao);
if (isset($globalMETAR) && $globalMETAR) {
$METAR = new METAR();
$metar_info = $METAR->getMETAR($icao);
//print_r($metar_info);
if (isset($metar_info[0]['metar'])) {
$metar_parse = $METAR->parse($metar_info[0]['metar']);
}
//print_r($metar_parse);
}
}
?>
<div class="alldetails">
<button type="button" class="close">×</button>
<?php
$spotter_item = $spotter_array[0];
//print_r($spotter_item);
date_default_timezone_set('UTC');
if (isset($spotter_item['image_thumb']) && $spotter_item['image_thumb'] != "") {
$image = $spotter_item['image_thumb'];
}
print '<div class="top">';
if (isset($image)) {
示例13: time
<link type="text/css" rel="stylesheet" href="<?php
print $globalURL;
?>
/css/style-tv.css?<?php
print time();
?>
" />
</head>
<body>
<?php
if (isset($_GET['q'])) {
$spotter_array = Spotter::searchSpotterData($_GET['q'], "", "", "", "", "", "", "", "", "", "", "", "", "", "0,10", "", "");
} else {
$spotter_array = Spotter::getLatestSpotterData("0,10", "");
}
print '<div class="table-responsive">';
print '<table id="table-tv">';
print '<tbody>';
foreach ($spotter_array as $spotter_item) {
if (isset($globalTimezone)) {
date_default_timezone_set($globalTimezone);
} else {
date_default_timezone_set('UTC');
}
print '<tr>';
if (isset($_GET['image']) && $_GET['image'] == "true") {
if ($spotter_item['image'] != "") {
print '<td class="aircraft_image">';
print '<img src="' . $spotter_item['image'] . '" alt="Click to see more information about this flight" title="Click to see more information about this flight" />';
示例14: Spotter
<?php
require 'require/class.Connection.php';
require 'require/class.Spotter.php';
$Spotter = new Spotter();
$title = "Statistic - Most Busiest Month of Last Year";
require 'header.php';
include 'statistics-sub-menu.php';
?>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<div class="info">
<h1>Most Busiest Day Last Month</h1>
</div>
<p>Below is a chart that plots the busiest day during the <strong>last month</strong>.</p>
<?php
$date_array = $Spotter->countAllDatesLastMonth();
print '<div id="chart" class="chart" width="100%"></div>
<script>
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
["Month", "# of Flights"], ';
$date_data = '';
foreach ($date_array as $date_item) {
$date_data .= '[ "' . date("F j, Y", strtotime($date_item['date_name'])) . '",' . $date_item['date_count'] . '],';
}
$date_data = substr($date_data, 0, -1);
print $date_data;
示例15: ucwords
$limit_previous_2 = $limit_end - $absolute_difference;
$country = ucwords(str_replace("-", " ", $_GET['country']));
$page_url = $globalURL . '/country/' . $_GET['country'];
if (isset($_GET['sort'])) {
$spotter_array = Spotter::getSpotterDataByCountry($country, $limit_start . "," . $absolute_difference, $_GET['sort']);
} else {
$spotter_array = Spotter::getSpotterDataByCountry($country, $limit_start . "," . $absolute_difference, '');
}
if (!empty($spotter_array)) {
$title = 'Detailed View for Airports & Airlines from ' . $country;
require 'header.php';
print '<div class="select-item">';
print '<form action="' . $globalURL . '/country" method="post">';
print '<select name="country" class="selectpicker" data-live-search="true">';
print '<option></option>';
$all_countries = Spotter::getAllCountries();
foreach ($all_countries as $all_country) {
if ($country == $all_country['country']) {
print '<option value="' . strtolower(str_replace(" ", "-", $all_country['country'])) . '" selected="selected">' . $all_country['country'] . '</option>';
} else {
print '<option value="' . strtolower(str_replace(" ", "-", $all_country['country'])) . '">' . $all_country['country'] . '</option>';
}
}
print '</select>';
print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
print '</form>';
print '</div>';
if ($_GET['country'] != "NA") {
print '<div class="info column">';
print '<h1>Airports & Airlines from ' . $country . '</h1>';
print '</div>';