# Upcoming Departures

**URL:** <https://forum.phpvms.net/t/upcoming-departures/8966>\
**Category:** Code Snippets\
**Created:** [February 14, 2014, 11:10am UTC](https://forum.phpvms.net/t/upcoming-departures/8966 "2014-02-14T11:10:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![TB1](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tb1/32/366_2.png) [@TB1](https://forum.phpvms.net/u/TB1)\
**Post date:** [February 14, 2014, 11:10am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/1 "2014-02-14T11:10:43Z")

</div>

Hello guys,

I just wanted to share with you some code I have running on our logging site.

For this to work you need Zumeweb’s Pacific skin, stuartpb’s Airport Information Addon and Vansers VFleetTracker added.

This bit of code will display flights that have been bidded on on a table form with some cool links to the modules listed above.

When there is a flight that has been bidded on something like this will appear:

If no flights have been bidded on then this will appear: (not the latest flights table, the thing below that).

Here is the code:

```
<?php
$lastbid = SchedulesData::GetAllBids();
if (count($lastbid) > 0)
{ ?>

<div class="row-fluid">
<div class="span12">
<div class="box">
<table width="100%" border="0" bordercolor="#FFFFFF">
<h3><center>Upcoming Departures</h3>
</div>

<style type="text/css">
table th { text-align: center; color:black; font-weight:bold;}
table td { text-align: center; }
</style>
<thead>
<tr>
<style type="text/css">
{ text-align: center; }
</style>
<th><div align="center">Flight Number</div></th>
<th><div align="center">Pilot</div></th>
<th><div align="center">Departure</div></th>
<th><div align="center">Arrival</div></th>
<th><div align="center">Flight Duration</div></th>
<th><div align="center">Aircraft</th>
<th><div align="center">Registration</div></th>
</tr>
</thead>
<tbody>
<?php

foreach($lastbids as $lastbid)
{
?>

<?php
$flightid = $lastbid->id
?>

<td height="25" width="10%" align="center"><span><a href="<?php echo SITE_URL?>/index.php/schedules/details/<?php echo '' . $flightid . '';?> "><?php echo $lastbid->code; ?><?php echo $lastbid->flightnum; ?></span></td>
<?php
$params = $lastbid->pilotid;

$pilot = PilotData::GetPilotData($params);
$pname = $pilot->firstname;
$psurname = $pilot->lastname;
?>
<td height="25" width="10%" align="center"><span><a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo '' . $params . ''; ?>"><?php echo $pname; ?> <?php echo $psurname; ?></span></td>
<td height="25" width="10%" align="center"><span><?php echo '<a href=" '.SITE_URL.'/index.php/airports/get_airport?icao='.$lastbid->depicao.'">'.$lastbid->depicao.'</a>';?></span></td>
<td height="25" width="10%" align="center"><span><?php echo '<a href=" '.SITE_URL.'/index.php/airports/get_airport?icao='.$lastbid->arricao.'">'.$lastbid->arricao.'</a>';?></span></td>
<td height="25" width="10%" align="center"><span><?php echo $lastbid->flighttime; ?> hours</span></td>
<td height="25" width="10%" align="center"><span><a href="<?php echo SITE_URL?>/index.php/vFleetTracker/view/<?php echo '' . $lastbid->registration . ''; ?>"><?php echo $lastbid->aircraft; ?></a></td>
<td height="25" width="10%" align="center"><span><a href="<?php echo SITE_URL?>/index.php/vFleetTracker/view/<?php echo '' . $lastbid->registration . ''; ?>"><?php echo $lastbid->registration; ?></a></td>

</tr>
</div>
</div>
</div>
<?php
}
} else { ?>
<div class="row-fluid">
<div class="span12">
<div class="box">
<table width="100%" border="0" bordercolor="#FFFFFF">
<h3><center>There Are No Upcoming Departures!</h3>
</div>
<?php
}
?>
</tbody>
</table>
</div>

```

For this to work you need to paste this into your frontpage\_recentbids.tpl file. Remember the links will not work unless you have the modules mentioned above installed.

Enjoy!

---

<div class="post-metadata">

**Author:** ![StartVM](https://forum.phpvms.net/user_avatar/forum.phpvms.net/startvm/32/327_2.png) [@StartVM](https://forum.phpvms.net/u/StartVM)\
**Post date:** [February 17, 2014, 6:15am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/2 "2014-02-17T06:15:18Z")

</div>

Oooh I will be the first to give this a try on [hawaiianva.org](http://hawaiianva.org) when I get home. Looks promising. it is people like you willing to share with others that brings this community up! Good work mate

---

<div class="post-metadata">

**Author:** ![TB1](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tb1/32/366_2.png) [@TB1](https://forum.phpvms.net/u/TB1)\
**Post date:** [February 17, 2014, 11:34am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/3 "2014-02-17T11:34:03Z")

</div>

Don’t sweat it mate, you’re helping me out with the sliding box for our site! Btw I’m loving the USA!

---

<div class="post-metadata">

**Author:** ![Junior](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@Junior](https://forum.phpvms.net/u/Junior)\
**Post date:** [February 22, 2014, 10:20pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/4 "2014-02-22T22:20:01Z")

</div>

COOL!!! thank you a lot for this mate +1

---

<div class="post-metadata">

**Author:** ![Junior](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@Junior](https://forum.phpvms.net/u/Junior)\
**Post date:** [February 22, 2014, 10:55pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/5 "2014-02-22T22:55:55Z")

</div>

getting an error, **Warning** : Invalid argument supplied for foreach() in **/home/voovirtu/public\_html/va/lib/skins/Zumeweb.Pacific.V1/frontpage\_main.tpl** on line **299**

---

<div class="post-metadata">

**Author:** ![StartVM](https://forum.phpvms.net/user_avatar/forum.phpvms.net/startvm/32/327_2.png) [@StartVM](https://forum.phpvms.net/u/StartVM)\
**Post date:** [February 24, 2014, 4:10am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/6 "2014-02-24T04:10:09Z")

</div>

Do you have these installed? stuartpb’s Airport Information Addon and Vansers VFleetTracker

---

<div class="post-metadata">

**Author:** ![Edwin](https://forum.phpvms.net/user_avatar/forum.phpvms.net/edwin/32/154_2.png) [@Edwin](https://forum.phpvms.net/u/Edwin)\
**Post date:** [February 24, 2014, 7:51am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/7 "2014-02-24T07:51:18Z")

</div>

Looking very nice, any chance you can also get this working for the skyline theme?

---

<div class="post-metadata">

**Author:** ![TB1](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tb1/32/366_2.png) [@TB1](https://forum.phpvms.net/u/TB1)\
**Post date:** [February 24, 2014, 4:34pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/8 "2014-02-24T16:34:11Z")

</div>

You could port it to skyline by changing some of the links and things but this is really for Pacific only.

---

<div class="post-metadata">

**Author:** ![Industrialshadow](https://forum.phpvms.net/user_avatar/forum.phpvms.net/industrialshadow/32/97_2.png) [@Industrialshadow](https://forum.phpvms.net/u/Industrialshadow)\
**Post date:** [August 22, 2016, 3:53pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/9 "2016-08-22T15:53:19Z")

</div>

Hi

i have tried to bring it it up to my va

i get this Error

**Warning** : Invalid argument supplied for foreach() in **/www/htdocs/w00dac26/lausitzair/lib/skins/ocean\_blue/frontpage\_main.php** on line **419**

**And the Airport Addon and Fleettracker is installed**

**Any Solutions ready ?**

---

<div class="post-metadata">

**Author:** ![Vangelis](https://forum.phpvms.net/user_avatar/forum.phpvms.net/vangelis/32/38_2.png) [@Vangelis](https://forum.phpvms.net/u/Vangelis)\
**Post date:** [August 22, 2016, 8:18pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/10 "2016-08-22T20:18:08Z")

</div>

something comes empty

can you tell us what is there in line 419 ?

---

<div class="post-metadata">

**Author:** ![firejelle](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/f/b19c9b/32.png) [@firejelle](https://forum.phpvms.net/u/firejelle)\
**Post date:** [October 18, 2016, 8:42pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/11 "2016-10-18T20:42:21Z")

</div>

I have the same error as Industrialshadow.

But at my site he says at line 1221.

And line 1221 is:

```
foreach($lastbids as $lastbid)

```

---

<div class="post-metadata">

**Author:** ![LeonardIGO4036](https://forum.phpvms.net/user_avatar/forum.phpvms.net/leonardigo4036/32/1087_2.png) [@LeonardIGO4036](https://forum.phpvms.net/u/LeonardIGO4036)\
**Post date:** [July 6, 2017, 10:19am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/12 "2017-07-06T10:19:03Z")

</div>

> On 10/19/2016 at 2:12 AM, firejelle said:
> 
> I have the same error as Industrialshadow.
> 
> But at my site he says at line 1221.
> 
> And line 1221 is:
> 
> &nbsp;
> 
> foreach($lastbids as $lastbid)
> 
> &nbsp;
> 
> &nbsp;

Hey, i did a few things to get this working

1. In the Modules \> Airports, i renamed the **"&nbsp;airport\_main.tpl " and “airport\_info.tpl”** into&nbsp; **"&nbsp;airport\_main.php&nbsp;" and “airport\_info.php”**

2. And for this error&nbsp;

Just change the " **$lastbids**" into " **$lastbid"&nbsp;**  
should look like this :&nbsp;

```
foreach($lastbid as $lastbid)

```

Regards,&nbsp;

Leonard

---

<div class="post-metadata">

**Author:** ![topher2880](https://forum.phpvms.net/user_avatar/forum.phpvms.net/topher2880/32/1084_2.png) [@topher2880](https://forum.phpvms.net/u/topher2880)\
**Post date:** [November 27, 2017, 1:21am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/13 "2017-11-27T01:21:32Z")

</div>

Is there any updates on this? Specifically id like to display the upcoming flights (bids) and the airframe reg is a nice touch also.. but the mods are old and hard to find (for me)

---

<div class="post-metadata">

**Author:** ![LeonardIGO4036](https://forum.phpvms.net/user_avatar/forum.phpvms.net/leonardigo4036/32/1087_2.png) [@LeonardIGO4036](https://forum.phpvms.net/u/LeonardIGO4036)\
**Post date:** [November 27, 2017, 6:27am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/14 "2017-11-27T06:27:17Z")

</div>

> 5 hours ago, topher2880 said:
> 
> Is there any updates on this? Specifically id like to display the upcoming flights (bids) and the airframe reg is a nice touch also.. but the mods are old and hard to find (for me)

How exactly do you want it to display?&nbsp;

&nbsp;

I’ve made some custom edits to it on my VA.&nbsp;

---

<div class="post-metadata">

**Author:** ![topher2880](https://forum.phpvms.net/user_avatar/forum.phpvms.net/topher2880/32/1084_2.png) [@topher2880](https://forum.phpvms.net/u/topher2880)\
**Post date:** [November 27, 2017, 10:30am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/15 "2017-11-27T10:30:19Z")

</div>

> 3 hours ago, LeonardIGO4036 said:
> 
> How exactly do you want it to display?&nbsp;
> 
> &nbsp;
> 
> I’ve made some custom edits to it on my VA.&nbsp;

Really, the upcoming departures (current bids) would be great to display on my main page (frontpage\_main.tpl)&nbsp;

I display live flights, but as we all know, you need smartCARS (or similar) active for those, but to display flights booked and not yet running would be great

---

<div class="post-metadata">

**Author:** ![LeonardIGO4036](https://forum.phpvms.net/user_avatar/forum.phpvms.net/leonardigo4036/32/1087_2.png) [@LeonardIGO4036](https://forum.phpvms.net/u/LeonardIGO4036)\
**Post date:** [November 27, 2017, 5:25pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/16 "2017-11-27T17:25:31Z")

</div>

Okay, I have made it work with a custom skin here, I’ve added a feature which you could see “Upcoming”, the green label. It’ll turn into a red color label and say “No Departures” if there are no upcoming departures. and additionally, i’ve added the time till which the bid will be available. Which is 48 hours.

If you’re using a Bootstrap theme, then just copy and paste my code into your frontpage\_main.tpl

```
\<div class="col-md-12"\> \<!--Upcoming Departures block--\> \<div class="block"\> \<div class="block-title"\> \<?php $lastbids = SchedulesData::GetAllBids(); if (count($lastbids) \> 0) { $departurestatus = 'Upcominig'; $label\_clr = 'success'; } else { $departurestatus = 'No Departures'; $label\_clr = 'danger'; } ?\> \<div class="block-options pull-right"\> \<span class="label label-\<?php echo $label\_clr ?\> animation-pulse"\>\<?php echo $departurestatus?\>\</span\> \</div\> \</div\> \<h3\>\<Strong\>Upcoming\</Strong\> Departures\</h3\> \<div class="table-responsive"\> \<!--Remove this line if you dont want the departures box to be on a fixed scale--\> \<div style="overflow: auto; height: 270px; border: 0px solid #666; margin-bottom: 20px; padding: 5px; padding-top: 0px; padding-bottom: 20px;"\> \<table class="table table-hover table-striped"\> \<thead\> \<tr\> \<th\> \<div align="center"\>Flight #\</div\> \</th\> \<th\> \<div align="center"\>Pilot\</div\> \</th\> \<th\> \<div align="center"\>Slot added on\</div\> \</th\> \<th\> \<div align="center"\>Slot Expires on\</div\> \</th\> \<th\> \<div align="center"\>Departure\</div\> \</th\> \<th\> \<div align="center"\>Arrival\</div\> \</th\> \<th\> \<div align="center"\>Registration\</div\> \</th\> \</tr\> \</thead\> \<tbody\> \<?php $lastbids = SchedulesData::GetAllBids(); if (count($lastbids) \> 0) { ?\> \<?php foreach($lastbids as $lastbid) { ?\> \<?php $flightid = $lastbid-\>id ?\> \<td height="25" width="10%" align="center"\>\<font face="Bauhaus"\>\<span\>\<?php echo $lastbid-\>code; ?\>\<?php echo $lastbid-\>flightnum; ?\>\</span\>\</font\>\</td\> \<?php $params = $lastbid-\>pilotid; $pilot = PilotData::GetPilotData($params); $pname = $pilot-\>firstname; $psurname = $pilot-\>lastname; $now = strtotime(date('d-m-Y',strtotime($lastbid-\>dateadded))); $date = date("d-m-Y", strtotime('+48 hours', $now)); ?\> \<td height="25" width="10%" align="center"\>\<span\>\<?php echo $pname; ?\> \<?php echo $psurname; ?\>\</span\>\</td\> \<td height="25" width="10%" align="center"\>\<span class="text-success"\>\<?php echo date('d-m-Y',strtotime($lastbid-\>dateadded)); ?\>\</span\>\</td\> \<td height="25" width="10%" align="center"\>\<span class="text-danger"\>\<?php echo $date; ?\>\</span\>\</td\> \<td height="25" width="10%" align="center"\>\<span\>\<font face=""\>\<?php echo '\<a class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="Click to view Airport Information!" href=" '.SITE\_URL.'/index.php/airports/get\_airport?icao='.$lastbid-\>depicao.'"\>'.$lastbid-\>depicao.'\</a\>';?\>\</font\>\</span\>\</td\> \<td height="25" width="10%" align="center"\>\<span\>\<font face=""\>\<?php echo '\<a class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="Click to view Airport Information!" href= '.SITE\_URL.'/index.php/airports/get\_airport?icao='.$lastbid-\>arricao.'"\>'.$lastbid-\>arricao.'\</a\>';?\>\</font\>\</span\>\</td\> \<td height="25" width="10%" align="center"\>\<span\>\<a class="btn btn- btn-sm" data-toggle="tooltip" data-placement="top" title="Click to view Aircraft Information!" href="\<?php echo SITE\_URL?\>/index.php/vFleetTracker/view/\<?php echo '' . $lastbid-\>registration . ''; ?\>"\>\<?php echo $lastbid-\>registration; ?\>\</a\>\</td\> \</tr\> \<?php } } else { ?\> \<div class="alert alert-danger"\> \<strong\>Oops\</strong\>\<br\> Looks like there are no upcoming departures at the moment, do you feel like flying? Click \<a href="\<?php echo SITE\_URL?\>/index.php/Schedules"\>here\</a\> to bid a flight! #tuigroupvirtual \</div\> \<?php } ?\> \</tbody\> \</table\> \</div\> \</div\> \</div\> \<!--END Upcoming Departures Block--\> \</div\>

```

Let me know if this works for you!&nbsp;  
Regards,&nbsp;  
Leonard.

---

<div class="post-metadata">

**Author:** ![topher2880](https://forum.phpvms.net/user_avatar/forum.phpvms.net/topher2880/32/1084_2.png) [@topher2880](https://forum.phpvms.net/u/topher2880)\
**Post date:** [November 27, 2017, 9:31pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/17 "2017-11-27T21:31:19Z")

</div>

Hi, thanks heaps for posting that. I dont have the colours and neat look that your screen capture does, but the data is displaying, I can edit the layout to suit mine.&nbsp;

Very much appreciated Leonard

---

<div class="post-metadata">

**Author:** ![LeonardIGO4036](https://forum.phpvms.net/user_avatar/forum.phpvms.net/leonardigo4036/32/1087_2.png) [@LeonardIGO4036](https://forum.phpvms.net/u/LeonardIGO4036)\
**Post date:** [November 28, 2017, 8:47am UTC](https://forum.phpvms.net/t/upcoming-departures/8966/18 "2017-11-28T08:47:39Z")

</div>

> 11 hours ago, topher2880 said:
> 
> Hi, thanks heaps for posting that. I dont have the colours and neat look that your screen capture does, but the data is displaying, I can edit the layout to suit mine.&nbsp;
> 
> Very much appreciated Leonard

Glad that the code works  
A like would be appreciated&nbsp;

---

<div class="post-metadata">

**Author:** ![topher2880](https://forum.phpvms.net/user_avatar/forum.phpvms.net/topher2880/32/1084_2.png) [@topher2880](https://forum.phpvms.net/u/topher2880)\
**Post date:** [November 29, 2017, 12:10pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/19 "2017-11-29T12:10:33Z")

</div>

> On 28/11/2017 at 7:17 PM, LeonardIGO4036 said:
> 
> Glad that the code works  
> A like would be appreciated&nbsp;

How do I give you a like? I certainly would do that. It doesnt have the great look of yours but it does look good matching my colour scheme

---

<div class="post-metadata">

**Author:** ![LeonardIGO4036](https://forum.phpvms.net/user_avatar/forum.phpvms.net/leonardigo4036/32/1087_2.png) [@LeonardIGO4036](https://forum.phpvms.net/u/LeonardIGO4036)\
**Post date:** [November 29, 2017, 12:12pm UTC](https://forum.phpvms.net/t/upcoming-departures/8966/20 "2017-11-29T12:12:09Z")

</div>

> 1 minute ago, topher2880 said:
> 
> How do I give you a like? I certainly would do that. It doesnt have the great look of yours but it does look good matching my colour scheme

Simply hover over the heart icon below. slide to the left and press the “thanks” icon.  
Thank you once again:)

[Next page](https://forum.phpvms.net/t/upcoming-departures/8966.md?page=2)
