Jump to content

Help needed for the last 5 Flights


Industrialshadow

Recommended Posts

Good Evening

I need a little help for my Pireps count.

I need a function on this where i can see if the pirep accepted or rejected or pending. Can anybody help ?

thats my code currently in the frontpage_main

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
			    <div class="art-content">

						    <h2 align="center" class="art-PostHeaderIcon-wrapper">
							    <div class="clean-welcome"> <?php $newpilot = PilotData::getLatestPilots(1); ?>

	  Welcome Lausitz Aircargo Newest Pilot:
		    <?php
			    foreach ($newpilot as $pilot)
						    {
							    echo $pilot->firstname.' '.$pilot->lastname.' ('.PilotData::getPilotCode($pilot->code, $pilot->pilotid).')';
						    }
		    ?>
    </div>
				  </h2>

 <p align="center" style="font-size: 18px; color: #000; font-weight: bold;">Welcome</p>
 <p align="center">Nun ist es soweit. Wir haben jetzt auf das neue Design umgestellt und die Anpassungen vorgenommen.Aber einiges gibt es noch zu tun. Aber das gute daran ist man kann wieder Flüge absolvieren.Kleinere Dinge wie das Pilotencenter werden wir noch bearbeiten</p>
 <p align="center"> </p>
 <p align="center"><a href="http://www.lausitz-aircargo.de/index.php/pages/join" target="_parent"><img src="http://www.lausitz-aircargo.de/lib/skins/bluelight/images/join.png" width="264" height="162" /></a></p>
 <p align="center"><?php
// Show the News module, call the function ShowNewsFront
// This is in the modules/Frontpage folder

MainController::Run('News', 'ShowNewsFront', 1);
?></p>
 <p align="center"><?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
 <div align="center">
 <table align="center" border="0" width="90%">
   <thead>
  <tr border="0">
    <th align="center" background='images/tables/tableheading.png'> <font face='Verdana' size='2' color="#000000">Pilot</font></th>
    <th align="center" background='images/tables/tableheading.png'> <font face='Verdana' size='2' color="#000000">Airline</font></th>
    <th align="center" background='images/tables/tableheading.png'> <font face='Verdana' size='2' color="#000000">Flight #</font></th>
    <th align="center" background='images/tables/tableheading.png'> <font face='Verdana' size='2' color="#000000">Origin</font></th>
    <th align="center" background='images/tables/tableheading.png'> <font face='Verdana' size='2' color="#000000">Arrival</font></th>
    <th align="center" background='images/tables/tableheading.png'> <font face='Verdana' size='2' color="#000000">Landing Rate</font></th>
    </tr>
  </thead>
   <tbody>
  <?php
if(count($pireps) > 0)
{
 foreach ($pireps as $pirep)
 {
   $pilotinfo = PilotData::getPilotData($pirep->pilotid);
   $pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
   echo "<tr>";
   echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000> $pirep->firstname $pirep->lastname </font></td>";
   echo '<td align=center width=120px bgcolor=#fff><a href="'.fileurl('/index.php/pireps/viewreport/'.$pirep->pirepid.'').'"><img src="'.fileurl('/images/airline/'.$pirep->code.'.gif').'" alt="'.$airline->name.'" width="127px" height="32px" /></a></td>';
   echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000> $pirep->code  $pirep->flightnum </font></td>";
   echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000> $pirep->depname </font></td>";
   echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000> $pirep->arrname </font></td>";
   echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000> $pirep->landingrate ft/min</font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td>There are no recent flights!</td></tr>";
}
?>

  </tbody>
 </table></p>
 </div>
 <p align="center"></p>
 <div align="center">
   <table width="600" border="0">
  <tr>
    <td><?php $query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC";
$list = DB::get_results($query);
echo '<h3>Upcoming Departures - Current Time is '.date('G:i').'</h3>';
echo '<table width="100%" border="0">';
echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Departure Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>';
$count = 3;
foreach($list as $flight)
{
		    if(date('G:i') >= '23')
		    {$time = '0';}
		    else
		    {$time = date('G:i');}
						    if(($flight->deptime + 0) > $time)
						    {
		    if($count < 10)
		    {
						    $aircraft = OperationsData::getAircraftInfo($flight->aircraft);
						    echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->deptime.'</td><td>'.$aircraft->fullname.'</td>';
						    echo '<td>';
						    if(($flight->deptime - date('G:i')) <= 1)
						    {
						    echo '<a href="http://www.gifmix.de/gifs/" target="_blank" title="Gifs"><img src="http://www.industrialshadow.de/lausitzair/lib/skins/bluelight/images/dots_blink.gif" border="0" alt="Gifs"></a>';
						    }

  else
						    {
						    echo '<a href="http://www.gifmix.de/gifs/" target="_blank" title="Gifs"><img src="http://www.industrialshadow.de/lausitzair/lib/skins/bluelight/images/dots_yellow.gif" border="0" alt="Gifs"></a>';
						    }
						    echo '</td></tr>';
						    $count++;
		    }
		    }
}
echo '</table>';
echo '<h3>Upcoming Arrivals - Current Time is '.date('G:i').'</h3>';
echo '<table width="100%" border="0">';
echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Arrival Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>';
$count = 3;
foreach($list as $flight)
{
		    if(date('G:i') >= '23')
		    {$time = '0';}
		    else
		    {$time = date('G:i');}
						    if(($flight->arrtime + 0) > $time)
						    {
		    if($count < 10)
		    {
						    $aircraft = OperationsData::getAircraftInfo($flight->aircraft);
						    echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->fullname.'</td>';
						    echo '<td>';
						    if(($flight->arrtime - date('G:i')) <= 1)
						    {
						    echo '<a href="http://www.gifmix.de/gifs/" target="_blank" title="Gifs"><img src="http://www.industrialshadow.de/lausitzair/lib/skins/bluelight/images/dots_yellow.gif" border="0" alt="Gifs"></a>';
						    }
						    else
						    {
						    echo '<a href="http://www.gifmix.de/gifs/" target="_blank" title="Gifs"><img src="http://www.industrialshadow.de/lausitzair/lib/skins/bluelight/images/dots_blink.gif" border="0" alt="Gifs"></a>';
						    }
						    echo '</td></tr>';
						    $count++;
		    }
		    }
}
echo '</table>';?></td>
  </tr>
   </table>
 </div>
 <p align="center"></p>
<p align="center">
 <div align="center">
 <p><strong>Newest Screenshot</strong></p>
   <table width="200" border="1">
   <tr>
  <td><?php Screenshots::show_newest_screenshot(); ?></td>
  </tr>
 </table>
 </p>

   <table width="497" border="0">
  <tr>
    <td width="161"><a href="<?php echo url('/finances'); ?>" target="_parent"><img src="http://www.industrialshadow.de/lausitzair/lib/skins/bluelight/images/finance.png" width="160" height="121" /></a></td>
    <td width="161"><a href="<?php echo url('/contact'); ?>" target="_parent"><img src="http://www.industrialshadow.de/lausitzair/lib/skins/bluelight/images/contact.png" width="160" height="121" /></a></td>
    <td width="161"><a href="<?php echo url('/Fleet'); ?>"><img src="http://www.industrialshadow.de/lausitzair/lib/skins/bluelight/images/Fleet.png" width="160" height="121" /></a></td>
  </tr>
  <tr>
    <td><div align="center">Finances</div></td>
    <td><div align="center">Contact us</div></td>
    <td><div align="center">Fleet</div></td>
  </tr>
   </table>
 </div>
</div>

Link to comment
Share on other sites

  • Moderators

First you need to add a column for the status like this:

<th align="center" background='images/tables/tableheading.png'> <font face='Verdana' size='2' color="#000000">Status</font></th>

Then inside the foreach() for PIREPS you need this:

if($pirep->accepted == PIREP_ACCEPTED)

echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000>Accepted</font></td>";
			elseif($pirep->accepted == PIREP_REJECTED)

echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000>Rejected</font></td>";
			elseif($pirep->accepted == PIREP_PENDING)

echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000>Pending</font></td>";
			elseif($pirep->accepted == PIREP_INPROGRESS)

echo "<td align=center background='images/tables/board.png'> <font face=Verdana size=2 color=#000000>In Progress</font></td>";

  • Like 1
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...