本文整理汇总了PHP中OperationsData::getAirportInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP OperationsData::getAirportInfo方法的具体用法?PHP OperationsData::getAirportInfo怎么用?PHP OperationsData::getAirportInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationsData
的用法示例。
在下文中一共展示了OperationsData::getAirportInfo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jumpseat
public function jumpseat()
{
$icao = DB::escape($_GET['depicao']);
$this->set('airport', OperationsData::getAirportInfo($icao));
$this->set('cost', DB::escape($_GET['cost']));
$this->show('RSL/realschedulelite_jumpseatconfirm.tpl');
}
示例2: jumpseat
public function jumpseat()
{
if (!Auth::LoggedIn()) {
$this->set('message', 'You must be logged in to access this feature!');
$this->render('core_error.tpl');
return;
} else {
$icao = DB::escape($this->post->depicao);
$this->set('airport', OperationsData::getAirportInfo($icao));
$this->set('cost', DB::escape($this->post->cost));
$this->show('Fltbook/jumpseatticket');
}
}
示例3: viewmap
public function viewmap()
{
if ($this->get->type === 'pirep') {
$data = PIREPData::getReportDetails($this->get->id);
} elseif ($this->get->type === 'schedule') {
$data = SchedulesData::getScheduleDetailed($this->get->id);
} elseif ($this->get->type === 'preview') {
$data = new stdClass();
$depicao = OperationsData::getAirportInfo($this->get->depicao);
$arricao = OperationsData::getAirportInfo($this->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;
$data->route = $this->get->route;
unset($depicao);
unset($arricao);
$data->route_details = NavData::parseRoute($data);
}
$this->set('mapdata', $data);
$this->render('route_map.tpl');
}
示例4: 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
//.........这里部分代码省略.........
示例5: stdClass
<textarea name="route" style="width: 600px; height: 100px;"><?php
echo $_GET['route'];
?>
</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;
?>
示例6: importairports
public function importairports()
{
if (!file_exists($_FILES['uploadedfile']['tmp_name'])) {
$this->render('airport_import_form.php');
return;
}
echo '<h3>Processing Import</h3>';
# Get the column headers
$allaircraft = OperationsData::getAllAirports(false);
$headers = array();
$dbcolumns = DB::get_cols();
foreach ($dbcolumns as $col) {
$headers[] = $col->name;
}
$temp_name = $_FILES['uploadedfile']['tmp_name'];
$new_name = CACHE_PATH . '/' . $_FILES['uploadedfile']['name'];
if (!move_uploaded_file($temp_name, $new_name)) {
$this->render('core_error.php');
$this->set('message', 'Shit the bed?');
return false;
}
$fp = fopen($new_name, 'r');
if (isset($_POST['header'])) {
$skip = true;
}
$added = 0;
$updated = 0;
$total = 0;
echo '<div style="overflow: auto; height: 400px;
border: 1px solid #666; margin-bottom: 20px;
padding: 5px; padding-top: 0px; padding-bottom: 20px;">';
if (isset($_POST['erase_airports'])) {
OperationsData::deleteAllAirports();
echo "Deleting All Airports<br />";
}
while ($fields = fgetcsv($fp, 1000, ',')) {
// Skip the first line
if ($skip == true) {
$skip = false;
continue;
}
//Check for empty lines, continue
if (empty($fields)) {
continue;
}
//Create Varibles...
$icao = $fields[0];
$name = $fields[1];
$country = $fields[2];
$lat = $fields[3];
$lng = $fields[4];
$hub = $fields[5];
$fuelprice = $fields[6];
$chartlink = $fields[7];
//Since we need the values filled in, if not, then continue
if (empty($icao) || empty($lat) || empty($lng)) {
continue;
}
# Enabled or not
if ($hub == '1') {
$hub = true;
} else {
$hub = false;
}
//Build Array, seem can't use the array merge for some reason...
$data = array('icao' => $fields[0], 'name' => $fields[1], 'country' => $fields[2], 'lat' => $fields[3], 'lng' => $fields[4], 'hub' => $hub, 'fuelprice' => $fields[6], 'chartlink' => $fields[7]);
# Does this airport exist?
$aiport_info = OperationsData::getAirportInfo($icao);
if ($aiport_info) {
echo "Editing {$icao} - {$name}<br>";
OperationsData::editAirport($data);
$updated++;
} else {
echo "Adding {$icao} - {$name}<br>";
OperationsData::addAirport($data);
$added++;
}
$total++;
}
//You should always close a file before deleting otherwise it will spit the unlink error due to permissions
fclose($fp);
unlink($new_name);
echo "The import process is complete, added {$added} airports, updated {$updated}, for a total of {$total}<br />";
}
示例7: foreach
?>
" title="Available aircraft to search from your current location">
</td>
</tr>
<tr>
<td>Select Arrival Airfield:</td>
<td >
<select style="width: 30%" name="arricao">
<option value="">All</option>
<?php
$airs = FBSVData::arrivalairport($last_location->arricao);
if (!$airs) {
echo '<option>No Airports Available!</option>';
} else {
foreach ($airs as $air) {
$nam = OperationsData::getAirportInfo($air->arricao);
echo '<option value="' . $air->arricao . '">' . $air->arricao . ' - ' . $nam->name . '</option>';
}
}
?>
</select> <img src="<?php
echo fileurl('/lib/images/info.png');
?>
" title="Available airports to search from your current location">
</td>
<td align="center" >
<input type="hidden" name="action" value="findflight" />
<input type="submit" name="submit" value="Search Flight" />
</td>
</tr>
</table>
示例8: pushToTwitter
/**
* ActivityData::pushToTwitter()
*
* @param mixed $params
* @return void
*/
public static function pushToTwitter($params)
{
require_once CORE_LIB_PATH . '/twitteroauth/twitteroauth.php';
$params = array_merge(array('pilotid' => '', 'type' => '', 'refid' => '', 'message' => ''), $params);
$message = '';
# These defaults will be ignored
$lat = -120;
$long = -120;
if (!empty($params['pilotid'])) {
$pilot = PilotData::getPilotData($params['pilotid']);
$message .= PilotData::getPilotCode($pilot->code, $pilot->pilotid) . ' ' . $pilot->firstname . ' ' . $pilot->lastname . ' ';
}
$message .= $params['message'] . ' ';
# Show a new PIREP, also get the airport information
if ($params['type'] == ACTIVITY_NEW_PIREP) {
$message .= url('/pireps/view/' . $params['refid']);
$pirep = PIREPData::findPIREPS(array('pirepid' => $params['refid']), 1);
$pirep = $pirep[0];
$airport = OperationsData::getAirportInfo($pirep->arricao);
$lat = $airport->lat;
$long = $airport->lng;
} elseif ($params['type'] == ACTIVITY_NEW_PILOT) {
$message .= url('/profile/view/' . $params['pilotid']);
$airport = OperationsData::getAirportInfo($pilot->hub);
$lat = $airport->lat;
$long = $airport->lng;
}
$tweet = new TwitterOAuth(Config::get('TWITTER_CONSUMER_KEY'), Config::get('TWITTER_CONSUMER_SECRET'), Config::get('TWITTER_OAUTH_TOKEN'), Config::get('TWITTER_OAUTH_SECRET'));
$status = $tweet->post('statuses/update', array('status' => $message, 'lat' => $lat, 'long' => $long, 'trim_user' => true));
return $status;
}
示例9:
?>
<html>
<head>
</head>
<body>
<form method="get" action="">
Enter airport: <input type ="text" name="depicao" value="<?php
echo $_GET['depicao'];
?>
" />
<input type="submit" name="submit" value="View Distances" />
</form>
<p>To verify, use <a href="http://www.gpsvisualizer.com/calculators" target="_new">gps visualizer</a>. press control+f to find a certain airport.</p>
<?php
if (!isset($_GET['submit'])) {
exit;
}
$depicao = OperationsData::getAirportInfo($_GET['depicao']);
$all_airports = OperationsData::getAllAirports();
echo "Plotting distance between {$depicao->name} ({$depicao->icao}) and...<br><br>";
echo '<ul>';
foreach ($all_airports as $airport) {
Config::Set('UNITS', 'mi');
$mi_dist = OperationsData::getAirportDistance($depicao, $airport);
Config::Set('UNITS', 'km');
$km_dist = OperationsData::getAirportDistance($depicao, $airport);
Config::Set('UNITS', 'nm');
$nm_dist = OperationsData::getAirportDistance($depicao, $airport);
echo "<li>{$airport->name} ({$airport->icao})\n\t\t\t<ul>\n\t\t\t\t<li>{$depicao->lat}, {$depicao->lng} > {$airport->lat}, {$airport->lng}</li>\n\t\t\t\t<li>{$mi_dist} m</li>\n\t\t\t\t<li>{$km_dist} km</li>\n\t\t\t\t<li>{$nm_dist} nm</li>\n\t\t\t</ul>\n\t\t </li>";
}
echo '</ul>';
示例10: preg_match
# Get the pilot id:
$pilotid = PilotData::parsePilotID($_POST['UserName']);
# Get the flight ID
$flightinfo = SchedulesData::getProperFlightNum($_POST['FlightId']);
$code = $flightinfo['code'];
$flightnum = $flightinfo['flightnum'];
preg_match('/^([A-Za-z]*) - .*/', $_POST['DepartureIcaoName'], $aptinfo);
$depicao = $aptinfo[1];
# Make sure it exists
if (!OperationsData::getAirportInfo($depicao)) {
OperationsData::RetrieveAirportInfo($depicao);
}
preg_match('/^([A-Za-z]*) - .*/', $_POST['ArrivalIcaoName'], $aptinfo);
$arricao = $aptinfo[1];
# Make sure it exists
if (!OperationsData::getAirportInfo($arricao)) {
OperationsData::RetrieveAirportInfo($arricao);
}
# Find a flight using just the flight code
$sched = SchedulesData::findFlight($flightnum);
# Can't do it. They completely screwed this up
if (!$sched) {
echo "#Answer# Error - Invalid flight ID;";
return;
}
$code = $sched->code;
$flightnum = $sched->flightnum;
$aircraft = $sched->aircraft;
if ($depicao != $sched->depicao || $arricao != $sched->arricao) {
$comment = 'phpVMS Message: Arrival or Departure does not match schedule. ';
}