Display Last Flight Date In Admin Panel

Good Evening folks,

My VA is trying to figure out a way to display the date of the last logged flight in the admin pilots list. I saw a code snippet that adds the last location to the panel, but I want to make it the date. Anyone have any idea how I might go about doing that?
Best,

Ryan

You will have to edit two files

Backup the originals first…



In /admin/modules/PilotAdmin/PilotAdmin.php

Edit (around line 462)

 $tmp = array( 'id' =\> $row-\>id, 'cell' =\> array( # Each column, in order $row-\>id, $pilotid, $row-\>firstname, $row-\>lastname, $row-\>email, $location, $status, $row-\>rank, $row-\>totalflights, $row-\>totalhours, $row-\>lastip, $edit )

Add after ----  $row->totalhours,

as a new row

 $row-\>lastpirep,

 



In /admin/templates/pilot_list.php

Change (around line 17)

 colNames: ['','Pilot ID', 'First', 'Last', 'Email', 'Location', 'Status', 'Rank', 'Flights', 'Hours', 'IP', 'Edit'],

To

 colNames: ['','Pilot ID', 'First', 'Last', 'Email', 'Location', 'Status', 'Rank', 'Flights', 'Hours', 'Last PIREP', 'IP', 'Edit'],

Then (around line 29)

 colModel : [{index: 'id', name: 'id', hidden: true, search: false }, {index: 'pilotid', name : 'pilotid',sortable : true, align: 'left', search: 'true', searchoptions:{sopt:['in']}}, {index: 'firstname', name : 'firstname',sortable : true, align: 'left', search: 'true', searchoptions:{sopt:['in']}}, {index: 'lastname', name : 'lastname', sortable : true, align: 'left', searchoptions:{sopt:['in']}}, {index: 'email', name : 'email', sortable : true, align: 'left',searchoptions:{sopt:['li']}}, {index: 'location', name : 'location', sortable : true, align: 'center',searchoptions:{sopt:['eq','ne']}}, {index: 'retired', name : 'status', sortable : true, align: 'center',searchoptions:{sopt:['in']}}, {index: 'rank', name : 'rank', sortable : true, align: 'center', searchoptions:{sopt:['eq','ne']}}, {index: 'totalflights', name : 'totalflights', sortable : true, align: 'center',searchoptions:{sopt:['lt','gt']}}, {index: 'totalhours', name : 'totalhours', sortable : true, align: 'center',searchoptions:{sopt:['lt','gt']}}, {index: 'lastip', name : 'lastip', sortable : true, align: 'center', searchoptions:{sopt:['in']}}, {index: '', name : '', sortable : true, align: 'center', search: false}

Add after ---- {index: ‘totalhours’, name : ‘totalhours’, sortable : true, align: ‘center’,searchoptions:{sopt:[‘lt’,‘gt’]}},

as a new row

{index: 'lastpirep', name : 'lastpirep', sortable : true, align: 'center',searchoptions:{sopt:['lt','gt']}},

 

Now you will have a Last PIREP column in the Pilot List showing the date and time of the last submitted PIREP for each pilot. The date/time shown is either the last PIREP date/time (if at least one PIREP has been filed) or the pilot’s join date - whichever is most recent (at least in phpVMS 5.5.2.72). 

 

 

Got it working!
Thanks so much for the quick reply!!