<?php if(!defined('IN_PHPVMS') && IN_PHPVMS !== true) { die(); } ?>
<?php
if(!$pilot) {
    echo '<h3>This pilot does not exist!</h3>';
    return;
}
?>
<style>.deepBlue-content .deepBlue-postcontent-0 .layout-item-0 { margin-bottom: 7px;  }
.deepBlue-content .deepBlue-postcontent-0 .layout-item-1 { border-style:Solid;border-width:2px;border-color:#ffffff; border-spacing: 5px 0px; border-collapse: separate;  }
.deepBlue-content .deepBlue-postcontent-0 .layout-item-2 { padding-right: 10px;padding-left: 10px;  }
.deepBlue-content .deepBlue-postcontent-0 .layout-item-3 { border-right-style:Solid;border-right-width:2px;border-right-color:#ffffff; padding-right: 10px;padding-left: 10px;  }
.deepBlue-content .deepBlue-postcontent-0 .layout-item-4 { margin-top: 7px;margin-bottom: 7px;  }
.deepBlue-content .deepBlue-postcontent-0 .layout-item-5 { border-style:Solid;border-width:2px;border-color:#ffffff;  }
.deepBlue-content .deepBlue-postcontent-0 .layout-item-6 { border-right-style:Solid;border-bottom-style:Solid;border-right-width:2px;border-bottom-width:2px;border-right-color:#ffffff;border-bottom-color:#ffffff; padding-right: 10px;padding-left: 10px;  }
.deepBlue-content .deepBlue-postcontent-0 .layout-item-7 { border-bottom-style:dotted;border-bottom-width:2px;border-bottom-color:#ffffff; padding-right: 10px;padding-left: 10px;  }
.deepBlue-content .deepBlue-postcontent-0 .layout-item-8 { border-right-style:dotted;border-right-width:2px;border-right-color:#ffffff; padding-right: 10px;padding-left: 10px;  }
.ie7 .deepBlue-post .deepBlue-layout-cell {border:none !important; padding:0 !important; }
.ie6 .deepBlue-post .deepBlue-layout-cell {border:none !important; padding:0 !important; }
</style>
<div id="deepBlue-main">
<div class="deepBlue-sheet clearfix">
<div class="deepBlue-layout-wrapper">
<div class="deepBlue-content-layout">
<div class="deepBlue-content-layout-row">
<div class="deepBlue-layout-cell deepBlue-content">
<article class="deepBlue-post deepBlue-deepBlueicle">
<div class="deepBlue-postcontent deepBlue-postcontent-0 clearfix">

<!-- Begin Statistics Box -->
<div class="deepBlue-content-layout-wrapper layout-item-4">
<div class="deepBlue-content-layout layout-item-5">
<div class="deepBlue-content-layout-row">
<div class="deepBlue-layout-cell layout-item-6" style="width: 66%" >
<div class="deepBlue-block clearfix">
<div class="deepBlue-blockheader">
<h3 class="t"><?php echo $userinfo->firstname . ' ' . $userinfo->lastname; ?>'s Statistics</h3>
</div>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="deepBlue_table">
<thead>
<th width="25%">Name</font></b></th>
<td width="25%"><?php echo $userinfo->firstname . ' ' . $userinfo->lastname; ?></td>

<th width="25%">Hours</font></b></th>
<td width="25%"><?php echo Util::AddTime($userinfo->totalhours, $userinfo->transferhours); ?></td>
</tr>
<tr>
<th width="25%">Pilot ID</font></b></th>
<td width="25%"><?php echo $pilotcode ?></td>
<th width="25%">Flights</font></b></th>
<td width="25%"><?php echo $userinfo->totalflights?></td>
</tr>
<tr>
<th width="25%">Hub</font></b></th>
<td width="25%"><?php echo '<a href=" '.SITE_URL.'/index.php/'.$userinfo->hub.'">'.$userinfo->hub.'</a>';?></td>
<th width="25%">Distance Flown</font></b></th>
<td width="25%"><?php echo StatsData::TotalPilotMiles($pilot->pilotid); ?> miles</td>
</tr>
<tr>
<th width="25%">Rank</font></b></th>
<td width="25%"><?php echo $userinfo->rank;?></td>
<th width="25%">Last Flight</font></b></th>
<td width="25%"><?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';
                                        }
                                }                       ?></td>
</tr>
<tr>
<th width="25%">Hire Date:</font></b></th>
<td width="25%"><?php echo date('m/d/Y', strtotime($userinfo->joindate));?></td>
<th width="25%">Last Flight Date</font></b></th>
<td width="25%"><?php echo date('m/d/Y', strtotime($userinfo->lastpirep));?></td>
</tr>
</thead>
</tbody>
</table>
<!-- End Statistics Box -->
 <p>
<!--Begin View Public Profile -->
<center><button type="button" class="btn btn-landing"><span class="counter"><a href="<?php echo url('/profile/view/'.Auth::$userinfo->pilotid);?>"><i class="fa fa-user" style="color:#ffffff"></i> <font color="ffffff">View My Public Profile</a></font></span></button></center>
<!--End View Public Profile -->
</div>
</p>
</div>
<!--Begin Pilot Avatar -->
<div class="deepBlue-layout-cell layout-item-7" style="width: 33%" >
<div class="deepBlue-block clearfix">
<div class="deepBlue-blockheader">
<h3 class="t"><?php echo $userinfo->firstname . ' ' . $userinfo->lastname; ?> (Hired <?php echo ceil((time() - strtotime($userinfo->joindate)) / 86400); ?> days ago!)</h3>
</div>
<br />
<center>
<img src="<?php echo PilotData::getPilotAvatar($pilotcode); ?>"width="128"height="128"class="img-circle"/><br />
<img src="<?php echo $userinfo->rankimage?>"  alt="" />
</center>
<!--Begin Bank Roll -->
<center><button type="button" class="btn btn-landing">Bank Roll <span class="badge"><span class="counter"><?php echo FinanceData::FormatMoney($userinfo->totalpay) ?></span></span></button></center>
<!--End Bank Roll -->
</div>
</div>
<!--End Pilot Avatar -->
</div>
</div>
</div>
</div>
<!-- Begin My Profile -->
<div class="deepBlue-content-layout-wrapper layout-item-4">
<div class="deepBlue-content-layout layout-item-5">
<div class="deepBlue-block clearfix">
<div class="deepBlue-blockheader">
<h3 class="t">My Profile</h3>
</div>
<div class="deepBlue-blockcontent"><div>
<table width="100%" cellpadding="5" style="border-collapse:collapse; margin-top:5px;">
<tr>
<td width="20%" align="center"><i class="fa fa-pencil-square-o fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/profile/editprofile'); ?>">Edit Profile</a></td>
<td width="20%" align="center"><i class="fa fa-lock fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/profile/changepassword'); ?>">Change My Password</a></td>
<td width="20%" align="center"><i class="fa fa-user fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/profile/badge'); ?>">View My Signature</a></td>
<td width="20%" align="center"><i class="fa fa-line-chart fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/profile/stats'); ?>">My Statistics</a></td>
</tr>
</table>
</div>
</div>
<!-- End My Profile -->
<!-- Begin Flight Operations -->
<div class="deepBlue-content-layout-wrapper layout-item-4">
<div class="deepBlue-content-layout layout-item-5">
<div class="deepBlue-block clearfix">
<div class="deepBlue-blockheader">
<h3 class="t">Flight Operations</h3>
</div>
<div class="deepBlue-blockcontent"><div>
<table width="100%" cellpadding="5" style="border-collapse:collapse; margin-top:5px;">
<tr>
<td align="center"><i class="fa fa-search fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/pireps/mine');?>">View my PIREPs</a></td>
<td align="center"><i class="fa fa-map-marker fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/pireps/routesmap');?>">Map of flights</a></td>
<td align="center"><i class="fa fa-file-text fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/pireps/filepirep');?>">File a PIREP</a></td>
<td align="center"><i class="fa fa-file-text-o fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/schedules/view');?>">Schedules</a></td>
<td align="center"><i class="fa fa-book fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/schedules/bids');?>">My Bids</a></td>
<td align="center"><i class="fa fa-money fa-5x"style="color:#04327F"></i><br><a href="<?php echo url('/finances');?>"><?php echo FinanceData::FormatMoney($userinfo->totalpay)?></a></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
