public function get_airport()
 {
     $icao = $_GET['icao'];
     $this->set('aircrafts', OperationsData::getAllAircraft('true'));
     $this->set('name', OperationsData::getAirportInfo($icao));
     $this->show('realschedulelite/realschedulelite_airport_details.tpl');
 }
Esempio n. 2
0
 public function index()
 {
     if (!Auth::LoggedIn()) {
         $this->set('message', 'You must be logged in to access this feature!');
         $this->render('core_error.tpl');
         return;
     } else {
         if (isset($this->post->action)) {
             if ($this->post->action == 'search') {
                 $this->search();
             }
         } else {
             $this->set('airports', OperationsData::GetAllAirports());
             $this->set('airlines', OperationsData::getAllAirlines());
             $this->set('aircrafts', OperationsData::getAllAircraft('true'));
             $this->set('countries', FltbookData::findCountries());
             $this->show('Fltbook/search_form');
         }
     }
 }
Esempio n. 3
0
 public static function getAllAircraft()
 {
     $results = OperationsData::getAllAircraft(true);
     $xml = new SimpleXMLElement("<aircraftdata />");
     $info_xml = $xml->addChild('info');
     foreach ($results as $row) {
         $info_xml->addChild('aircraftICAO', $row->icao);
         $info_xml->addChild('aircraftReg', $row->registration);
     }
     # For debug
     #$this->log("Sending: \n".print_r($xml_string, true), 'kacars');
     header('Content-type: text/xml');
     echo $xml->asXML();
 }
Esempio n. 4
0
    public function importaircraft()
    {
        if (!file_exists($_FILES['uploadedfile']['tmp_name'])) {
            $this->render('import_aircraftform.tpl');
            return;
        }
        echo '<h3>Processing Import</h3>';
        # Get the column headers
        $allaircraft = OperationsData::getAllAircraft(false);
        $headers = array();
        $dbcolumns = DB::get_cols();
        foreach ($dbcolumns as $col) {
            if ($col->name == 'id' || $col->name == 'minrank' || $col->name == 'ranklevel') {
                continue;
            }
            $headers[] = $col->name;
        }
        # Open the import file
        # Fix for bug VMS-325
        $temp_name = $_FILES['uploadedfile']['tmp_name'];
        $new_name = CACHE_PATH . $_FILES['uploadedfile']['name'];
        move_uploaded_file($temp_name, $new_name);
        $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;">';
        while ($fields = fgetcsv($fp, 1000, ',')) {
            // Skip the first line
            if ($skip == true) {
                $skip = false;
                continue;
            }
            # Map the read in values to the columns
            $aircraft = array();
            $aircraft = @array_combine($headers, $fields);
            if (empty($aircraft)) {
                continue;
            }
            # Enabled or not
            if ($aircraft['enabled'] == '1') {
                $aircraft['enabled'] = true;
            } else {
                $aircraft['enabled'] = false;
            }
            # Get the rank ID
            $rank = RanksData::getRankByName($aircraft['rank']);
            $aircraft['minrank'] = $rank->rankid;
            unset($aircraft['rank']);
            # Does this aircraft exist?
            $ac_info = OperationsData::getAircraftByReg($aircraft['registration']);
            if ($ac_info) {
                echo "Editing {$aircraft['name']} - {$aircraft['registration']}<br>";
                $aircraft['id'] = $ac_info->id;
                OperationsData::editAircraft($aircraft);
                $updated++;
            } else {
                echo "Adding {$aircraft['name']} - {$aircraft['registration']}<br>";
                OperationsData::addAircraft($aircraft);
                $added++;
            }
            $total++;
        }
        unlink($new_name);
        echo "The import process is complete, added {$added} aircraft, updated {$updated}, for a total of {$total}<br />";
    }
Esempio n. 5
0
 /**
  * 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');
 }