Jump to content
Angel Air

Pilots Last Flight

Recommended Posts

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

Screenshot_4.png

Share this post


Link to post
Share on other sites

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

 

Edited by flyalaska

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

Can I use this for displaying date of last pirep?

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

 

Edited by thefiercepilot

Share this post


Link to post
Share on other sites
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));?>

 

Share this post


Link to post
Share on other sites
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 ??

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×