Jump to content

How to Show Airline Logo on Flight Stats? [SOLVED]


SkilledPilotA320

Recommended Posts

  • Moderators

Okay. Where do you use the $airline->icao? You gotta have something like below:

<?php
$airlines = OperationsData::getAllairlines();
foreach($airlines as $airline)
{
?>
<img src="<?php echo fileurl('/lib/images/airlines/'.$airline->icao.'.gif'); ?>" alt="<?php echo $airline->name;?>" />
<?php
}
?>

Link to comment
Share on other sites

Bro, its still not working :(

Check whether my code is correct :)

<META HTTP-EQUIV="refresh" CONTENT="30">
<div style="position:relative"><h1>Flight Stats</h1>
<p style="text-align: right; position:absolute; right:5px;top:0;"><strong>Share</strong><span  class='st_blogger' ></span><span  class='st_twitter' ></span><span  class='st_facebook' ></span><span  class='st_yahoo' ></span><span  class='st_email' ></span></p>
</div>
<img alt="" border="1" height="136" src="http://www.airindiavirtual.com/images/flightstats_pg.jpg" width="950" /></p>

<h3>
Live Flight Departure/Arrival Board</h3>
<table width="100%" cellspacing="0" cellpadding="4">
<tr class="title-row">
   <th width="105">Airline</th>
   <th width="77">
  Flight #</th>
   <!--<img src="http://airindiavirtual.com/lib/skins/aivirtual/images/logo.png"><th width="50" " height="22" background="" class="style1"><span class="tablesorterBIS">
  <div align="center">
  Aircraft</span></th>-->
   <th width="200">Depart</th>
   <th width="200">Arrival</th>
   <th width="80">Status</th>
 </tr>
<?php $rowCounter = 1; ?>
<?php
$results = ACARSData::GetACARSData();
if (count($results) > 0)
  {
  foreach($results as $row)
  {
	 $font = "<font color=''>";  // Standard font color if nothing below is TRUE
	 if($row->phasedetail == 'Boarding') $font = "<font color='#2ba600'>";  //This should set the font color to red when Taxiing.
	 if($row->phasedetail == 'Landed') $font = "<font color='#FFBF00'>";  //This should set the font color to red when Taxiing.
	 if($row->phasedetail == 'En Route')  $font = "<font color='#2A7F00'>";  //This should set the font color to green when Cruise.
	 if($row->phasedetail == 'Departed') $font = "<font color='#FF0000'>";  //This should set the font color to red when Taxiing.
	 if($row->phasedetail == 'Approach')  $font = "<font color='#690d0d'>";  //This should set the font color to green when Cruise.
	 if($row->phasedetail == 'Arrived') $font = "<font color='#e13838'>";  //This should set the font color to red when Taxiing.
																		   // You can add more checks here for whatever you wish
	 ?>
  <tr class="listingTable <?php if( ($rowCounter % 2) == 0 ){ echo ' evenCol'; } $rowCounter++; ?>">
	  <td align="center"><img src="<?php echo fileurl('/lib/images/airlines/'.$airline->icao.'.gif'); ?>" alt="<?php echo $airline->name;?>" /></td>
	  <td align="center"><?php echo $row->flightnum;?></td>
	  <!--<td align="center"><?php echo $row->aircraftname;?></td>-->
	  <td align="center"><?php echo $row->depname;?></td>
	  <td align="center"><?php echo $row->arrname;?></td>
	  <td align="center"><?php echo $font.$row->phasedetail;?></td>
  </tr>
  <?php
  }
  }
?>
 </table>
 <?php
if(!$results)
{
echo '<p align="center">No Online Flights Scheduled!</p>';
return;
}
?>

Link to comment
Share on other sites

  • Moderators

Try this:

<META HTTP-EQUIV="refresh" CONTENT="30">
<div style="position:relative"><h1>Flight Stats</h1>
<p style="text-align: right; position:absolute; right:5px;top:0;"><strong>Share</strong><span  class='st_blogger' ></span><span  class='st_twitter' ></span><span  class='st_facebook' ></span><span  class='st_yahoo' ></span><span  class='st_email' ></span></p>
</div>
<img alt="" border="1" height="136" src="http://www.airindiavirtual.com/images/flightstats_pg.jpg" width="950" /></p>
<h3>
Live Flight Departure/Arrival Board</h3>
<table width="100%" cellspacing="0" cellpadding="4">
<tr class="title-row">
    <th width="105">Airline</th>
    <th width="77">
	  Flight #</th>
    <!--<img src="http://airindiavirtual.com/lib/skins/aivirtual/images/logo.png"><th width="50" " height="22" background="" class="style1"><span class="tablesorterBIS">
	  <div align="center">
	  Aircraft</span></th>-->
    <th width="200">Depart</th>
    <th width="200">Arrival</th>
    <th width="80">Status</th>
 </tr>
<?php $rowCounter = 1; ?>
<?php
$results = ACARSData::GetACARSData();
if (count($results) > 0)
  {
  foreach($results as $row)
	  {
			 $font = "<font color=''>";  // Standard font color if nothing below is TRUE
			 if($row->phasedetail == 'Boarding') $font = "<font color='#2ba600'>";  //This should set the font color to red when Taxiing.
			 if($row->phasedetail == 'Landed') $font = "<font color='#FFBF00'>";  //This should set the font color to red when Taxiing.
			 if($row->phasedetail == 'En Route')  $font = "<font color='#2A7F00'>";  //This should set the font color to green when Cruise.
			 if($row->phasedetail == 'Departed') $font = "<font color='#FF0000'>";  //This should set the font color to red when Taxiing.
			 if($row->phasedetail == 'Approach')  $font = "<font color='#690d0d'>";  //This should set the font color to green when Cruise.
			 if($row->phasedetail == 'Arrived') $font = "<font color='#e13838'>";  //This should set the font color to red when Taxiing.
																																					   // You can add more checks here for whatever you wish
			 ?>
	  <tr class="listingTable <?php if( ($rowCounter % 2) == 0 ){ echo ' evenCol'; } $rowCounter++; ?>">
			  <td align="center">
  <?php
$airlines = OperationsData::getAllAirlines();
foreach($airlines as $airline)
{
?>
<img src="<?php echo fileurl('/lib/images/airlines/'.$airline->icao.'.gif'); ?>" alt="<?php echo $airline->name;?>" />
<?php
}
?></td>
			  <td align="center"><?php echo $row->flightnum;?></td>
			  <!--<td align="center"><?php echo $row->aircraftname;?></td>-->
			  <td align="center"><?php echo $row->depname;?></td>
			  <td align="center"><?php echo $row->arrname;?></td>
			  <td align="center"><?php echo $font.$row->phasedetail;?></td>
	  </tr>
	  <?php
	  }
  }
?>
 </table>
 <?php
if(!$results)
{
echo '<p align="center">No Online Flights Scheduled!</p>';
return;
}
?>

Link to comment
Share on other sites

  • Moderators

Using explode() function, you have to separate the string (CPC) from (CPC1234) which is the flight number in ACARS data and then say if this string is equal to the airline code show the image. That's the only way you can show the image on live flights for each flight. Otherwise the image will not show or shows as many airline's logo as you have.

Link to comment
Share on other sites

  • Moderators

Okay try this. It's tested and working:

<META HTTP-EQUIV="refresh" CONTENT="30">
<div style="position:relative"><h1>Flight Stats</h1>
<p style="text-align: right; position:absolute; right:5px;top:0;"><strong>Share</strong><span class='st_blogger' ></span><span class='st_twitter' ></span><span class='st_facebook' ></span><span class='st_yahoo' ></span><span class='st_email' ></span></p>
</div>
<img alt="" border="1" height="136" src="http://www.airindiavirtual.com/images/flightstats_pg.jpg" width="950" /></p>
<h3>
Live Flight Departure/Arrival Board</h3>
<table width="100%" cellspacing="0" cellpadding="4">
<tr class="title-row">
<th width="105">Airline</th>
<th width="77">
Flight #</th>
<!--<img src="http://airindiavirtual.com/lib/skins/aivirtual/images/logo.png"><th width="50" " height="22" background="" class="style1"><span class="tablesorterBIS">
<div align="center">
Aircraft</span></th>-->
<th width="200">Depart</th>
<th width="200">Arrival</th>
<th width="80">Status</th>
</tr>
<?php $rowCounter = 1; ?>
<?php
$results = ACARSData::GetACARSData();
if (count($results) > 0)
{
foreach($results as $row)
{
$font = "<font color=''>"; // Standard font color if nothing below is TRUE
if($row->phasedetail == 'Boarding') $font = "<font color='#2ba600'>"; //This should set the font color to red when Taxiing.
if($row->phasedetail == 'Landed') $font = "<font color='#FFBF00'>"; //This should set the font color to red when Taxiing.
if($row->phasedetail == 'En Route') $font = "<font color='#2A7F00'>"; //This should set the font color to green when Cruise.
if($row->phasedetail == 'Departed') $font = "<font color='#FF0000'>"; //This should set the font color to red when Taxiing.
if($row->phasedetail == 'Approach') $font = "<font color='#690d0d'>"; //This should set the font color to green when Cruise.
if($row->phasedetail == 'Arrived') $font = "<font color='#e13838'>"; //This should set the font color to red when Taxiing.
// You can add more checks here for whatever you wish
?>
<tr class="listingTable <?php if( ($rowCounter % 2) == 0 ){ echo ' evenCol'; } $rowCounter++; ?>">
<td align="center">
<?php
$code = substr($row->flightnum, 0,3);
?>
<img src="<?php echo fileurl('/lib/images/airlines/'.$code.'.gif'); ?>" alt="<?php echo $airline->name;?>" />
</td>
<td align="center"><?php echo $row->flightnum;?></td>
<!--<td align="center"><?php echo $row->aircraftname;?></td>-->
<td align="center"><?php echo $row->depname;?></td>
<td align="center"><?php echo $row->arrname;?></td>
<td align="center"><?php echo $font.$row->phasedetail;?></td>
</tr>
<?php
}
}
?>
</table>
<?php
if(!$results)
{
echo '<p align="center">No Online Flights Scheduled!</p>';
return;
}
?>

Screenshot:

Live.png

  • Like 1
Link to comment
Share on other sites

  • Moderators

I did the same with substr on my site and that works great.

<?php $airlinecode = substr($row->flightnum, 0,2); ?>

<img src="<?php echo fileurl('/lib/images/airlines/'.$airlinecode.'.gif'); ?>" alt="<?php echo $airline->name;?>" />

Yep. ;)

Link to comment
Share on other sites

Now, I just wanted to add this to my existing acarsmap.tpl file, but it doesn't work. I see Air India did it on a SEPARATE page; but I wanted it on the acarsmap page. I added a:

<td><b>Airline</b></td>

for the heading and then added:

<?php
$code = substr($row->flightnum, 0,2);
?>
<td><img src="<?php echo fileurl('/lib/skins/cpc/images/airlines/'.$code.'.gif'); ?>" alt="<?php echo $airline->name;?>" />
</td>

above the pilotID info section, but did not work.

http://www.canadianc...index.php/acars

Link to comment
Share on other sites

  • 8 months later...

To multiple airlines, is possible with this data from core/modules/Acars.php?

Could be $flight->pilotcode instead of $flight->flightnum?

public function data()
{
$flights = ACARSData::GetACARSData();

if(!$flights)
$flights = array();

$this->acarsflights = array();
foreach($flights as $flight)
{
if($flight->route == '')
{
$flight->route_details = array();
}
else
{
$flight->route_details = NavData::parseRoute($flight->route);
}

$c = (array) $flight; // Convert the object to an array

$c['pilotid'] = PilotData::[color=#b22222][u][b]GetPilotCode($c['code'][/b][/u][/color], $c['pilotid']);

// Normalize the data
if($c['timeremaining'] == '')
{
$c['timeremaining'] == '-';
}

if(trim($c['phasedetail']) == '')
{
$c['phasedetail'] = 'Enroute';
}

/* If no heading was passed via ACARS app then calculate it

P.D: I get it: :D

<?php
$code = substr($flight->code, 0,3);
?>
<img src="<?php echo fileurl('/lib/skins/templatemo_254_agency/images/airlines/'.$code.'.png'); ?>" alt="<?php echo $airline->name;?>" />

Edited by ARV187
Link to comment
Share on other sites

  • 9 months later...

I know this is an old post, I ran into a problem. Nothing I do will work. All I get is a broken image. Right click the broken image and I get.

http://www.flyaka.com/images/airline/.png

I have tried every code that was posted on this page, nothing. Any help would be appreciated.

Link to comment
Share on other sites

  • 5 years later...

this work for me in profile_main.php Departure Board

I  put photo in /lib/images/airline/ (ROT.png, etc)

<?php $code = substr($lastbid->code, 0,3); ?>
                                    <td><img src="<?php echo fileurl('/lib/images/airline/'.$code.'.png'); ?>" alt="<?php echo $airline->name;?>" width="70" height="35" /></td>

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