Jump to content

Random Itineray Builder


Guest lorathon

Recommended Posts

Guest lorathon

This module will build a random itinerary of 5,10 or 15 flights in length. Starting from the pilots current location and linking each flight from the arrival airport.

Once the itinerary is built it can then be bid on in whole. The entire itinerary add to the pilots current bids in the correct order.

Options included are

Skip over schedules that have disabled aircraft

Skip over schedules with an aircraft of higher minrank than the searching pilot

Download from my site

www.fs-products.net

Link to comment
Share on other sites

  • Moderators

Jeff,

I get the following error,

Warning: Invalid argument supplied for foreach() in /srv/www/grantsva.com/public_html/TestVA/core/modules/RandomFlights/RandomFlights.php on line 30

30 is in the loop,

$flights = SchedulesData::findSchedules($params);

foreach ($flights as $row)

{

$r = rand(0, count($flights));

$airline = OperationsData::getAirlineByCode($flights[$r]->code);

if($airline->enabled == 0) continue;

if ($flights[$r]->aircraftlevel > Auth::$userinfo->ranklevel)

{

continue;

}

One thing i have done differently is the tpl files were placed in to the skins folder, would this make a difference, i will give it a go in the core templates as well?

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
Guest lorathon

Looking at your schedule I imagine it is due to the fact that your schedule does not have inter-connected flights. The itinerary builder is looking for flights that continue from airport to airport.

KLAX-KLAS

KLAX-KONT

KONT-PHNL

PHNL-KSFO

etc......

Link to comment
Share on other sites

Hey Lorathon,

I was just thinking that your addon (already excellent) would benefit from a feature (or set of features) which allow a pilot to enter their departure (initial) airport and the arrival (terminal) airport. If there is no direct flight it should populate with an itinerary of interconnected flights which would start from the departure (init) airport and end at the arrival (terminal) airport. for example if i wanted to travel from LGAV to KIAD and there was no direct flight it should give me an itinerary of flights that are operational by the VA like

LGAV (Athens, GRE) to KJFK

KJFK to KIAD

it will enhance the sence of realism in the VA as far as booking flights don't you think?

Link to comment
Share on other sites

Looking at your schedule I imagine it is due to the fact that your schedule does not have inter-connected flights. The itinerary builder is looking for flights that continue from airport to airport.

KLAX-KLAS

KLAX-KONT

KONT-PHNL

PHNL-KSFO

etc......

Cool mate, thanks for the info, I will add more flights!

Link to comment
Share on other sites

Guest lorathon

Hey Lorathon,

I was just thinking that your addon (already excellent) would benefit from a feature (or set of features) which allow a pilot to enter their departure (initial) airport and the arrival (terminal) airport. If there is no direct flight it should populate with an itinerary of interconnected flights which would start from the departure (init) airport and end at the arrival (terminal) airport. for example if i wanted to travel from LGAV to KIAD and there was no direct flight it should give me an itinerary of flights that are operational by the VA like

LGAV (Athens, GRE) to KJFK

KJFK to KIAD

it will enhance the sence of realism in the VA as far as booking flights don't you think?

Yeah I know. I have been thinking about this but the code necessary would be massive (I think). I am still pondering it. If I can figure it out I will do it.

Link to comment
Share on other sites

Guest lorathon

When I use this it always says that the starting airport is Compiègne-Margny (LFAD).

I have changed location to EGLL but it still shows the same as above. Am I missing something that I need to do?

The starting point is your last location. So LFAD should be the last airport you landed at.

Link to comment
Share on other sites

  • 2 weeks later...

Just ran this again and I get the following error:

Warning: Invalid argument supplied for foreach() in /home/robinhoo/public_html/core/modules/RandomFlights/RandomFlights.php on line 30

I have just upated the the latest version of phpvms, is this the problem?

Cheers

Dale

Link to comment
Share on other sites

  • 2 months later...

Gave Error Here

Help Please

I came to choose the place where I'm coming from and the number of scales, but when I press it to generate the error below this

Warning: Invalid argument supplied for foreach() in /home/vhosts/airsulvirtual.ueuo.com/core/modules/RandomFlights/RandomFlights.php on line 30

Link to comment
Share on other sites

Guest lorathon

Wallace - Mark is correct. Do you have schedules? Do you have a starting location?

Cowboy - You would need to change the code so that if the pilot does not have a last location to default to his/her hub or some other starting point

Link to comment
Share on other sites

people. I could do to show on screen the hub of the guy if he did not make any flight. not only managed to make it refer to it when asked to scale. someone who digs php help? help us all.

open randomsearch.tpl

<?php
$pilotid = Auth::$userinfo->pilotid;
$last_location = PIREPData::getLastReports($pilotid, 1);
$last_name = OperationsData::getAirportInfo($last_location->arricao);
$userinfo = PilotData::getpilotdata($userinfo->hub);
?>

<table border = "0">
 <tr>
<th scope="col">Sistema de Reserva de Escala</th>
 </tr>
 <tr><form name="randomflights" id="randomflights" action="<?php echo SITE_URL?>/index.php/randomflights/getRandomFlights" method="post">
   <td>Informe seu Local Atual </td>
     <table>
       <tr>
		<td width ="25%"><b>Aeroporto Atual:</b></td>
		<td width ="75%"><select id="depicao" name="depicao">
		  <?php 
if (!$last_location == null)
   { ?> 
	<option value="<?php echo $last_location->arricao?>">
<?php echo $last_location->arricao?> (<?php echo $last_name->name?>)</option>
			<?php 
			}
			else
 				  { ?>
	<option value="<?php echo $userinfo->hub?>">
<?php echo $userinfo->hub?> (<?php echo $userinfo->hub?>)</option>
<?php 	}
 ?>	</select>
		</td>		
	</tr>
	<tr>
		<td width ="25%"><b>Você Vai Receber uma Reserva de :</b></td>
		<td width ="75%"><select id="count" name="count">			  
		  <option value="4">4</option>

		</select>Vôos</td>
		<td><input type="submit" name="submit" value="Gerar Escala"></td>
	</tr>
  </table>	  	
   </form>
 </tr>
</table>

Link to comment
Share on other sites

Guest lorathon

Try this


<?php
$pilotid = Auth::$userinfo->pilotid;
$last_location = PIREPData::getLastReports($pilotid, 1);
$last_name = OperationsData::getAirportInfo($last_location->arricao);
$userinfo = PilotData::getPilotData($pilotid);

if($last_location->arricao == '') $last_location->arricao = $userinfo->hub;
?>

<table border = "0">
 <tr>
<th scope="col">Random Itinerary from Current Location</th>
 </tr>
 <tr><form name="randomflights" id="randomflights" action="<?php echo SITE_URL?>/index.php/randomflights/getRandomFlights" method="post">
   <td>Current Location Preselected </td>
     <table>
       <tr>
		<td width ="25%"><b>Current Location:</b></td>
		<td width ="75%"><select id="depicao" name="depicao">
		  <option value="<?php echo $last_location->arricao?>"><?php echo $last_location->arricao?> (<?php echo $last_name->name?>)</option>
		</td>		
	</tr>
	<tr>
		<td width ="25%"><b>Number of Flights:</b></td>
		<td width ="75%"><select id="count" name="count">			  
		  <option value="5">5</option>
		  <option value="10">10</option>
		  <option value="15">15</option>			  		
		</select></td>
		<td><input type="submit" name="submit" value="Find Random Flights"></td>
	</tr>
  </table>	  	
   </form>
 </tr>
</table>


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