Jump to content

LAST 10 FLIGHTS IN HOME PAGE[SOLVED]


Guest
 Share

Recommended Posts

Hi!

For the map use this code:

change "5" to any number of flights you like ;)

	<?php
   	$flights = PIREPData::getRecentReportsByCount(5);                                                                  	
   	$string = "";
   	foreach($flights as $flight)
   	{   	
           	$string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
   	}                                                                   	
?>

<img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=650x360&PM=pemr:diamond7:red%2b%22%25I%22:red&PC=%230000ff" />

and for the flight board use this:

<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table width="100%">
  <tdead>
	<tr>
  	<td>Flight No</td>
  	<td">Departure</td>
  	<td>Arrival</td>
  	<td>Duration</td>
  	<td>Pilot</td>
  	<td>Status</td>
	</tr>
</tdead>
<tbody>

<?php

if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
 {
$pilotinfo = PilotData::getPilotData($pirep->pilotid);
$pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);

if($pirep->accepted == '0') $status = 'REJECTED';
if($pirep->accepted == '1') $status = 'ACCEPTED';
else $status = 'PENDING'; 
} 
?>
<tr>
<td><?php echo $pirep->code.$pirep->flightnum; ?></td>
<td><?php echo $pirep->depicao; ?></td>
<td><?php echo $pirep->arricao; ?></td>
<td><?php echo $pirep->flighttime; ?></td>
<td><?php echo $pilotinfo->firstname.' '.$pilotinfo->lastname; ?></td>
<td><?php

	if($pirep->accepted == PIREP_ACCEPTED)
		echo 'Accepted';
	elseif($pirep->accepted == PIREP_REJECTED)
		echo 'Rejected';
	elseif($pirep->accepted == PIREP_PENDING)
		echo 'Approval Pending';
	elseif($pirep->accepted == PIREP_INPROGRESS)
		echo 'Flight in Progress';

	?>
</td>
</tr>
<?php
 }}
else
{
echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
  </tbody>
</table>

  • Like 2
Link to comment
Share on other sites

 if($pirep->accepted == PIREP_ACCEPTED)
                       echo '<span style="color:#whatever">Accepted</span>';
               elseif($pirep->accepted == PIREP_REJECTED)
                       echo '<span style="color:#whatever">Rejected</span>';
               elseif($pirep->accepted == PIREP_PENDING)
                       echo '<span style="color:#whatever">Approval Pending</span>';
               elseif($pirep->accepted == PIREP_INPROGRESS)
                       echo '<span style="color:#whatever">Flight in Progress</span>';

That's a quick and dirty way, you would just set the whatever to a valid hex colour value. You would be better applying classes to the spans, and set the attributes in your CSS stylesheet.

Something like this:

 if($pirep->accepted == PIREP_ACCEPTED)
                       echo 'span class="accept">Accepted</span>';
               elseif($pirep->accepted == PIREP_REJECTED)
                       echo '<span class="reject">Rejected</span>';
               elseif($pirep->accepted == PIREP_PENDING)
                       echo '<span class="pending">Approval Pending</span>';
               elseif($pirep->accepted == PIREP_INPROGRESS)
                       echo '<span class="inprog">Flight in Progress</span>';

Then in your CSS:

.reject {color:#whatever}
.accept {color:#whatever}
.pending {color:#whatever}
.inprog {color:#whatever}

It's always best to use the CSS stylesheet to apply styling, as it makes life much easier.

Link to comment
Share on other sites

To point out another thing you can also do if you change the background to a darker color, is to change the text color of the text in that box (or whole table if you want) by using this code:

<font color="#FFFFFF">Your Text</font>

The #FFFFFF is the color white. If you'd like to use any other color, try looking at this link: External Link

Link to comment
Share on other sites

  • 9 months later...
  • 3 months later...
  • 1 year later...

I got this Error

PHP Error Message

Warning: Invalid argument supplied for foreach() in /home/a7590429/public_html/lib/skins/brilliancev1/frontpage_main.tpl on line 85

Try copy this

 <?php
		 $flights = PIREPData::getRecentReportsByCount(10); < ---------------------- insert at your choise (10)
		 $string = "";
		 foreach($flights as $flight)
		 {	
						 $string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
		 }																																	
?>
<style type="text/css">
#tabledlist {
color: #7d3200;
}
</style>

<img src="http://www.gcmap.com/map?P=<?php echo $string ?>&MS=bm&MR=240&MX=650x300&PM=pemr:diamond7:red%2b%22%25I%22:red&PC=%230000ff" />
<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table id="tabledlist" class="tablesorter" width="100%" border = "1">
<thead>
 <tr>
 <th bgcolor="#7d3200"><font color="#FFFFFF">Flight</font></th>
 <th bgcolor="#7d3200"><font color="#FFFFFF">Departure</font></th>
 <th bgcolor="#7d3200"><font color="#FFFFFF">Arrival</font></th>
 <th bgcolor="#7d3200"><font color="#FFFFFF">Duration</font></th>
 <th bgcolor="#7d3200"><font color="#FFFFFF">Pilot</font></th>
 <th bgcolor="#7d3200"><font color="#FFFFFF">Status</font></th>
 </tr>
 </tdead>
 <tbody>

<?php
if(count($pireps) > 0)
{
foreach ($pireps as $pirep)
{
{
 $pilotinfo = PilotData::getPilotData($pirep->pilotid);
 $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);

 if($pirep->accepted == '0') $status = 'REJECTED';
 if($pirep->accepted == '1') $status = 'ACCEPTED';
 else $status = 'PENDING';
}
?>
 <tr>
 <td><?php echo $pirep->code.$pirep->flightnum; ?></td>
 <td><?php echo $pirep->depicao; ?></td>
 <td><?php echo $pirep->arricao; ?></td>
 <td><?php echo $pirep->flighttime; ?></td>
 <td><?php echo $pilotinfo->firstname.' '.$pilotinfo->lastname; ?></td>
 <td><?php

		 if($pirep->accepted == PIREP_ACCEPTED)
				 echo 'Accepted';
		 elseif($pirep->accepted == PIREP_REJECTED)
				 echo 'Rejected';
		 elseif($pirep->accepted == PIREP_PENDING)
				 echo 'Approval Pending';
		 elseif($pirep->accepted == PIREP_INPROGRESS)
				 echo 'Flight in Progress';

		 ?>
 </td>
 </tr>
 <?php
}}
else
{
 echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
</tbody>
</table>

Bye

Edited by simonecatalano
Link to comment
Share on other sites

  • 5 years later...

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

×
×
  • Create New...