當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OperationsData::getAllAirports方法代碼示例

本文整理匯總了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);
 }
開發者ID:Galihom,項目名稱:phpVMS,代碼行數:16,代碼來源:Import.php

示例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 />";
    }
開發者ID:phpmods,項目名稱:phpvms_5.5.x,代碼行數:84,代碼來源:Import.php

示例3: index

 public function index()
 {
     $this->set('airports', OperationsData::getAllAirports());
     $this->set('aircrafts', OperationsData::getAllAircraft('true'));
     $this->show('realschedulelite/realschedulelite_index.tpl');
 }
開發者ID:phpmods,項目名稱:FlightBookingSystem_V1.0,代碼行數:6,代碼來源:RealScheduleLite.php

示例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');
 }
開發者ID:Galihom,項目名稱:phpVMS,代碼行數:48,代碼來源:PIREPS.php

示例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>';
開發者ID:Galihom,項目名稱:phpVMS,代碼行數:31,代碼來源:distancecheck.php


注:本文中的OperationsData::getAllAirports方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。