Jump to content

Boarding Pass php code


TheBulk

Recommended Posts

Hi all,

A quick question. I am working on the boarding pass for my VA. It is working nicely however I want to add a gate closure time which is dynamic rather than a static message. What I mean is to have some php coding (if poss) that takes the departure time and takes away 20mins to display the time the gate closes and this way it would display a time 20mins prior to depart. It would also be different for every flight no matter what the departure time. I have listed an example below.

This is the static message:

Gate closes: 20 minutes before flight departure

Departure: 11:20 GMT

The dynamic message:

Gate closes: 11:00 GMT

Departure: 11:20 GMT

If anyone knows if this is possible and knows a way for me to do this it would be great.

Cheers

Jonny

Link to comment
Share on other sites

  • Administrators

In schedule_boarding_pass.tpl

find:

<strong>Flight: </strong><?php echo $schedule->code.$schedule->flightnum?><br />

Make a new line after and add:

<?php
   $close = explode(':', $schedule->deptime);
   if ($close[1] >= '20')
     { $close[1] = $close[1] - 20; }
   else
     {
        $close[1] = 20 - $close[1];
        $close[1] = 60 - $close[1];
            if ($close[0] == '0')
              { $close[0] = '23'; }
            else
              { $close[0] = $close[0] - '1'; }
      }
?>
<strong>Gate Closes: </strong><?php echo $close[0].':'.$close[1]; ?><br />

This will give you a time 20 minutes earlier than the departure time for VA's using a 24 hour time format. You will have to adjust your template to make the airports line up with the dep and arr times. B)

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