本文整理汇总了PHP中Spotter::parseDirection方法的典型用法代码示例。如果您正苦于以下问题:PHP Spotter::parseDirection方法的具体用法?PHP Spotter::parseDirection怎么用?PHP Spotter::parseDirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spotter
的用法示例。
在下文中一共展示了Spotter::parseDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
} elseif (isset($spotter_item['wikipedia_link']) && $spotter_item['wikipedia_link'] != '') {
print '<div><span>Links</span>';
print '<a href="' . $spotter_item['wikipedia_link'] . '">Wikipedia</a>';
print '</div>';
}
print '</div>';
if (isset($metar_parse)) {
print '<div class="waypoints">';
print '<div><span>METAR</span>';
print '<i>' . $metar_info[0]['metar'] . '</i><br />';
print '<b>' . $metar_info[0]['metar_date'] . '</b><br />';
// print_r($metar_parse);
if (isset($metar_parse['wind'])) {
print 'Wind : ';
if (isset($metar_parse['wind']['direction'])) {
$direction = $Spotter->parseDirection($metar_parse['wind']['direction']);
print $direction[0]['direction_fullname'];
print ' (' . $metar_parse['wind']['direction'] . '°) ';
}
if (isset($metar_parse['wind']['speed'])) {
print $metar_parse['wind']['speed'] . ' m/s';
}
print '<br/>';
}
if (isset($metar_parse['visibility'])) {
print 'Visibility : ' . $metar_parse['visibility'] . ' m' . "<br/>";
}
if (isset($metar_parse['weather'])) {
print 'Weather : ' . $metar_parse['weather'] . "<br/>";
}
if (isset($metar_parse['temperature'])) {
示例2: getDataFromDB
/**
* Executes the SQL statements to get the spotter information
*
* @param String $query the SQL query
* @param String $limit the limit query
* @return Array the spotter information
*
*/
public static function getDataFromDB($query, $params = array(), $limitQuery = '')
{
global $globalSquawkCountry, $globalIVAO;
if (!isset($globalIVAO)) {
$globalIVAO = FALSE;
}
date_default_timezone_set('UTC');
if (!is_string($query)) {
return false;
}
if ($limitQuery != "") {
if (!is_string($limitQuery)) {
return false;
}
}
$Connection = new Connection();
try {
$sth = Connection::$db->prepare($query . $limitQuery);
$sth->execute($params);
} catch (PDOException $e) {
printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query . $limitQuery);
exit;
}
// $num_rows = count($sth->fetchAll());
$num_rows = 0;
$spotter_array = array();
$temp_array = array();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$num_rows++;
$temp_array = array();
if (isset($row['spotter_live_id'])) {
$temp_array['spotter_id'] = $row['spotter_live_id'];
} elseif (isset($row['spotter_archive_id'])) {
$temp_array['spotter_id'] = $row['spotter_archive_id'];
} else {
$temp_array['spotter_id'] = $row['spotter_id'];
}
$temp_array['flightaware_id'] = $row['flightaware_id'];
if (isset($row['modes'])) {
$temp_array['modes'] = $row['modes'];
}
$temp_array['ident'] = $row['ident'];
if (isset($row['registration']) && $row['registration'] != '') {
$temp_array['registration'] = $row['registration'];
} elseif (isset($temp_array['modes'])) {
$temp_array['registration'] = Spotter::getAircraftRegistrationBymodeS($temp_array['modes']);
} else {
$temp_array['registration'] = '';
}
$temp_array['aircraft_type'] = $row['aircraft_icao'];
$temp_array['departure_airport'] = $row['departure_airport_icao'];
$temp_array['arrival_airport'] = $row['arrival_airport_icao'];
$temp_array['latitude'] = $row['latitude'];
$temp_array['longitude'] = $row['longitude'];
if (Connection::tableExists('countries')) {
$country_info = Spotter::getCountryFromLatitudeLongitude($temp_array['latitude'], $temp_array['longitude']);
if (is_array($country_info) && isset($country_info['name']) && isset($country_info['iso2'])) {
$temp_array['country'] = $country_info['name'];
$temp_array['country_iso2'] = $country_info['iso2'];
}
}
$temp_array['waypoints'] = $row['waypoints'];
if (isset($row['route_stop'])) {
$temp_array['route_stop'] = $row['route_stop'];
if ($row['route_stop'] != '') {
$allroute = explode(' ', $row['route_stop']);
foreach ($allroute as $route) {
$route_airport_array = Spotter::getAllAirportInfo($route);
if (isset($route_airport_array[0]['name'])) {
$route_stop_details['airport_name'] = $route_airport_array[0]['name'];
$route_stop_details['airport_city'] = $route_airport_array[0]['city'];
$route_stop_details['airport_country'] = $route_airport_array[0]['country'];
$route_stop_details['airport_icao'] = $route_airport_array[0]['icao'];
$temp_array['route_stop_details'][] = $route_stop_details;
}
}
}
}
$temp_array['altitude'] = $row['altitude'];
$temp_array['heading'] = $row['heading'];
$heading_direction = Spotter::parseDirection($row['heading']);
if (isset($heading_direction[0]['direction_fullname'])) {
$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
}
$temp_array['ground_speed'] = $row['ground_speed'];
$temp_array['image'] = "";
$temp_array['image_thumbnail'] = "";
$temp_array['image_source'] = "";
$temp_array['image_copyright'] = "";
if (isset($row['highlight'])) {
$temp_array['highlight'] = $row['highlight'];
} else {
//.........这里部分代码省略.........