本文整理汇总了PHP中Spotter::addSpotterData方法的典型用法代码示例。如果您正苦于以下问题:PHP Spotter::addSpotterData方法的具体用法?PHP Spotter::addSpotterData怎么用?PHP Spotter::addSpotterData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spotter
的用法示例。
在下文中一共展示了Spotter::addSpotterData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importFromFlightAware
public function importFromFlightAware()
{
global $globalFlightAwareUsername, $globalFlightAwarePassword, $globalLatitudeMax, $globalLatitudeMin, $globalLongitudeMax, $globalLongitudeMin, $globalAirportIgnore;
$Spotter = new Spotter();
$SPotterLive = new SpotterLive();
$options = array('trace' => true, 'exceptions' => 0, 'login' => $globalFlightAwareUsername, 'password' => $globalFlightAwarePassword);
$client = new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);
$params = array('query' => '{range lat ' . $globalLatitudeMin . ' ' . $globalLatitudeMax . '} {range lon ' . $globalLongitudeMax . ' ' . $globalLongitudeMin . '} {true inAir}', 'howMany' => '15', 'offset' => '0');
$result = $client->SearchBirdseyeInFlight($params);
$dataFound = false;
$ignoreImport = false;
if (isset($result->SearchBirdseyeInFlightResult)) {
if (is_array($result->SearchBirdseyeInFlightResult->aircraft)) {
foreach ($result->SearchBirdseyeInFlightResult->aircraft as $aircraft) {
if (!strstr($aircraft->origin, 'L ') && !strstr($aircraft->destination, 'L ')) {
foreach ($globalAirportIgnore as $airportIgnore) {
if ($aircraft->origin == $airportIgnore || $aircraft->destination == $airportIgnore) {
$ignoreImport = true;
}
}
if ($ignoreImport == false) {
$flightaware_id = $aircraft->faFlightID;
$ident = $aircraft->ident;
$aircraft_type = $aircraft->type;
$departure_airport = $aircraft->origin;
$arrival_airport = $aircraft->destination;
$latitude = $aircraft->latitude;
$longitude = $aircraft->longitude;
$waypoints = $aircraft->waypoints;
$altitude = $aircraft->altitude;
$heading = $aircraft->heading;
$groundspeed = $aircraft->groundspeed;
$dataFound = true;
//gets the callsign from the last hour
$last_hour_ident = $this->getIdentFromLastHour($ident);
//change the departure/arrival airport to NA if its not available
if ($departure_airport == "" || $departure_airport == "---" || $departure_airport == "ZZZ" || $departure_airport == "ZZZZ") {
$departure_airport = "NA";
}
if ($arrival_airport == "" || $arrival_airport == "---" || $arrival_airport == "ZZZ" || $arrival_airport == "ZZZZ") {
$arrival_airport = "NA";
}
//if there was no aircraft with the same callsign within the last hour and go post it into the archive
if ($last_hour_ident == "") {
//adds the spotter data for the archive
$Spotter->addSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
}
//adds the spotter LIVE data
$SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
}
}
$ignoreImport = false;
}
} else {
if (!strstr($result->SearchBirdseyeInFlightResult->aircraft->origin, 'L ') && !strstr($result->SearchBirdseyeInFlightResult->aircraft->destination, 'L ')) {
foreach ($globalAirportIgnore as $airportIgnore) {
foreach ($globalAirportIgnore as $airportIgnore) {
if ($aircraft->origin == $airportIgnore || $aircraft->destination == $airportIgnore) {
$ignoreImport = true;
}
}
if ($ignoreImport == false) {
$flightaware_id = $result->SearchBirdseyeInFlightResult->aircraft->faFlightID;
$ident = $result->SearchBirdseyeInFlightResult->aircraft->ident;
$aircraft_type = $result->SearchBirdseyeInFlightResult->aircraft->type;
$departure_airport = $result->SearchBirdseyeInFlightResult->aircraft->origin;
$arrival_airport = $result->SearchBirdseyeInFlightResult->aircraft->destination;
$latitude = $result->SearchBirdseyeInFlightResult->aircraft->latitude;
$longitude = $result->SearchBirdseyeInFlightResult->aircraft->longitude;
$waypoints = $result->SearchBirdseyeInFlightResult->aircraft->waypoints;
$altitude = $result->SearchBirdseyeInFlightResult->aircraft->altitude;
$heading = $result->SearchBirdseyeInFlightResult->aircraft->heading;
$groundspeed = $result->SearchBirdseyeInFlightResult->aircraft->groundspeed;
$dataFound = true;
//gets the callsign from the last hour
$last_hour_ident = $this->getIdentFromLastHour($ident);
//change the departure/arrival airport to NA if its not available
if ($departure_airport == "" || $departure_airport == "---" || $departure_airport == "ZZZ" || $departure_airport == "ZZZZ") {
$departure_airport = "NA";
}
if ($arrival_airport == "" || $arrival_airport == "---" || $arrival_airport == "ZZZ" || $arrival_airport == "ZZZZ") {
$arrival_airport = "NA";
}
//if there was no aircraft with the same callsign within the last hour and go post it into the archive
if ($last_hour_ident == "") {
//adds the spotter data for the archive
$Spotter->addSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
}
//adds the spotter LIVE data
$SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
}
$ignoreImport = false;
}
}
}
}
}
示例2: add
//.........这里部分代码省略.........
if (!isset($globalDistanceIgnore['latitude']) || isset($globalDistanceIgnore['latitude']) && Common::distance(self::$all_flights[$id]['latitude'], self::$all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance']) {
self::$all_flights[$id]['lastupdate'] = time();
//$last_hour_ident = Spotter::getIdentFromLastHour(self::$all_flights[$id]['ident']);
$recent_ident = SpotterLive::checkIdentRecent(self::$all_flights[$id]['ident']);
//if there was no aircraft with the same callsign within the last hour and go post it into the archive
if ($recent_ident == "") {
if ($globalDebug) {
echo "\\o/ Add " . self::$all_flights[$id]['ident'] . " in archive DB : ";
}
if (self::$all_flights[$id]['departure_airport'] == "") {
self::$all_flights[$id]['departure_airport'] = "NA";
}
if (self::$all_flights[$id]['arrival_airport'] == "") {
self::$all_flights[$id]['arrival_airport'] = "NA";
}
//adds the spotter data for the archive
$ignoreImport = false;
foreach ($globalAirportIgnore as $airportIgnore) {
if (self::$all_flights[$id]['departure_airport'] != $airportIgnore && self::$all_flights[$id]['arrival_airport'] != $airportIgnore) {
$ignoreImport = true;
}
}
if (!$ignoreImport) {
$highlight = '';
if (self::$all_flights[$id]['squawk'] == '7500') {
$highlight = 'Squawk 7500 : Hijack';
}
if (self::$all_flights[$id]['squawk'] == '7600') {
$highlight = 'Squawk 7600 : Lost Comm (radio failure)';
}
if (self::$all_flights[$id]['squawk'] == '7700') {
$highlight = 'Squawk 7700 : Emergency';
}
$result = Spotter::addSpotterData(self::$all_flights[$id]['id'], self::$all_flights[$id]['ident'], self::$all_flights[$id]['aircraft_icao'], self::$all_flights[$id]['departure_airport'], self::$all_flights[$id]['arrival_airport'], self::$all_flights[$id]['latitude'], self::$all_flights[$id]['longitude'], self::$all_flights[$id]['waypoints'], self::$all_flights[$id]['altitude'], self::$all_flights[$id]['heading'], self::$all_flights[$id]['speed'], '', self::$all_flights[$id]['departure_airport_time'], self::$all_flights[$id]['arrival_airport_time'], self::$all_flights[$id]['squawk'], self::$all_flights[$id]['route_stop'], $highlight, self::$all_flights[$id]['hex'], self::$all_flights[$id]['registration'], self::$all_flights[$id]['pilot_id'], self::$all_flights[$id]['pilot_name']);
}
$ignoreImport = false;
if ($globalDebug) {
echo $result . "\n";
}
/*
if (isset($globalArchive) && $globalArchive) {
$archives_ident = SpotterLive::getAllLiveSpotterDataByIdent(self::$all_flights[$id]['ident']);
foreach ($archives_ident as $archive) {
SpotterArchive::addSpotterArchiveData($archive['flightaware_id'], $archive['ident'], $archive['registration'],$archive['airline_name'],$archive['airline_icao'],$archive['airline_country'],$archive['airline_type'],$archive['aircraft_icao'],$archive['aircraft_shadow'],$archive['aircraft_name'],$archive['aircraft_manufacturer'], $archive['departure_airport_icao'],$archive['departure_airport_name'],$archive['departure_airport_city'],$archive['departure_airport_country'],$archive['departure_airport_time'],
$archive['arrival_airport_icao'],$archive['arrival_airport_name'],$archive['arrival_airport_city'],$archive['arrival_airport_country'],$archive['arrival_airport_time'],
$archive['route_stop'],$archive['date'],$archive['latitude'], $archive['longitude'], $archive['waypoints'], $archive['altitude'], $archive['heading'], $archive['ground_speed'],
$archive['squawk'],$archive['ModeS']);
}
}
*/
//SpotterLive::deleteLiveSpotterDataByIdent(self::$all_flights[$id]['ident']);
SpotterLive::deleteLiveSpotterData();
}
}
//adds the spotter LIVE data
//SpotterLive::addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
//echo "\nAdd in Live !! \n";
//echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n";
if ($globalDebug) {
echo 'DATA : hex : ' . self::$all_flights[$id]['hex'] . ' - ident : ' . self::$all_flights[$id]['ident'] . ' - ICAO : ' . self::$all_flights[$id]['aircraft_icao'] . ' - Departure Airport : ' . self::$all_flights[$id]['departure_airport'] . ' - Arrival Airport : ' . self::$all_flights[$id]['arrival_airport'] . ' - Latitude : ' . self::$all_flights[$id]['latitude'] . ' - Longitude : ' . self::$all_flights[$id]['longitude'] . ' - waypoints : ' . self::$all_flights[$id]['waypoints'] . ' - Altitude : ' . self::$all_flights[$id]['altitude'] . ' - Heading : ' . self::$all_flights[$id]['heading'] . ' - Speed : ' . self::$all_flights[$id]['speed'] . ' - Departure Airport Time : ' . self::$all_flights[$id]['departure_airport_time'] . ' - Arrival Airport time : ' . self::$all_flights[$id]['arrival_airport_time'] . "\n";
}
$ignoreImport = false;
if (self::$all_flights[$id]['departure_airport'] == "") {
self::$all_flights[$id]['departure_airport'] = "NA";
}
if (self::$all_flights[$id]['arrival_airport'] == "") {
示例3: add
//.........这里部分代码省略.........
$recent_ident = '';
$this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0));
}
//if there was no aircraft with the same callsign within the last hour and go post it into the archive
if ($recent_ident == "") {
if ($globalDebug) {
echo "\\o/ Add " . $this->all_flights[$id]['ident'] . " in archive DB : ";
}
if ($this->all_flights[$id]['departure_airport'] == "") {
$this->all_flights[$id]['departure_airport'] = "NA";
}
if ($this->all_flights[$id]['arrival_airport'] == "") {
$this->all_flights[$id]['arrival_airport'] = "NA";
}
//adds the spotter data for the archive
$ignoreImport = false;
foreach ($globalAirportIgnore as $airportIgnore) {
if ($this->all_flights[$id]['departure_airport'] != $airportIgnore && $this->all_flights[$id]['arrival_airport'] != $airportIgnore) {
$ignoreImport = true;
}
}
if (!$ignoreImport) {
$highlight = '';
if ($this->all_flights[$id]['squawk'] == '7500') {
$highlight = 'Squawk 7500 : Hijack';
}
if ($this->all_flights[$id]['squawk'] == '7600') {
$highlight = 'Squawk 7600 : Lost Comm (radio failure)';
}
if ($this->all_flights[$id]['squawk'] == '7700') {
$highlight = 'Squawk 7700 : Emergency';
}
$Spotter = new Spotter();
$result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], '', $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name']);
$Spotter->db = null;
}
$ignoreImport = false;
$this->all_flights[$id]['addedSpotter'] = 1;
//print_r($this->all_flights[$id]);
if ($globalDebug) {
echo $result . "\n";
}
/*
if (isset($globalArchive) && $globalArchive) {
$archives_ident = SpotterLive->getAllLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
foreach ($archives_ident as $archive) {
SpotterArchive->addSpotterArchiveData($archive['flightaware_id'], $archive['ident'], $archive['registration'],$archive['airline_name'],$archive['airline_icao'],$archive['airline_country'],$archive['airline_type'],$archive['aircraft_icao'],$archive['aircraft_shadow'],$archive['aircraft_name'],$archive['aircraft_manufacturer'], $archive['departure_airport_icao'],$archive['departure_airport_name'],$archive['departure_airport_city'],$archive['departure_airport_country'],$archive['departure_airport_time'],
$archive['arrival_airport_icao'],$archive['arrival_airport_name'],$archive['arrival_airport_city'],$archive['arrival_airport_country'],$archive['arrival_airport_time'],
$archive['route_stop'],$archive['date'],$archive['latitude'], $archive['longitude'], $archive['waypoints'], $archive['altitude'], $archive['heading'], $archive['ground_speed'],
$archive['squawk'],$archive['ModeS']);
}
}
*/
//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
if ($this->last_delete == '' || time() - $this->last_delete > 1800) {
if ($globalDebug) {
echo "---- Deleting Live Spotter data older than 9 hours...";
}
//SpotterLive->deleteLiveSpotterDataNotUpdated();
$SpotterLive = new SpotterLive();
$SpotterLive->deleteLiveSpotterData();
$SpotterLive->db = null;
if ($globalDebug) {
echo " Done\n";
}
$this->last_delete = time();