Pilots Last Flight

Hi all I am trying to show the below code on the profile_main.php but can’t get any of the data to show.

Here is the code, I have taken this from pirep_viewreport.php

 \<b\>Departure Airport\</b\> \<p class="pull-right" style="color: #3C8DBC"\>\<?php echo $pirep-\>depname?\> (\<?php echo $pirep-\>depicao; ?\>)\</p\> \</li\> \<li class="list-group-item"\> \<b\>Arrival Airport\</b\> \<p class="pull-right" style="color: #3C8DBC"\>\<?php echo $pirep-\>arrname?\> (\<?php echo $pirep-\>arricao; ?\>)\</p\> \</li\> \<li class="list-group-item"\> \<b\>Aircraft\</b\> \<p class="pull-right" style="color: #3C8DBC"\>\<?php echo $pirep-\>aircraft . " ($pirep-\>registration)"?\>\</p\> \</li\> \<li class="list-group-item"\> \<b\>Flight Time\</b\> \<p class="pull-right" style="color: #3C8DBC"\>\<?php echo $pirep-\>flighttime; ?\>\</p\> \</li\> \<li class="list-group-item"\> \<b\>Date Submitted\</b\> \<p class="pull-right" style="color: #3C8DBC"\>\<?php echo date(DATE\_FORMAT, $pirep-\>submitdate);?\>\</p\> \</li\> \<?php if($pirep-\>route != '') { echo '\<li class="list-group-item"\>\<b\>Route\</b\> \<p class="pull-right" style="color: #3C8DBC"\>'.$pirep-\>route.'\</p\>\</li\>'; } ?\> \<li class="list-group-item"\>\<b\>Status\</b\> \<?php if($pirep-\>accepted == PIREP\_ACCEPTED) echo '\<div class="label label-success pull-right"\>Accepted\</div\>'; elseif($pirep-\>accepted == PIREP\_REJECTED) echo '\<div class="label label-danger pull-right"\>Rejected\</div\>'; elseif($pirep-\>accepted == PIREP\_PENDING) echo '\<div class="label label-info pull-right"\>Approval Pending\</div\>'; elseif($pirep-\>accepted == PIREP\_INPROGRESS) echo '\<div class="label label-warning pull-right"\>Flight in Progress\</div\>'; ?\> 

Here is what I see when I add this code to profile_main.php

Screenshot4.png.4aa6f154c3ff1d0c8702c58bfc74984e.png

I have this on my site with simpilots 5.5.2

Days Since Last Flight

\<?php if ($userinfo-\>lastpirep == '0000-00-00 00:00:00') { echo 'There are no flights!'; } else { $datebefore1 = substr($userinfo-\>lastpirep, 0, 10); $datetoday2 = date("Y-m-d"); $datebefore3 = strtotime($datebefore1); $datetoday4 = strtotime($datetoday2); $newdate = $datetoday4-$datebefore3; $lastpirep = floor($newdate/(60\*60\*24)); echo ' '; if ($lastpirep == 0) { echo 'Today'; } else if ($lastpirep == 1) { echo 'Yesterday'; } else { echo $lastpirep . ' Days ago'; } }?\>

 

Latest Flight Number

\<?php if($report) { ?\> \<a href="\<?php echo url('pireps/view/'.$report-\>pirepid); ?\>"\>\<?php echo $report-\>code . $report-\>flightnum; ?\>\</a\> \<?php } else { echo 'No PIREPs filed yet!'; } ?\>

Last Flight Date

\<?php echo date('m/d/Y', strtotime($userinfo-\>lastpirep));?\>

 

Thank you I have used your codes and adapted it slightly, until I can figure the above out.

Thanks again 

Scott

Thanks flyalaska, 

that was exactly my idea for him, however with a few bells and whistles using of course the infamous <table> , <td>, <tr> etc, which will allow for columns, colors, bgcolors etc. Sorry I couldn’t get back to you right away, but flyalaska definately has the right idea. 

Jimbo

1 Like

Can I use this for displaying date of last pirep?

\<?php if(!$pireps) { $lastflight="Never"; } else { $lastflight=date('m/d/Y', strtotime($userinfo-\>lastpirep)); } ?\>

 

can anyone tell me how to get the dept airport and arr airport of last flown flight and the flight time

 

thank you

10 hours ago, sayedzaafir said:

can anyone tell me how to get the dept airport and arr airport of last flown flight and the flight time

 

thank you

I just have the last flight date.

\<?php echo date('m/d/Y', strtotime($userinfo-\>lastpirep));?\>

 

On 2/27/2017 at 1:16 PM, Angel Air said:

<?php if($pirep->accepted == PIREP_ACCEPTED) echo ‘<div class=“label label-success pull-right”>Accepted</div>’; elseif($pirep->accepted == PIREP_REJECTED) echo ‘<div class=“label label-danger pull-right”>Rejected</div>’; elseif($pirep->accepted == PIREP_PENDING) echo ‘<div class=“label label-info pull-right”>Approval Pending</div>’; elseif($pirep->accepted == PIREP_INPROGRESS) echo ‘<div class=“label label-warning pull-right”>Flight in Progress</div>’; ?>

i tried this but it dint work , any updated code for it ??