Jump to content
TB1

Upcoming Departures

Recommended Posts

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:

tanLwrL.png

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

xKQnG4O.png

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!

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

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 :)

  • Like 1

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites
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. 

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

Capture.png

<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 by LeonardIGO4036

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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 :D

  • Like 1

Share this post


Link to post
Share on other sites
On 28/11/2017 at 7:17 PM, LeonardIGO4036 said:

Glad that the code works :)
A like would be appreciated :D

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

Share this post


Link to post
Share on other sites
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 by LeonardIGO4036

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×