Advertisement
Guest User

Untitled

a guest
Oct 14th, 2011
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. <?php
  2. //simpilotgroup addon module for phpVMS virtual airline system
  3. //
  4. //simpilotgroup addon modules are licenced under the following license:
  5. //Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
  6. //To view full icense text visit http://creativecommons.org/licenses/by-nc-sa/3.0/
  7. //
  8. //@author David Clark (simpilot)
  9. //@copyright Copyright (c) 2009-2010, David Clark
  10. //@license http://creativecommons.org/licenses/by-nc-sa/3.0/
  11.  
  12. class afrsearch extends CodonModule
  13. {
  14. public $title = 'Search';
  15.  
  16. public function index() {
  17. if(isset($this->post->action))
  18. {
  19. if($this->post->action == 'findflight') {
  20. $this->findflight();
  21. }
  22. }
  23. else
  24. {
  25. $this->set('airports', OperationsData::GetAllAirports());
  26. $this->set('airlines', OperationsData::getAllAirlines());
  27. $this->set('aircrafts', afrsearch::findaircrafttypes());
  28. $this->set('countries', afrsearch::findcountries());
  29. $this->show('afr_search.tpl');
  30. }
  31. }
  32.  
  33. public function findflight()
  34. {
  35. $arricao = DB::escape($this->post->arricao);
  36. $depicao = DB::escape($this->post->depicao);
  37. $airline = DB::escape($this->post->airline);
  38. $aircraft = DB::escape($this->post->aircraft);
  39.  
  40. if(!$airline)
  41. {
  42. $airline = '%';
  43. }
  44. if(!$arricao)
  45. {
  46. $arricao = '%';
  47. }
  48. if(!$depicao)
  49. {
  50. $depicao = '%';
  51. }
  52. if($aircraft == !'')
  53. {
  54. $aircrafts = afrsearch::findaircraft($aircraft);//print_r($aircrafts);
  55. foreach($aircrafts as $aircraft)
  56. {
  57. $route = afrsearch::findschedules($arricao, $depicao, $airline, $aircraft->id);
  58. if(!$route){$route=array();}
  59. if(!$routes){$routes=array();}
  60. $routes = array_merge($routes, $route);
  61. }
  62. }
  63. else
  64. {
  65. $routes = afrsearch::findschedule($arricao, $depicao, $airline);
  66. }
  67.  
  68. $this->set('allroutes', $routes);
  69. $this->show('schedule_results.tpl');
  70.  
  71. }
  72. }
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement