From 703d9f4875d483157e266480069e635e85930c39 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Mon, 14 Feb 2011 15:41:39 -0500 Subject: [PATCH] added airline filter to search --- core/modules/Schedules/Schedules.php | 17 ++++-- core/templates/schedule_searchform.tpl | 39 +++++++++----- core/version | 2 +- install/hashlist | 48 ++++++++--------- install/structure.xml | 72 ++++++++++++++------------ 5 files changed, 101 insertions(+), 77 deletions(-) diff --git a/core/modules/Schedules/Schedules.php b/core/modules/Schedules/Schedules.php index 7a4a2cf6..758a86d6 100644 --- a/core/modules/Schedules/Schedules.php +++ b/core/modules/Schedules/Schedules.php @@ -138,6 +138,7 @@ public function removebid() { } public function showSchedules() { + $depapts = OperationsData::GetAllAirports(); $equip = OperationsData::GetAllAircraftSearchList(true); @@ -201,7 +202,6 @@ public function showSchedules() { } if(Config::get('SCHEDULES_ONLY_LAST_PIREP') === true && Auth::LoggedIn() == true) { - if(count($reports) > 0) { # IF the arrival airport doesn't match the departure airport if($reports[0]->arricao != $s->depicao) { @@ -217,17 +217,23 @@ public function showSchedules() { } public function findFlight() { + + + $params = array(); + if($this->post->airlines != '') { + $params['s.code'] = $this->post->airlines; + } if ($this->post->depicao != '') { - $params = array('s.depicao' => $this->post->depicao); + $params['s.depicao'] = $this->post->depicao; } if ($this->post->arricao != '') { - $params = array('s.arricao' => $this->post->arricao); + $params['s.arricao'] = $this->post->arricao; } if ($this->post->equipment != '') { - $params = array('a.name' => $this->post->equipment); + $params['a.name'] = $this->post->equipment; } if ($this->post->distance != '') { @@ -238,10 +244,11 @@ public function findFlight() { $value .= $this->post->distance; - $params = array('s.distance' => $value); + $params['s.distance'] = $value; } $params['s.enabled'] = 1; + $this->set('allroutes', SchedulesData::findSchedules($params)); $this->render('schedule_results.tpl'); } diff --git a/core/templates/schedule_searchform.tpl b/core/templates/schedule_searchform.tpl index 4b43a2b1..0a3d2129 100644 --- a/core/templates/schedule_searchform.tpl +++ b/core/templates/schedule_searchform.tpl @@ -14,11 +14,11 @@ icao.'">'.$airport->icao - .' ('.$airport->name.')'; - } + + foreach($depairports as $airport) { + echo ''; + } ?> @@ -30,11 +30,11 @@ icao.'">'.$airport->icao - .' ('.$airport->name.')'; - } + + foreach($depairports as $airport) { + echo ''; + } ?> @@ -45,10 +45,8 @@ +
+

Select An Airline

+ + + +

Select Distance: