本文整理汇总了PHP中OperationsData::getAllAirports方法的典型用法代码示例。如果您正苦于以下问题:PHP OperationsData::getAllAirports方法的具体用法?PHP OperationsData::getAllAirports怎么用?PHP OperationsData::getAllAirports使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationsData
的用法示例。
在下文中一共展示了OperationsData::getAllAirports方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportairports
/**
*
*/
public function exportairports()
{
$allairports = OperationsData::getAllAirports();
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="airports.csv"');
$fp = fopen('php://output', 'w');
# Then write out all of the airports
foreach ($allairports as $ap) {
unset($ap->id);
fputcsv($fp, (array) $ap, ',');
}
fclose($fp);
}
示例2: 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 />";
}
示例3: index
public function index()
{
$this->set('airports', OperationsData::getAllAirports());
$this->set('aircrafts', OperationsData::getAllAircraft('true'));
$this->show('realschedulelite/realschedulelite_index.tpl');
}
示例4: FilePIREPForm
/**
* PIREPS::FilePIREPForm()
*
* @param string $bidid
* @return
*/
protected function FilePIREPForm($bidid = '')
{
if (!Auth::LoggedIn()) {
$this->set('message', 'You must be logged in to access this feature!');
$this->render('core_error.tpl');
return;
}
$this->set('pilot', Auth::$pilot->firstname . ' ' . Auth::$pilot->lastname);
$this->set('pilotcode', PilotData::GetPilotCode(Auth::$pilot->code, Auth::$pilot->pilotid));
$this->set('pirepfields', PIREPData::GetAllFields());
if ($bidid != '') {
$this->set('bid', SchedulesData::GetBid($bidid));
// get the bid info
}
$airport_list = OperationsData::getAllAirports();
$this->set('allairports', $airport_list);
#deprecated
$this->set('airport_list', $airport_list);
$airline_list = OperationsData::getAllAirlines(true);
$this->set('allairlines', $airline_list);
#deprecated
$this->set('airline_list', $airline_list);
$aircraft_list = OperationsData::getAllAircraft(true);
/* Skip any aircraft which have aircraft that the pilot
is not rated to fly (according to RANK)
This means the aircraft rank level is higher than
what the pilot's ranklevel, so just do "continue"
and move onto the next route in the list
*/
if (Config::Get('RESTRICT_AIRCRAFT_RANKS') === true) {
foreach ($aircraft_list as $index => $aircraft) {
if ($aircraft->ranklevel > Auth::$pilot->ranklevel) {
unset($aircraft_list[$index]);
continue;
}
}
}
$this->set('allaircraft', $aircraft_list);
#deprecated
$this->set('aircraft_list', $aircraft_list);
$this->render('pirep_new.tpl');
}
示例5:
?>
<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>';