MBrown Posted November 19, 2012 Report Share Posted November 19, 2012 Had a quick search over the forums but no luck. People have asked I believe how to be able to search the schedules by using hundreds of different variations. But what I was wondering if it's possible to add an alternative flight search box by flight type? You know, when you upload the schedules you can say if each route is either: "P" (Passenger), "C" (Cargo) or "H" (Charter) The reason I say it is as you know I have a charter airline and there are literally tens of thousands of charter routes, but then amongst those there are are few routes which are actually "Scheduled" routes. So to be able to filter those from the charter routes I was hoping to be able to search by either "P" passenger flights or "H" Charter flights. Any suggestions, any code snippets? I know the flight types exist, just a question of pulling those and putting them into the schedule search. (I'm talking about the default schedule search not the one by Simpilot). Many thanks for your help again, Matthew Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 20, 2012 Moderators Report Share Posted November 20, 2012 Why don't you add an airline and name it "Charter" set the code as "ch" then you could add the routes with that airline as "CH123" then search by airline which is already there. This way is a lot easier than adding the flight type. Quote Link to comment Share on other sites More sharing options...
MBrown Posted November 20, 2012 Author Report Share Posted November 20, 2012 Well it's not ideal, it would be better to be able to search by flight type of course. But I suppose if it's not possible then what you mention would have to do! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 20, 2012 Moderators Report Share Posted November 20, 2012 It's possible but you'll have to change some original files as well as some functions to include the flight type. Quote Link to comment Share on other sites More sharing options...
MBrown Posted November 20, 2012 Author Report Share Posted November 20, 2012 Well I suppose it's worth a shot?! Can't imagine it being any different than searching by the day just flight type? Will have to search the forums see if I can find the code for that and/or instructions Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 20, 2012 Moderators Report Share Posted November 20, 2012 I have created a module for someone in the forum and the guy requested the schedules to be separated by the airline. I can offer you the same thing but code it to work with flight type but you won't be able to use the default search module with this. Screenshots: Quote Link to comment Share on other sites More sharing options...
MBrown Posted November 20, 2012 Author Report Share Posted November 20, 2012 I think I've nearly done it just the last bit now it's not working 100%. Into "scedule_searchform.tpl" I simply add a new ID in the tabcontainer and then below a new section. This is what I have come up with: <li><a href="#flighttypetab"><span>By Flight Type</span></a></li> </select> <input type="submit" name="submit" value="Find Flights" /> </div> <div id="flighttype"> <p>Select a flight type, charter or scheduled.</p> <select id="flighttype" name="flighttype"> <option value="">Select Flight Type</option> <?php if($schedule->flighttype == $flightkey); ($flighttypes as $flightkey=>$flighttype) { echo '<option value="'.$schedule->flighttype.'">'.$schedule->flighttype.'</option>'; } ?> But I have a feeling it's not right as it doesn't seem to work. I'm getting the info on what to put from here (ops_scheduleform.tpl): <td valign="top"><strong>Flight Type</strong></td> <td><select name="flighttype"> <?php foreach($flighttypes as $flightkey=>$flighttype) { if($schedule->flighttype == $flightkey) $sel = 'selected'; else $sel = ''; ?> <option value="<?php echo $flightkey?>" <?php echo $sel; ?>><?php echo $flighttype?> Flight</option> <?php } ?> </select> </td> And this is a working template of another tab in the schedule search I was using but replacing with flight type info: <input type="submit" name="submit" value="Find Flights" /> </div> <div id="airlinetab"> <p>Select An Airline</p> <select id="airlines" name="airlines"> <option value="">Select Airline</option> <?php if(!$airlines) $airlines = array(); foreach ($airlines as $airline) { echo '<option value="'.$airline->code.'">'.$airline->name.'</option>'; } ?> </select> Any ideas on what the correct combinations would be in able for it to work? thanks! Quote Link to comment Share on other sites More sharing options...
MBrown Posted November 26, 2012 Author Report Share Posted November 26, 2012 Hello! Would really appreciate some help as so nearly have this figured! Bump bump bumpity bump please Quote Link to comment Share on other sites More sharing options...
CVV001 Posted April 2, 2013 Report Share Posted April 2, 2013 I have made an addition to the source code of "schedule_searchform.tpl" to obtain the desired search for a 'Flight Type' in Your VA <h3>Search Schedules</h3> <form id="form" action="<?php echo actionurl('/schedules/view');?>" method="post"> <div id="tabcontainer"> <ul> <li><a href="#flighttypetab"><span>By Flight Type</span></a></li> <li><a href="#depapttab"><span>By Departure Airport</span></a></li> <li><a href="#arrapttab"><span>By Arrival Airport</span></a></li> <li><a href="#aircrafttab"><span>By Aircraft Type</span></a></li> <li><a href="#distance"><span>By Distance</span></a></li> </ul> <div id="flighttypetab"> <p>Select desired flight type:</p> <select id="flighttype" name="flighttype"> <option value="">Select Passenger - Cargo - Military</option> <option value="P">Passenger</option> <option value="C">Cargo</option> <option value="H">Charter</option> </select> <input type="submit" name="submit" value="Find Flights" /> </div> Now you must open and modify also the file located in /modules/Schedules/Schedules.php adding the part in red public function showSchedules() { $depapts = OperationsData::GetAllAirports(); $equip = OperationsData::GetAllAircraftSearchList(true); $this->set('depairports', $depapts); $this->set('equipment', $equip); $this->render('schedule_searchform.tpl'); # Show the routes. Remote this to not show them. $this->set('allroutes', SchedulesData::GetSchedules()); $this->render('schedule_list.tpl'); } public function findFlight() { if($this->post->flighttype != '') { $params = array('s.flighttype' => $this->post->flighttype); } if($this->post->depicao != '') { $params = array('s.depicao' => $this->post->depicao); } Quote Link to comment Share on other sites More sharing options...
MBrown Posted April 22, 2013 Author Report Share Posted April 22, 2013 Hello! Sorry for the delay and many thanks! Will give it a go. Appreciate it thank you, Matthew Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.