Jump to content

Boarding Pass Gates


flynryan692

Recommended Posts

Hey guys, I have a new project that I want to do. I noticed the boarding pass does this thing where is gets a random gate, how can I make it randomly select the specific gate at an airport?

For example, I have 14 gates at Las Vegas, and 11 gates at San Jose. If a pilot views the boarding pass I want it to randomly select one of the gate numbers I put in for Vegas.

Then I plan on taking this method and putting it in my flight dispatch for pilots.

So, how would I go about doing this? Would if be possible to write something like if $airport = KLAS select gates x - x or something of the sort?

I'm not all to great with php..

Link to comment
Share on other sites

  • Administrators

Hey guys, I have a new project that I want to do. I noticed the boarding pass does this thing where is gets a random gate, how can I make it randomly select the specific gate at an airport?

For example, I have 14 gates at Las Vegas, and 11 gates at San Jose. If a pilot views the boarding pass I want it to randomly select one of the gate numbers I put in for Vegas.

Then I plan on taking this method and putting it in my flight dispatch for pilots.

So, how would I go about doing this? Would if be possible to write something like if $airport = KLAS select gates x - x or something of the sort?

I'm not all to great with php..

Yes, you can do that

https://github.com/nshahzad/phpVMS/blob/master/core/templates/schedule_boarding_pass.tpl#L65

That PHP there where it gets the date, you can do:

<?php
if($schedule->depicao == 'KLAS') {
  echo chr(rand(65, 68));  // Gate letter between A and C
  echo rand(10, 22); // Random gate letter between 10 and 22
} elseif($schedule->depicao == 'KJFK') {
  echo chr(rand(66, 70));  // Gate letter between B and E
  echo rand(110, 120); // Random gate letter between 110 to 120
}

Link to comment
Share on other sites

  • 1 year later...

I got this working perfectly for two of my airports KBOS and KSFO but I want to have accurate gates and terminals for each city we serve all 18. I researched for a couple hours yesterday and accurately copied the terminals and gates from the airport sites on the web. So...I copied the if....else statement and just pasted it after the first statement. Works great!! Also, some of my airports only have numbered gates like PHNL. You can see that instead of letters, I substituted the ASCII code for a dash "-" I am so proud of this since I don't know spit about php coding. There are 2 problems I have encountered maybe Nabeel can help. When you generate a boarding pass it picks the gate correctly at random from my specs in the template, BUT when you push the print view it generates a NEW gate. The first three if/else pairs generate gates then every other one just comes up blank. Help please.

if($schedule->depicao == 'KBOS') {

echo chr(rand(69, 69)); // Gate letter between E and E

echo rand(2, 8); // Random gate letter between 2 and 8

} elseif($schedule->depicao == 'KSFO') {

echo chr(rand(65, 65)); // Gate letter between A and A

echo rand(1, 12); // Random gate letter between 1 to 12

}

if($schedule->depicao == 'PHNL') {

echo chr(rand(45, 45)); // No gate letter just a dash

echo rand(14, 14); // Gate letter 14

} elseif($schedule->depicao == 'KMIA') {

echo chr(rand(69, 69)); // Gate letter between E and E

echo rand(2, 12); // Random gate letter between 2 to 12

}

Link to comment
Share on other sites

  • 2 weeks later...

Thank you, I figured it was something like that which is why I asked Nabeel who wrote it to take a look. I think that more people might like to use this like I am to get their aircraft to load at the actual terminals with the proper gates for all their flights (unless you have 300 flights or something).

Link to comment
Share on other sites

  • 1 month 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...