TB1 Posted February 14, 2014 Report Share Posted February 14, 2014 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! 1 1 Quote Link to comment Share on other sites More sharing options...
StartVM Posted February 17, 2014 Report Share Posted February 17, 2014 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 Quote Link to comment Share on other sites More sharing options...
TB1 Posted February 17, 2014 Author Report Share Posted February 17, 2014 Don't sweat it mate, you're helping me out with the sliding box for our site! Btw I'm loving the USA! 1 Quote Link to comment Share on other sites More sharing options...
Junior Posted February 22, 2014 Report Share Posted February 22, 2014 COOL!!! thank you a lot for this mate +1 Quote Link to comment Share on other sites More sharing options...
Junior Posted February 22, 2014 Report Share Posted February 22, 2014 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 Quote Link to comment Share on other sites More sharing options...
StartVM Posted February 24, 2014 Report Share Posted February 24, 2014 Do you have these installed? stuartpb's Airport Information Addon and Vansers VFleetTracker Quote Link to comment Share on other sites More sharing options...
Edwin Posted February 24, 2014 Report Share Posted February 24, 2014 Looking very nice, any chance you can also get this working for the skyline theme? Quote Link to comment Share on other sites More sharing options...
TB1 Posted February 24, 2014 Author Report Share Posted February 24, 2014 You could port it to skyline by changing some of the links and things but this is really for Pacific only. Quote Link to comment Share on other sites More sharing options...
Industrialshadow Posted August 22, 2016 Report Share Posted August 22, 2016 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 ? Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted August 22, 2016 Members Report Share Posted August 22, 2016 something comes empty can you tell us what is there in line 419 ? Quote Link to comment Share on other sites More sharing options...
firejelle Posted October 18, 2016 Report Share Posted October 18, 2016 I have the same error as Industrialshadow. But at my site he says at line 1221. And line 1221 is: foreach($lastbids as $lastbid) Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted July 6, 2017 Report Share Posted July 6, 2017 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 1. In the Modules > Airports, i renamed the " airport_main.tpl " and "airport_info.tpl" into " airport_main.php " and "airport_info.php" 2. And for this error foreach($lastbids as $lastbid) Just change the "$lastbids" into "$lastbid" should look like this : foreach($lastbid as $lastbid) Regards, Leonard Quote Link to comment Share on other sites More sharing options...
topher2880 Posted November 27, 2017 Report Share Posted November 27, 2017 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) Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted November 27, 2017 Report Share Posted November 27, 2017 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. Quote Link to comment Share on other sites More sharing options...
topher2880 Posted November 27, 2017 Report Share Posted November 27, 2017 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 Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted November 27, 2017 Report Share Posted November 27, 2017 (edited) 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. Edited November 27, 2017 by LeonardIGO4036 Quote Link to comment Share on other sites More sharing options...
topher2880 Posted November 27, 2017 Report Share Posted November 27, 2017 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 Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted November 28, 2017 Report Share Posted November 28, 2017 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 Quote Link to comment Share on other sites More sharing options...
topher2880 Posted November 29, 2017 Report Share Posted November 29, 2017 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 Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted November 29, 2017 Report Share Posted November 29, 2017 (edited) 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:) Edited November 29, 2017 by LeonardIGO4036 Quote Link to comment Share on other sites More sharing options...
topher2880 Posted November 29, 2017 Report Share Posted November 29, 2017 13 minutes ago, LeonardIGO4036 said: Simply hover over the heart icon below. slide to the left and press the "thanks" icon. Thank you once again:) Gotcha.. thanks again Quote Link to comment Share on other sites More sharing options...
Heritage1 Posted February 22, 2018 Report Share Posted February 22, 2018 I've made some minor changes, all I did was delete the "s" off of ; $lastbid-> on all of them, and worked perfectly. I actually added a page in the admin panel, but before I pasted the code to the page I did the following, after naming the page, "Upcoming Departures", ............click on the icon button that says source, then paste your code into the page, and click on public at the bottom of course also so everyone can see it, works nice, thanks gentlemen, been looking for this little code snippet ! below is the fixed code that was created into a page in the Admin Panel; It does work as an HTML file for me, I've got it pasted everywhere with it now, lol. Cheers, Jim Duh 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($lastbid 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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.