Jump to content

Have Pilots Only Able to Bid Departure from Previous Arrival


alblua

Recommended Posts

A virtual airline would like me to help them create a function in phpVMS in which the pilot can only bid from a flight that they had previously arrived from.

I'm wondering if such function is possible, or should I suggest just reject flights that don't follow the criteria (that would seem mean, :P)?

Haven't touched phpVMS for a whole summer, so I'm extremely rusty on the matter.

Any input would be great, thanks!

Link to comment
Share on other sites

  • Moderators

Unfortunately there is not any default function except if you add an if statement inside the schedule_results.tpl foreach and show only schedules from the last pilot's location. The thing is that you will have to get into consideration the fact that sometimes the schedules are not rounded. I believe that rejecting a pirep if it was not flown from the last pilot's location is too bureaucratic. If you search the forum there are some freeware and payware modules too.

Freeware: http://forum.phpvms.net/topic/2791-realschedulelite-beta-10-deprecated/

Freeware: http://forum.phpvms.net/topic/8315-flightbookingsystem-v10/

Payware: http://php-mods.eu/site/index.php/real-booking-system/

Link to comment
Share on other sites

Oh come on this is a very simple request no need for payware stuff or manual reject nonsense.

In your schedule_results.tpl use

$pid = Auth::$userinfo->pilotid;
$sql = "SELECT arricao FROM ".TABLE_PREFIX."pireps WHERE pilotid = '$pid' ORDER BY submitdate DESC LIMIT 1";
$myloc = DB::get_row($sql);

if($myloc && $myloc->arricao != $route->depicao)
{ continue; }

Or better would be open PIREPData.class.php and add a function in there like

public function mylastlocation($pilotid)
{
$sql = "SELECT arricao FROM ".TABLE_PREFIX."pireps WHERE pilotid = '$pilotid' ORDER BY submitdate DESC LIMIT 1";
return DB::get_row($sql);
}

and then in schedule_results.tpl use

$myloc = PIREPData::mylastlocation(Auth::$userinfo->pilotid);

if($myloc && $myloc->arricao != $route->depicao)
{ continue; }

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