Jump to content

Limit the schedule search to existing routes [SOLVED]


tutmeister

Recommended Posts

When searching for a route, the default schedule search when searching under destination and arrival airports shows a HTML select with options for each all airports. As we have 23000+ airports, this causes a huge unnecessary burden on our system. We'd like to limit the search to airports served by our routes only, so could someone help me with the code for this? I've looked through the API, but I don't have a test install environment right now, so can't afford to screw it up!

Link to comment
Share on other sites

OK, I believe I have solved my own question.

In Core/Modules/Schedules/Schedules.php on Line 161, change:

$depapts = OperationsData::GetAllAirports();

to read:

$depapts = SchedulesData::getDepartureAirports(UV);
$arrapts = SchedulesData::getArrivalAiports(UV);

Where UV is your airline code.

In lib/skins/yourtheme/schedule_searchform.tpl, change starting on line 32:


	<?php
	if(!$depairports) $depairports = array();
		foreach($depairports as $airport)
		{
			echo '<option value="'.$airport->icao.'">'.$airport->icao
					.' ('.$airport->name.')</option>';
		}
	?>

To read:


	<?php
	if(!$arrairports) $arrairports = array();
		foreach($arrairports as $airport)
		{
			echo '<option value="'.$airport->icao.'">'.$airport->icao
					.' ('.$airport->name.')</option>';
		}
	?>

Link to comment
Share on other sites

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...