Jump to content

Search schedules by flight type?


MBrown

Recommended Posts

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 :)

Link to comment
Share on other sites

  • Moderators

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:

AS1.png

AS2.png

Link to comment
Share on other sites

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? :D thanks!

Link to comment
Share on other sites

  • 4 months later...

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);

}

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...