Jump to content

Recent 5 Flights


Jeff

Recommended Posts

Hi there i need a little code to display pilot name on recent flight board i have used other code from yours to display images here is the code

<h2>Recent Completed Flights Board</h2>
<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table id="tabledlist" class="tablesorter">
<thead>
<tr>
<th>Flight Number</th>
<th>Departure</th>
<th>Arrival</th>
<th>Aircraft</th>
<th>Flight Time</th>
<th>Pilot Name</th>
<th>Status</th>

</tr>
</thead>
<tbody>

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

?>
<tr>
<td align="center">
	<a href="<?php echo url('/pireps/view/'.$pirep->pirepid);?>"><?php echo $pirep->code . $pirep->flightnum; ?></a>
</td>
<td align="center"><?php echo $pirep->depicao; ?></td>
<td align="center"><?php echo $pirep->arricao; ?></td>
<td align="center"><?php echo $pirep->aircraft . " ($pirep->registration)"; ?></td>
<td align="center"><?php echo $pirep->flighttime; ?></td>
<td align="center"><?php echo $pirep->pilotname; ?></td>
<td align="center">
	<?php

	if($pirep->accepted == PIREP_ACCEPTED){
		echo '<img src="'.SITE_URL.'/lib/skins/'.CURRENT_SKIN.'/images/Accepted.gif"border="0" alt=""/>';
           }
	elseif($pirep->accepted == PIREP_REJECTED)
		echo '<img src="'.SITE_URL.'/lib/skins/'.CURRENT_SKIN.'/images/Rejected.gif"border="0"  alt=""/>';
	elseif($pirep->accepted == PIREP_PENDING)
		echo '<img src="'.SITE_URL.'/lib/skins/'.CURRENT_SKIN.'/images/Pedning.gif"border="0"  alt=""/>';
	elseif($pirep->accepted == PIREP_INPROGRESS)
		echo '<img src="'.SITE_URL.'/lib/skins/'.CURRENT_SKIN.'/images/Inprogress.gif"border="0"  alt=""/>';
	?>
</td>
<?php
// Only show this column if they're logged in, and the pilot viewing is the
//	owner/submitter of the PIREPs
if(Auth::LoggedIn() && Auth::$userinfo->pilotid == $report->pilotid)
{
	?>
<td align="right">
	<a href="<?php echo url('/pireps/addcomment?id='.$report->pirepid);?>">Add Comment</a><br />
	<a href="<?php echo url('/pireps/editpirep?id='.$report->pirepid);?>">Edit PIREP</a>
</td>
<?php
}
?>
</tr>
<?php
}
?>
</tbody>
</table>

now i wont showing pilot name what i should enter to display pilot name also.

Awaiting you

Asmara

Link to comment
Share on other sites

  • 3 months later...

With link to pirep report on flight number.

<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<table>
  <thead>
    <tr>
      <th>Flight #</th>
      <th>Departure</th>
      <th>Arrival</th>
      <th>Duration</th>
      <th>Pilot</th>
      <th>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 = 'PENDING';
   if($pirep->accepted == '1') $status = 'ACCEPTED';
   else $status = 'REJECTED'; 

   echo '<tr>';
   echo '<td><a href="'.SITE_URL.'/index.php/pireps/viewreport/'.$pirep->pirepid.'">'.$pirep->code.$pirep->flightnum.'</a></td>';
   echo '<td>'.$pirep->depicao.'</td>';
   echo '<td>'.$pirep->arricao.'</td>';
   echo '<td>'.$pirep->flighttime.'</td>';
   echo '<td>'.$pilotid.' '.$pilotinfo->firstname.' '.$pilotinfo->lastname.'</td>';
   echo '<td>'.$status.'</td>';
   echo '</tr>';
 }
}
else
{
   echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
  </tbody>
</table>

Hi,

Thanks for the code it works great.

but I could do with knowing how to change the colour of the:-

"ACCEPTED" to Green

"REJECTED" to RED

"PENDING" to Amber

Any help would be appreciated.

Thanks

Scott

Link to comment
Share on other sites

I use this code in my pirep_viewall.tpl you can modify it to use.

<td align="center">
	<?php

	if($report->accepted == PIREP_ACCEPTED)
		echo '<div id="success"><font color="green">Accepted</font></div>';
	elseif($report->accepted == PIREP_REJECTED)
		echo '<div id="error"><font color="red">Rejected</font></div>';
	elseif($report->accepted == PIREP_PENDING)
		echo '<div id="error"><font color="orange">Approval Pending</font></div>';
	elseif($report->accepted == PIREP_INPROGRESS)
		echo '<div id="error">Flight in Progress</div>';

	?>
</td>

Link to comment
Share on other sites

Hi,

Here is the code I am using to display Recent Reports How do I get the flight number to be clickable to show the filed PIREP.

 <?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
 <table width="625" border="1" cellspacing="2" cellpadding="2">
   <tdead>
     <tr class="recent">
       <td><strong>Flight No</strong></td>
       <td><strong>Departure</strong></td>
       <td><strong>Arrival</strong></td>
       <td><strong>Duration</strong></td>
       <td><strong>Pilot</strong></td>
       <td><strong>Status</strong></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 '<span style="color:#347C17"><strong>Accepted</strong></span>';
               elseif($pirep->accepted == PIREP_REJECTED)
                       echo '<span style="color:#FF0000"><strong>Rejected</strong></span>';
               elseif($pirep->accepted == PIREP_PENDING)
                       echo '<span style="color:#E56717"><strong>Approval Pending</strong></span>';
               elseif($pirep->accepted == PIREP_INPROGRESS)
                       echo '<span style="color:#whatever">Flight in Progress</span>';
                       ?>
       </td>
     </tr>
     <?php
}}
else
{
       echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
    </tbody>
 </table>
</div>
<hr />

Thanks

Scott

Link to comment
Share on other sites

Scott, this might be what you are looking for:

<td align="center"><a href="<?php echo url('/pireps/view/'.$report->pirepid);?>"><?php echo $report->code  .-  $report->flightnum; ?></a></td>

If not, try this one:

<td align="center"><a href="<?php echo url('/pireps/view/'.$report->pirepid);?>"><?php echo $pirep->code  .-  $pirep->flightnum; ?></a></td>

Link to comment
Share on other sites

Scott, this might be what you are looking for:

<td align="center"><a href="<?php echo url('/pireps/view/'.$report->pirepid);?>"><?php echo $report->code  .-  $report->flightnum; ?></a></td>

If not, try this one:

<td align="center"><a href="<?php echo url('/pireps/view/'.$report->pirepid);?>"><?php echo $pirep->code  .-  $pirep->flightnum; ?></a></td>

Thanks Jeff will give it a try.

Link to comment
Share on other sites

Hi Jeff,

Thanks for the codes which work to a point. It does make the flight number clickable but when you click it I get a response of "No report ID specified!" I have had a look in the PIREPS.php file to see where it is going wrong but i may aswell be looking at quantum physics because it does not make any sense to me.

Hope you can help.

Thanks in advance

Scott

Link to comment
Share on other sites

Here is the code I have in my /public_html/core/templates/frontpage_reports.tpl

<p><a href="<?php echo url('/pireps/viewreport/'.$report->pirepid);?>">#<?php echo $report->pirepid
. ' - ' . $report->code.$report->flightnum?></a> - <a href="<?php echo url('/profile/view/'.$report->pilotid);?>"><?php echo $report->firstname . ' ' . $report->lastname?></a></p>

That might work better. If not, let me know.

Link to comment
Share on other sites

Here is the code I have in my /public_html/core/templates/frontpage_reports.tpl

<p><a href="<?php echo url('/pireps/viewreport/'.$report->pirepid);?>">#<?php echo $report->pirepid
. ' - ' . $report->code.$report->flightnum?></a> - <a href="<?php echo url('/profile/view/'.$report->pilotid);?>"><?php echo $report->firstname . ' ' . $report->lastname?></a></p>

That might work better. If not, let me know.

I have tried that code but still can not get it to work. I was able to get it to goto the pilots public profile but not to the pirep that was filed.

Scott

Link to comment
Share on other sites

Guest lorathon

The code should be as follows.

<p><a href="<?php echo url('/pireps/viewreport/'.$pirep->pirepid);?>">#<?php echo $pirep->pirepid
       . ' - ' . $pirep->code.$pirep->flightnum?></a> - <a href="<?php echo url('/profile/view/'.$pirep->pilotid);?>"><?php echo $pirep->firstname . ' ' . $pirep->lastname?></a></p>

All of the $report need to be changed to $pirep

Link to comment
Share on other sites

Guest lorathon

Try this complete code

 <?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
 <table width="625" border="1" cellspacing="2" cellpadding="2">
   <tdead>
     <tr class="recent">
       <td><strong>Flight No</strong></td>
       <td><strong>Departure</strong></td>
       <td><strong>Arrival</strong></td>
       <td><strong>Duration</strong></td>
       <td><strong>Pilot</strong></td>
       <td><strong>Status</strong></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);
} 
?>
     <tr>
       <td><a href="<?php echo url('/pireps/viewreport/'.$pirep->pirepid);?>">
             <?php echo $pirep->code.$pirep->flightnum; ?></a>
       </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 '<span style="color:#347C17"><strong>Accepted</strong></span>';
               elseif($pirep->accepted == PIREP_REJECTED)
                       echo '<span style="color:#FF0000"><strong>Rejected</strong></span>';
               elseif($pirep->accepted == PIREP_PENDING)
                       echo '<span style="color:#E56717"><strong>Approval Pending</strong></span>';
               elseif($pirep->accepted == PIREP_INPROGRESS)
                       echo '<span style="color:#whatever">Flight in Progress</span>';
                       ?>
       </td>
     </tr>
     <?php
}}
else
{
       echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
    </tbody>
 </table>
</div>
<hr />

Link to comment
Share on other sites

  • 2 years later...

For some reason I am getting this error: Warning: Invalid argument supplied for foreach() in/home/xxxx/public_html/lib/skins/vairline/frontpage_main.tpl on line 12

Here are the lines 9 through 15 with foreach ($flights as $flight) being line 12

<?php

$flights = PIREPData::getRecentReportsByCount(10);

$string = "";

foreach ($flights as $flight)

{

$string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';

}

Link to comment
Share on other sites

  • 1 month later...
  • 4 years later...
On 8/25/2011 at 6:42 AM, lorathon said:

Try this complete code

 


 <?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
 <table width="625" border="1" cellspacing="2" cellpadding="2">
   <tdead>
     <tr class="recent">
       <td><strong>Flight No</strong></td>
       <td><strong>Departure</strong></td>
       <td><strong>Arrival</strong></td>
       <td><strong>Duration</strong></td>
       <td><strong>Pilot</strong></td>
       <td><strong>Status</strong></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);
} 
?>
     <tr>
       <td><a href="<?php echo url('/pireps/viewreport/'.$pirep->pirepid);?>">
             <?php echo $pirep->code.$pirep->flightnum; ?></a>
       </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 '<span style="color:#347C17"><strong>Accepted</strong></span>';
               elseif($pirep->accepted == PIREP_REJECTED)
                       echo '<span style="color:#FF0000"><strong>Rejected</strong></span>';
               elseif($pirep->accepted == PIREP_PENDING)
                       echo '<span style="color:#E56717"><strong>Approval Pending</strong></span>';
               elseif($pirep->accepted == PIREP_INPROGRESS)
                       echo '<span style="color:#whatever">Flight in Progress</span>';
                       ?>
       </td>
     </tr>
     <?php
}}
else
{
       echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
    </tbody>
 </table>
</div>
<hr />
 

 

i used this , but how to link the pilot profile along there name ??

Link to comment
Share on other sites

  • 4 months later...
On 3/20/2019 at 7:00 PM, sayedzaafir said:

i used this , but how to link the pilot profile along there name ??

<?php
$count = 8;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
 <table width="1500" border="1" cellspacing="2" cellpadding="2">
   <tdead>
     <tr class="recent">
       <td><strong>Flight No</strong></td>
       <td><strong>Departure</strong></td>
       <td><strong>Arrival</strong></td>
       <td><strong>Duration</strong></td>
       <td><strong>Pilot</strong></td>
       <th>Landing Rate</strong></th>
       <td><strong>Status</strong></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);
} 
?>
     <tr>
       <td><a href="<?php echo url('/pireps/viewreport/'.$pirep->pirepid);?>">
             <?php echo $pirep->code.$pirep->flightnum; ?></a>
       </td>
       <td><?php echo $pirep->depicao; ?></td>
       <td><?php echo $pirep->arricao; ?></td>
       <td><?php echo $pirep->flighttime; ?></td>
       <td><a href="<?php echo url('/profile/view/'.$pirep->pilotid);?>">
             <?php echo $pilotinfo->firstname.' '.$pilotinfo->lastname; ?></a>
       <td><?php echo $pirep->landingrate; ?></td>
       <td><?php

               if($pirep->accepted == PIREP_ACCEPTED)
                       echo '<span style="color:#347C17"><strong>Accepted</strong></span>';
               elseif($pirep->accepted == PIREP_REJECTED)
                       echo '<span style="color:#FF0000"><strong>Rejected</strong></span>';
               elseif($pirep->accepted == PIREP_PENDING)
                       echo '<span style="color:#E56717"><strong>Approval Pending</strong></span>';
               elseif($pirep->accepted == PIREP_INPROGRESS)
                       echo '<span style="color:#whatever">Flight in Progress</span>';
                       ?>
       </td>
     </tr>
     <?php
}}
else
{
       echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
    </tbody>
 </table>
</div>
<hr />

This is what im using on the VA im working with

Link to comment
Share on other sites

  • 1 year later...
On 3/20/2019 at 8:00 PM, sayedzaafir said:

i used this , but how to link the pilot profile along there name ??

 

<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>

<?php
$count = 5;
$pireps = PIREPData::getRecentReportsByCount($count);
?>
 <table width="625" border="1" cellspacing="2" cellpadding="2">
   <tdead>
     <tr class="recent">
       <td><strong>Flight No</strong></td>
       <td><strong>Departure</strong></td>
       <td><strong>Arrival</strong></td>
       <td><strong>Duration</strong></td>
       <td><strong>Pilot</strong></td>
       <td><strong>Status</strong></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);
} 
?>
     <tr>
       <td><a href="<?php echo url('/pireps/viewreport/'.$pirep->pirepid);?>">
             <?php echo $pirep->code.$pirep->flightnum; ?></a>
       </td>
	   <td><a href="<?php echo  SITE_URL.'/index.php/profile/view/'.$pilotinfo->pilotid?>">
	       <?php echo $pilotinfo->firstname.' '.$pilotinfo->lastname; ?></td>
       <td><?php echo $pirep->depicao; ?></td>
       <td><?php echo $pirep->arricao; ?></td>
       <td><?php echo $pirep->flighttime; ?></td>
       <td><?php

               if($pirep->accepted == PIREP_ACCEPTED)
                       echo '<span style="color:#347C17"><strong>Accepted</strong></span>';
               elseif($pirep->accepted == PIREP_REJECTED)
                       echo '<span style="color:#FF0000"><strong>Rejected</strong></span>';
               elseif($pirep->accepted == PIREP_PENDING)
                       echo '<span style="color:#E56717"><strong>Approval Pending</strong></span>';
               elseif($pirep->accepted == PIREP_INPROGRESS)
                       echo '<span style="color:#whatever">Flight in Progress</span>';
                       ?>
       </td>
     </tr>
     <?php
}}
else
{
       echo '<tr><td>There are no recent flights!</td></tr>';
}
?>
    </tbody>
 </table>
</div>
<hr />


</div>
    </div>

 

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