Jump to content

Live Flight Board Airlines Display [SOLVED]


Curshad

Recommended Posts

Hey guys in the Airline coloumn of my Live flight board on my home page @ http://skyabahamasvirtual.net

I have and image there to display when a SBM flight is flown here is the code

<table style="border:1px solid grey;" cellspacing="2" cellpadding="2" bgcolor="#171717">
<tr>
<th align="center" style="background-color: #171717; width: 3.5%;"> </th>
<th width="10%" align="center" style="background-color: #171717;">Airline</th>
<th width="10%" align="center" style="background-color: #171717;">Flight</th>
<th width="30%" align="center" style="background-color: #171717;">Departure</th>
<th width="30%" align="center" style="background-color: #171717;">Arrival</th>
<th width="5%" align="center" style="background-color: #171717;">Aircraft</th>
<th width="18.5%" align="center" style="background-color: #171717;">Status</th>
</tr>
<?php
$results = ACARSData::GetACARSData();
if (count($results) > 0)
{
foreach($results as $flight)
 {

	 ?>
 <tr>
	 <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src=''>"; } ?></td>
	 <td align="center"><img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35" alt="<?php echo $airline->name;?>" /></td>
	 <td align="center"><?php echo $flight->flightnum;?></td>
	 <td align="center"><?php echo $flight->depname;?></td>
	 <td align="center"><?php echo $flight->arrname;?></td>
	 <td align="center"><?php echo $flight->aircraftname;?></td>
	 <td align="center"><?php if($flight->phasedetail
!= 'Paused') { echo $flight->phasedetail; }
else { echo "Cruise"; }?></font></td>
 </tr>
<?php		
		 }
	 } else { ?>
		 <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #3399FF;">No Flights in Progress!</td></tr>
	 <?php
	 }
	 ?>
</table>

I have another airline added in the admin center of PHPVMS. That airline is Silver Airways.

I want my flight board to display this image

silver-airways.jpg

in the airline coloumn of the Live Flight Board when a SIL flight is flown.

Would this be the correct coding do such a thing? Without removing SBM image?

or in other words If i fly an SBM flight the airline colomun displays this image

200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg

and if someone else flys a SIL flight the same time i Fly an SBM flight it displays both Sky Bahamas and Silver Airways image

again is this the correct coding to do such a thing?

	 <td align="center"><img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35" alt="<?php echo $airline->name;?>" /><img src="http://www.juergenbaumbusch.de/wp-content/uploads/2013/06/silver-airways.jpg" width="120" height="35" alt="<?php echo $airline->name;?>" /></td>

AND OR

	 <td align="center"><img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35" alt="<?php echo $airline->name;?>" /><img src="http://www.juergenbaumbusch.de/wp-content/uploads/2013/06/silver-airways.jpg" width="120" height="35" alt="Silver Airways" /></td>

Link to comment
Share on other sites

You should create a simple if statement:

<?php
if($flight->code == 'SIL')
{echo 'the image you want to display for SIL flights';}
elseif($flight->code == 'SBM')
{echo 'the image you want to display for SBM flights';} ?>

So now the Code should be:

<table style="border:1px solid grey;" cellspacing="2" cellpadding="2" bgcolor="#171717">
 <tr>
    <th align="center" style="background-color: #171717; width: 3.5%;"> </th>
    <th width="10%" align="center" style="background-color: #171717;">Airline</th>
    <th width="10%" align="center" style="background-color: #171717;">Flight</th>
    <th width="30%" align="center" style="background-color: #171717;">Departure</th>
    <th width="30%" align="center" style="background-color: #171717;">Arrival</th>
    <th width="5%" align="center" style="background-color: #171717;">Aircraft</th>
    <th width="18.5%" align="center" style="background-color: #171717;">Status</th>
</tr>
<?php
$results = ACARSData::GetACARSData();
if (count($results) > 0)
  {
  foreach($results as $flight)
	  {

			 ?>
	  <tr>
			  <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src=''>"; } ?></td>
			  <td align="center"><?php
if($flight->code == 'SIL')
{echo 'the image you want to display for SIL flights';}
elseif($flight->code == 'SBM')
{echo 'the image you want to display for SBM flights';} ?></td>
			  <td align="center"><?php echo $flight->flightnum;?></td>
			  <td align="center"><?php echo $flight->depname;?></td>
			  <td align="center"><?php echo $flight->arrname;?></td>
			  <td align="center"><?php echo $flight->aircraftname;?></td>
			  <td align="center"><?php if($flight->phasedetail
    != 'Paused') { echo $flight->phasedetail; }
    else { echo "Cruise"; }?></font></td>
	  </tr>
 <?php		 
						    }
				    } else { ?>
						    <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #3399FF;">No Flights in Progress!</td></tr>
				    <?php
				    }
				    ?>
</table>

Correct me if Im wrong.

Link to comment
Share on other sites

Didnt notice any change. the Image loaded but no change in image....

  <tr>
	  <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src=''>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src=''>"; } ?></td>
	  <td align="center"><?php
if($flight->code == 'SIL')
{echo '<img src="http://www.juergenbaumbusch.de/wp-content/uploads/2013/06/silver-airways.jpg" width="120" height="35"/>';}
elseif($flight->code == 'SBM')
{echo '<img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35"/>';} ?></td>
	  <td align="center"><?php echo $flight->flightnum;?></td>
	  <td align="center"><?php echo $flight->depname;?></td>
	  <td align="center"><?php echo $flight->arrname;?></td>
	  <td align="center"><?php echo $flight->aircraftname;?></td>
	  <td align="center"><?php if($flight->phasedetail
   != 'Paused') { echo $flight->phasedetail; }
   else { echo "Cruise"; }?></font></td>
  </tr>

Link to comment
Share on other sites

No nothing worked. In my Flight Schedules and routes in admin center the Code is SIL and when i edit. SIL- Silver Airways for SBM is SBM - SkyBahamas Virtual

I dont get why code doesnt work.

i know i tried this and it worked

<?php if($flight->flightnum == "SIL3983") {echo "<img src='http://greenvillems.org/wp-content/uploads/2012/11/Silver-Logo.jpg' width='120' height='35'/>";} elseif($flight->flightnum == "SBM850") {echo "<img src='http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg' width='120' height='35'/>";} ?>

But that is not a legit fix....

Link to comment
Share on other sites

  • Administrators

The "getACARSData() function returns the pilot's code in the code object. The flight number is returned in whole as flightnum. you will have to trim the variable prior to matching it.

Something like:

<?php

$fcode = substr($flight->flightnum, 0, 3);

if($fcode == 'SIL')
{echo 'the image you want to display for SIL flights';}
elseif($fcode == 'SBM')
{echo 'the image you want to display for SBM flights';}

?>

The only catch is if you use another code that is not 3 digits, you would have to add another if loop to catch that.

Link to comment
Share on other sites

The "getACARSData() function returns the pilot's code in the code object. The flight number is returned in whole as flightnum. you will have to trim the variable prior to matching it.

Something like:

<?php

$fcode = substr($flight->flightnum, 0, 3);

if($fcode == 'SIL')
{echo 'the image you want to display for SIL flights';}
elseif($fcode == 'SBM')
{echo 'the image you want to display for SBM flights';}

?>

The only catch is if you use another code that is not 3 digits, you would have to add another if loop to catch that.

I see so i would have to list all numbers that would probably fit a flight number? or i would have to list all available Flight # that are in my schedule?

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

Hey simpilot myself and flyalaskava is have a touch time put this airline thing into the Latest flights board (for he pireps instead of live flights)

It's been over 5hrs and I give I thought i was onto something but then i got stuck

I did play around with it like i say and got the Airline image to load.

Here's what i have:

<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ocean_table">
    <tr>
		    <th>Airline</th> 
		    <th>Flight</th>
		    <th>Pilot</th>
		    <th>Departure</th>
		    <th>Arrival</th>
		    <th>Aircraft</th>
		    <th>Duration</th>
		    <th>V/S</th>
		    <th>Info</th>
</tr>
<?php
$results = ACARSData::GetACARSData();
if (count($results) > 0)
  {
  foreach($results as $pirep)
	  {

			 ?>
	  <tr>
			  <td align="center"><?php
$fcode = substr($pirep->flightnum, 0, 3);
if($fcode == 'SIL')
{echo '<img src="http://greenvillems.org/wp-content/uploads/2012/11/Silver-Logo.jpg" width="120" height="35"/>';}
elseif($fcode == 'SBM')
{echo '<img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35"/>';}
?></td>
			  <td align="center"><?php echo $pirep->flightnum;?></td>
			  <td align="center"><?php echo $pirep->depname;?></td>
			  <td align="center"><?php echo $pirep->arrname;?></td>
			  <td align="center"><?php echo $pirep->aircraftname;?></td>
			  <td align="center"><?php echo $pirep->landingrate;?>ft/m</td>
			  <td align="center"><?php if($pirep->accepted == PIREP_ACCEPTED)
echo '<td><span class="label label-important"><font color="green">Accepted</font></span></td>';
														    elseif($pirep->accepted == PIREP_REJECTED)
echo '<td><span class="label label-important"><font color="red">Rejected</font></span></td>';
														    elseif($pirep->accepted == PIREP_PENDING)
echo '<td><span class="label label-warning"><font color="orange">Pending</font></span></td>';
														    elseif($pirep->accepted == PIREP_INPROGRESS)
echo '<td>On Progress</td>'?></td>
	  </tr>
 <?php		 
						    }
				    } else { ?>
						    <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #3399FF;">No Flights in Progress!</td></tr>
				    <?php
				    }
				    ?>
</tbody>
</table>
<div class="clear"></div>
<div class="clear"></div>

But thats not working 1. it doesnt show last 10 pireps 2. some info isnt displaying. (the airline info displays but other info.. *fart sound*

Here is what i originally thought would work:

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ocean_table">
		    <tr>
						    <th>Airline</th>
						    <th>Flight</th>
						    <th>Pilot</th>
						    <th>Departure</th>
						    <th>Arrival</th>
						    <th>Aircraft</th>
						    <th>Duration</th>
						    <th>V/S</th>
						    <th>Info</th>
</tr>
<?php
if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
		    $pilotinfo = PilotData::getPilotData($pirep->pilotid);
		    $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
		    $acrid = OperationsData::getAircraftByReg($pirep->registration);
		    echo '<tr>';
		    echo '<td>' <?php
$fcode = substr($flight->flightnum, 0, 3);
if($fcode == 'SIL')
{echo '<img src="http://greenvillems.org/wp-content/uploads/2012/11/Silver-Logo.jpg" width="120" height="35"/>';}
elseif($fcode == 'SBM')
{echo '<img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35"/>';}
?>'</td>'
		    echo '<td><a href="'.SITE_URL.'/index.php/pireps/viewreport/'.$pirep->pirepid.'">'.$pirep->code.$pirep->flightnum.'</a></td>';
		    echo '<td><a href="'.SITE_URL.'/index.php/profile/view/'.$pilotinfo->pilotid.'">'.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</a></td>';
		    echo '<td>'.$pirep->depicao.'</td>';
		    echo '<td>'.$pirep->arricao.'</td>';
		    echo '<td>'.$pirep->aircraft.'</td>';
		    echo '<td>'.$pirep->flighttime.'</td>';
		    echo '<td>'.$pirep->landingrate.' ft/m</td>';
if($pirep->accepted == PIREP_ACCEPTED)
echo '<td><span class="label label-important"><font color="green">Accepted</font></span></td>';
																														    elseif($pirep->accepted == PIREP_REJECTED)
echo '<td><span class="label label-important"><font color="red">Rejected</font></span></td>';
																														    elseif($pirep->accepted == PIREP_PENDING)
echo '<td><span class="label label-warning"><font color="orange">Pending</font></span></td>';
																														    elseif($pirep->accepted == PIREP_INPROGRESS)
echo '<td>On Progress</td>';
		    echo '</tr>';
 }
}
else
{
		    echo '<tr><td>There are no recent flights!</td></tr>';
}
?>

My results 1374133_1490952177850212_990770146642430878_n.jpg?oh=47ccd3570ec507454fce1a3d30bf63e2&oe=54F3B85E&__gda__=1420531397_e0d78a9bbf7d381fec868a33e4bfb748

Link to comment
Share on other sites

I got all the info to work with this:

<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ocean_table">
    <tr>
		    <th>Airline</th> 
		    <th>Flight</th>
		    <th>Pilot</th>
		    <th>Departure</th>
		    <th>Arrival</th>
		    <th>Aircraft</th>
		    <th>Duration</th>
		    <th>V/S</th>
		    <th>Info</th>
</tr>
<?php
$pirep = ACARSData::GetACARSData();
if (count($pirep) > 0)
  {
  foreach($pirep as $pirep)
	  {
    $pilotinfo = PilotData::getPilotData($pirep->pilotid);
    $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
    $acrid = OperationsData::getAircraftByReg($pirep->registration);			   
			 ?>
	  <tr>
			  <td align="center"><?php
$fcode = substr($pirep->flightnum, 0, 3);
if($fcode == 'SIL')
{echo '<img src="http://greenvillems.org/wp-content/uploads/2012/11/Silver-Logo.jpg" width="120" height="35"/>';}
elseif($fcode == 'SBM')
{echo '<img src="http://tblocations-airlinelogores.s3.amazonaws.com/200-75-4c3f16e6579e2-sky-bahamas-google-chrome-15-7-2010-160848-bmp.jpg" width="120" height="35"/>';}
?></td>
			  <td align="center"><?php echo $pirep->flightnum;?></td>
			  <td align="center"><?php echo '<a href="'.SITE_URL.'/index.php/profile/view/'.$pilotinfo->pilotid.'">'.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</a>';?></td>
			  <td align="center"><?php echo $pirep->depname;?></td>
			  <td align="center"><?php echo $pirep->arrname;?></td>
			  <td align="center"><?php echo $pirep->aircraftname;?></td>
			  <td align="center"><?php echo $pirep->flighttime;?></td>
			  <td align="center"><?php echo $pirep->landingrate;?>ft/m</td>
			  <td align="center"><?php if($pirep->accepted == PIREP_ACCEPTED)
echo '<span class="label label-important"><font color="green">Accepted</font></span>';
														    elseif($pirep->accepted == PIREP_REJECTED)
echo '<span class="label label-important"><font color="red">Rejected</font></span>';
														    elseif($pirep->accepted == PIREP_PENDING)
echo '<span class="label label-warning"><font color="orange">Pending</font></span>';
														    elseif($pirep->accepted == PIREP_INPROGRESS)
echo 'On Progress'?></td>
	  </tr>
 <?php		 
						    }
				    } else { ?>
						    <tr><td width="20%" align="center" colspan="6" style="padding: 5px; font-size: 13px; font-weight: bold; color: #3399FF;">No Flights in Progress!</td></tr>
				    <?php
				    }
				    ?>
</tbody>
</table>
<div class="clear"></div>
<div class="clear"></div>

My only issue now is the new of pireps to show up currently only one is showing up.

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...