TB1
February 14, 2014, 11:10am
1
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!
StartVM
February 17, 2014, 6:15am
2
Oooh I will be the first to give this a try on 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
1 Like
TB1
February 17, 2014, 11:34am
3
Don’t sweat it mate, you’re helping me out with the sliding box for our site! Btw I’m loving the USA!
1 Like
Junior
February 22, 2014, 10:20pm
4
COOL!!! thank you a lot for this mate +1
Junior
February 22, 2014, 10:55pm
5
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
StartVM
February 24, 2014, 4:10am
6
Do you have these installed? stuartpb’s Airport Information Addon and Vansers VFleetTracker
Edwin
February 24, 2014, 7:51am
7
Looking very nice, any chance you can also get this working for the skyline theme?
TB1
February 24, 2014, 4:34pm
8
You could port it to skyline by changing some of the links and things but this is really for Pacific only.
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 ?
something comes empty
can you tell us what is there in line 419 ?
I have the same error as Industrialshadow.
But at my site he says at line 1221.
And line 1221 is:
foreach($lastbids as $lastbid)
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:
foreach($lastbids as $lastbid)
Hey, i did a few things to get this working
In the Modules > Airports, i renamed the " airport_main.tpl " and “airport_info.tpl” into " airport_main.php " and “airport_info.php”
And for this error
foreach($lastbids as $lastbid)
Just change the " $lastbids " into " $lastbid"
should look like this :
foreach($lastbid as $lastbid)
Regards,
Leonard
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)
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?
I’ve made some custom edits to it on my VA.
3 hours ago, LeonardIGO4036 said:
How exactly do you want it to display?
I’ve made some custom edits to it on my VA.
Really, the upcoming departures (current bids) would be great to display on my main page (frontpage_main.tpl)
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
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!
Regards,
Leonard.
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.
Very much appreciated Leonard
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.
Very much appreciated Leonard
Glad that the code works
A like would be appreciated
1 Like
On 28/11/2017 at 7:17 PM, LeonardIGO4036 said:
Glad that the code works
A like would be appreciated
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
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:)