Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //simpilotgroup addon module for phpVMS virtual airline system
- //
- //simpilotgroup addon modules are licenced under the following license:
- //Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
- //To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
- //
- //@author David Clark (simpilot)
- //@copyright Copyright (c) 2009-2010, David Clark
- //@license http://creativecommons.org/licenses/by-nc-sa/3.0/
- class afrsearch extends CodonModule
- {
- public $title = 'Search';
- public function index() {
- if(isset($this->post->action))
- {
- if($this->post->action == 'findflight') {
- $this->findflight();
- }
- }
- else
- {
- $this->set('airports', OperationsData::GetAllAirports());
- $this->set('airlines', OperationsData::getAllAirlines());
- $this->set('aircrafts', afrsearch::findaircrafttypes());
- $this->set('countries', afrsearch::findcountries());
- $this->show('afr_search.tpl');
- }
- }
- public function findflight()
- {
- $arricao = DB::escape($this->post->arricao);
- $depicao = DB::escape($this->post->depicao);
- $airline = DB::escape($this->post->airline);
- $aircraft = DB::escape($this->post->aircraft);
- if(!$airline)
- {
- $airline = '%';
- }
- if(!$arricao)
- {
- $arricao = '%';
- }
- if(!$depicao)
- {
- $depicao = '%';
- }
- if($aircraft == !'')
- {
- $aircrafts = afrsearch::findaircraft($aircraft);//print_r($aircrafts);
- foreach($aircrafts as $aircraft)
- {
- $route = afrsearch::findschedules($arricao, $depicao, $airline, $aircraft->id);
- if(!$route){$route=array();}
- if(!$routes){$routes=array();}
- $routes = array_merge($routes, $route);
- }
- }
- else
- {
- $routes = afrsearch::findschedule($arricao, $depicao, $airline);
- }
- $this->set('allroutes', $routes);
- $this->show('schedule_results.tpl');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement