Jump to content

Recommended Posts

Posted

Hello All

Can you guys please check the codes of the following as I think that there is some problem with my codes.

LIVE FLIGHT BOARD

Problem that i am facing is that when there are no live flights the message 'there are currently no live flights' does NOT display properly.

<style type="text/css">
<!--
th {
color: #ff8710;

font-weight: bolder;

}
td {
color: #ff961e;


font-weight: normal;
}
-->
</style>
<h2>Flight Departures Board</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
 <tr>
   <th align="center" style="background-color: #171717; width: 3.5%;"> </th>
   <th width="5%" align="center" style="background-color: #171717;">Flight</th>
   <th width="20%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="25%" align="center" style="background-color: #171717;">Departure</th>
   <th width="25%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="10%" 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='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_blink.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "Taxiing to Runway") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_yellow.gif'>"; } ?></td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>/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 align="center">No Flights in Progres</td></tr>
           <?php
           }
           ?>
</table>

RECENT FLIGHTS BOARD

Problem: The status of this board i.e ACCEPTED , REJECTED , PENDIMG does not work properly.

<center><h2>Recent Arrivals</center></h>
<table align="center" border="0" width="605px">
</table>
<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
  <thead>
    <tr>
   <th width="7%" 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="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</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); 

   if($pirep->accepted == '0') $status = 'REJECTED';
   if($pirep->accepted == '1') $status = 'ACCEPTED';
   else $status = 'PENDING'; 

   echo "<tr>";
   echo "<td align=center   bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->depname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->arrname </font></td>";
   echo "<td align=center   bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->landingrate </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->aircraft </font></td>";
   echo "<td align=center    bgcolor=#171717> $status </font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>

Please if someone could check my codes and tell me whats wrong in them.

Thanks A lot

Posted

<!--
th {
color: #ff8710;

font-weight: bolder;

}
td {
color: #ff961e;


font-weight: normal;
}
-->
</style>
<h2>Flight Departures Board</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
 <tr>
   <th align="center" style="background-color: #171717; width: 3.5%;"> </th>
   <th width="5%" align="center" style="background-color: #171717;">Flight</th>
   <th width="20%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="25%" align="center" style="background-color: #171717;">Departure</th>
   <th width="25%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="10%" align="center" style="background-color: #171717;">Status</th>
</tr>

<?php

$results = ACARSData::GetACARSData();

if (!$results){ ?>
<tr> <td align="center">No Flights in Progress</td></tr>
<?php } else {
  foreach($results as $flight){ ?>
     <tr>
         <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_blink.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "Taxiing to Runway") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_yellow.gif'>"; } ?></td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>/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"; }?></td>
     </tr>
<?php          
               }
           } ?>
</table>

Try that maybe?

P.S. (This is probably more to the person who originally wrote the code because I'm sure it's in the snippets forum) Stop using <font> it's so outdated.

P.P.S. 'Alot' -> 'a lot' ;)

Posted

<!--
th {
color: #ff8710;

font-weight: bolder;

}
td {
color: #ff961e;


font-weight: normal;
}
-->
</style>
<h2>Flight Departures Board</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
 <tr>
   <th align="center" style="background-color: #171717; width: 3.5%;"> </th>
   <th width="5%" align="center" style="background-color: #171717;">Flight</th>
   <th width="20%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="25%" align="center" style="background-color: #171717;">Departure</th>
   <th width="25%" align="center" style="background-color: #171717;">Arrival</th>
   <th width="15%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="10%" align="center" style="background-color: #171717;">Status</th>
</tr>

<?php

$results = ACARSData::GetACARSData();

if (!$results){
  foreach($results as $flight){ ?>
     <tr>
         <td align="center"><?php if($flight->phasedetail == "Boarding") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_blink.gif'>"; } elseif($flight->phasedetail == "Arrived") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "Taxiing to Runway") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots.gif'>"; } elseif($flight->phasedetail == "On Approach") { echo "<img style='padding-left:3px;' src='http://pias.waleeddc.com/lib/skins/PIAvirtual/images/dots_yellow.gif'>"; } ?></td>
         <td align="center"><?php echo $flight->flightnum;?></td>
         <td align="center"><?php echo $flight->pilotname;?></td>/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"; }?></td>
     </tr>
<?php          
               }
           } else { ?>
               <tr> <td align="center">No Flights in Progress</td></tr>
           <?php
           }
           ?>
</table>

Try that maybe?

P.S. (This is probably more to the person who originally wrote the code because I'm sure it's in the snippets forum) Stop using <font> it's so outdated.

P.P.S. 'Alot' -> 'a lot' ;)

Does not work

ERROR

Warning: Invalid argument supplied for foreach() in ********************* on line 33

Posted

Just use the code you had at the top it works fine.

Change:

<tr> <td align="center">No Flights in Progres</td></tr>

to:

<tr> <td colspan="7" align="center">No Flights in Progress</td></tr>

Posted

Just use the code you had at the top it works fine.

Change:

<tr> <td align="center">No Flights in Progres</td></tr>

to:

<tr> <td colspan="7" align="center">No Flights in Progress</td></tr>

The code works fine now but look the table gets shorter and does not match the other table sizes. what to do?

Posted

anyone on this problem

RECENT FLIGHTS BOARD

Problem: The status of this board i.e ACCEPTED , REJECTED , PENDIMG does not work properly.

<center><h2>Recent Arrivals</center></h>
<table align="center" border="0" width="605px">
</table>
<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
  <thead>
    <tr>
   <th width="7%" 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="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</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); 

   if($pirep->accepted == '0') $status = 'REJECTED';
   if($pirep->accepted == '1') $status = 'ACCEPTED';
   else $status = 'PENDING'; 

   echo "<tr>";
   echo "<td align=center   bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->depname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->arrname </font></td>";
   echo "<td align=center   bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->landingrate </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->aircraft </font></td>";
   echo "<td align=center    bgcolor=#171717> $status </font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>

Please if someone could check my codes and tell me whats wrong in them.

Thanks A lot

Posted

The code works fine now but look the table gets shorter and does not match the other table sizes. what to do?

Maybe because there isn't as many titles along the top so it doesn't stretch as far? Just extend the width of it a bit I did that with one before.

Posted

Maybe because there isn't as many titles along the top so it doesn't stretch as far? Just extend the width of it a bit I did that with one before.

Thanks Palmairva.co.uk and thanks tom for your help now just need help with the recent flights board code.

Posted

The problem is in the way YOU coded the table. Your page source show this:

<h2>Recent Flights Booked</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
<th width="10%" align="center" style="background-color: #171717;">Flight Number</div></th>
<th width="10%" align="center" style="background-color: #171717;">Depart</div></th>	
<th width="10%" align="center" style="background-color: #171717;">Arrive</div></th>
<th width="20%" align="center" style="background-color: #171717;">Pilot Name</div></th>
<th width="20%" align="center" style="background-color: #171717;">Aircraft</th>   //There is no </div> in this line
<th width="10%" align="center" style="background-color: #171717;">Tail No.</div></th>
<th width="20%" align="center" style="background-color: #171717;">Flight Time</div></th>
</tr>          //You have a </tr> but no <tr> in the table
</thead> 
<tbody>

<tr bgcolor="#171717">
<td height="25" width="15%" align="center">PIA356</a> </td>  //There is a <span></span> missing here
<td height="25" width="13%" align="center"><span>OPLA</span></td>
<td height="25" width="13%" align="center"><span>OPRN</span></td>

<td height="25" width="20%" align="center"><span>Sajid Ali</span></td>
<td height="25" width="15%" align="center"><span>ATR42</span></td>
<td height="25" width="12%" align="center">AP-BHP</td> //There is a <span></span> missing here
<td height="25" width="12%" align="center"><span>1 Hours</span></td>
</tr> 

<tr bgcolor="#171717">
<td height="25" width="15%" align="center">PIA653</a> </td> //There is a <span></span> missing here
<td height="25" width="13%" align="center"><span>OPRN</span></td>
<td height="25" width="13%" align="center"><span>OPLA</span></td>

<td height="25" width="20%" align="center"><span>Ali Asad</span></td>
<td height="25" width="15%" align="center"><span>ATR42</span></td>
<td height="25" width="12%" align="center">AP-BHP</td>  //There is a <span></span> missing here
<td height="25" width="12%" align="center"><span>1 Hours</span></td>
</tr> 
</tbody>
</table>

Redo the table to fix the problems, then it should look right.

Posted

The problem is in the way YOU coded the table. Your page source show this:

<h2>Recent Flights Booked</h2>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
<th width="10%" align="center" style="background-color: #171717;">Flight Number</div></th>
<th width="10%" align="center" style="background-color: #171717;">Depart</div></th>	
<th width="10%" align="center" style="background-color: #171717;">Arrive</div></th>
<th width="20%" align="center" style="background-color: #171717;">Pilot Name</div></th>
<th width="20%" align="center" style="background-color: #171717;">Aircraft</th>   //There is no </div> in this line
<th width="10%" align="center" style="background-color: #171717;">Tail No.</div></th>
<th width="20%" align="center" style="background-color: #171717;">Flight Time</div></th>
</tr>          //You have a </tr> but no <tr> in the table
</thead> 
<tbody>

<tr bgcolor="#171717">
<td height="25" width="15%" align="center">PIA356</a> </td>  //There is a <span></span> missing here
<td height="25" width="13%" align="center"><span>OPLA</span></td>
<td height="25" width="13%" align="center"><span>OPRN</span></td>

<td height="25" width="20%" align="center"><span>Sajid Ali</span></td>
<td height="25" width="15%" align="center"><span>ATR42</span></td>
<td height="25" width="12%" align="center">AP-BHP</td> //There is a <span></span> missing here
<td height="25" width="12%" align="center"><span>1 Hours</span></td>
</tr> 

<tr bgcolor="#171717">
<td height="25" width="15%" align="center">PIA653</a> </td> //There is a <span></span> missing here
<td height="25" width="13%" align="center"><span>OPRN</span></td>
<td height="25" width="13%" align="center"><span>OPLA</span></td>

<td height="25" width="20%" align="center"><span>Ali Asad</span></td>
<td height="25" width="15%" align="center"><span>ATR42</span></td>
<td height="25" width="12%" align="center">AP-BHP</td>  //There is a <span></span> missing here
<td height="25" width="12%" align="center"><span>1 Hours</span></td>
</tr> 
</tbody>
</table>

Redo the table to fix the problems, then it should look right.

Jeff thanks for your help but i did not ask help for this i asked help for RECENT FLIGHT ARRIVALS i mean the Recent Arrivals Board. I have problem that it DOES NOT display the current status properly.

Thanks

CEO PIASimulations

Posted

Other than your math, I don't see anything wrong with either the code or how it looks on the site.

   <thead>
    <tr>
   <th width="7%" 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="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</th>

This adds up to 105%, you're 5% over (maybe a workbook, or maybe a calculator might help).

If you'd like any more further support, I'd suggest you don't gripe about the answers you get for what you ask for, or how you ask them. This isn't going to get you far.

Posted

Other than your math, I don't see anything wrong with either the code or how it looks on the site.

   <thead>
    <tr>
   <th width="7%" 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="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</th>

This adds up to 105%, you're 5% over (maybe a workbook, or maybe a calculator might help).

If you'd like any more further support, I'd suggest you don't gripe about the answers you get for what you ask for, or how you ask them. This isn't going to get you far.

There is no problem in this THE PROBLEM IS THAT THE WHEN I REJECT ANY PIREP REPORT IT DOES NOT SHOW REJECTED. !!

Posted

I did say look here ;

anyone on this problem

RECENT FLIGHTS BOARD

Problem: The status of this board i.e ACCEPTED , REJECTED , PENDIMG does not work properly.

<center><h2>Recent Arrivals</center></h>
<table align="center" border="0" width="605px">
</table>
<?php
$count = 10;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
<table style="border:1px solid grey;" cellspacing="0" cellpadding="0" bgcolor="#1F1F1F">
  <thead>
    <tr>
   <th width="7%" 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="15%" align="center" style="background-color: #171717;">Pilot</th>
   <th width="10%" align="center" style="background-color: #171717;">Landing Rate</th>
   <th width="8%" align="center" style="background-color: #171717;">Aircraft</th>
   <th width="5%" align="center" style="background-color: #171717;">Status</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); 

   if($pirep->accepted == '0') $status = 'REJECTED';
   if($pirep->accepted == '1') $status = 'ACCEPTED';
   else $status = 'PENDING'; 

   echo "<tr>";
   echo "<td align=center   bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->depname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->arrname </font></td>";
   echo "<td align=center   bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->landingrate </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->aircraft </font></td>";
   echo "<td align=center    bgcolor=#171717> $status </font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>

Please if someone could check my codes and tell me whats wrong in them.

Thanks A lot

Posted

in this code it looks like everything is ok but THE PROBLEM IS HERE

in this part of it the status is being displayed wrong when i reject a pirep it shows pending.

 <?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'; 

   echo "<tr>";
   echo "<td align=center   bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->depname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->arrname </font></td>";
   echo "<td align=center   bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
   echo "<td align=center  bgcolor=#171717> $pirep->landingrate </font></td>";
   echo "<td align=center   bgcolor=#171717> $pirep->aircraft </font></td>";
   echo "<td align=center    bgcolor=#171717> $status </font></td>";
   echo "</tr>";
 }
}
else
{
   echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>

  • Administrators
Posted

I dont think that hollering at Mark IN CAPS is going to do anything for you. I will give you the key to the solution below, make an effort to figure it out.

From app.config.php

# PIREP Statuses

define('PIREP_PENDING', 0);

define('PIREP_ACCEPTED', 1);

define('PIREP_REJECTED', 2);

define('PIREP_INPROGRESS', 3);

Posted

I dont think that hollering at Mark IN CAPS is going to do anything for you. I will give you the key to the solution below, make an effort to figure it out.

From app.config.php

thanks sim pilot it worked :)

[solved]

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