Imanol Posted January 22, 2018 Report Share Posted January 22, 2018 (edited) Hello, I need to know if there's any piece of code in order to add the pilot ID column in the admin pilot list. Thank you! Edited January 23, 2018 by Imanol Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted January 22, 2018 Moderators Report Share Posted January 22, 2018 First of all, which phpVMS version are you using? v2 or v5? As far as I know, v5 already includes that. Please let us know and we should be able to give you the most practical solution. Quote Link to comment Share on other sites More sharing options...
Imanol Posted January 22, 2018 Author Report Share Posted January 22, 2018 Hi Servetas, I am using V2. Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted January 23, 2018 Moderators Report Share Posted January 23, 2018 In that case you will have to make a couple of changes. First of all, open your admin/modules/PilotAdmin/PilotAdmin.php file and find this: foreach($allpilots as $row) { $status = ($row->retired==0) ? 'Active' : 'Retired'; $location = '<img src="'.Countries::getCountryImage($row->location).'" alt="'.$row->location.'" />'; $edit = '<a href="'.adminurl('/pilotadmin/viewpilots?action=viewoptions&pilotid='.$row->pilotid).'">Edit</a>'; $tmp = array( 'id' => $row->id, 'cell' => array( # Each column, in order $row->id, $row->firstname, $row->lastname, $row->email, $location, $status, $row->rank, $row->totalflights, $row->totalhours, $row->lastip, $edit, ), ); $json['rows'][] = $tmp; } And replace it with this: foreach($allpilots as $row) { $pilotid = PilotData::getPilotCode($row->code, $row->pilotid); $status = ($row->retired==0) ? 'Active' : 'Retired'; $location = '<img src="'.Countries::getCountryImage($row->location).'" alt="'.$row->location.'" />'; $edit = '<a href="'.adminurl('/pilotadmin/viewpilots?action=viewoptions&pilotid='.$row->pilotid).'">Edit</a>'; $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, ), ); $json['rows'][] = $tmp; } Then open your admin/templates/pilots_list.tpl, find this: $("#grid").jqGrid({ url: '<?php echo adminaction('/pilotadmin/getpilotsjson');?>', datatype: 'json', mtype: 'GET', colNames: ['','First', 'Last', 'Email', 'Location', 'Status', 'Rank', 'Flights', 'Hours', 'IP', 'Edit'], colModel : [ {index: 'id', name: 'id', hidden: true, search: false }, {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: 'status', 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} ], pager: '#pager', rowNum: 25, sortname: 'lastname', sortorder: 'asc', viewrecords: true, autowidth: true, height: '100%' }); and replace it with this: $("#grid").jqGrid({ url: '<?php echo adminaction('/pilotadmin/getpilotsjson');?>', datatype: 'json', mtype: 'GET', colNames: ['','Pilot ID', 'First', 'Last', 'Email', 'Location', 'Status', 'Rank', 'Flights', 'Hours', 'IP', 'Edit'], 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: 'status', 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} ], pager: '#pager', rowNum: 25, sortname: 'lastname', sortorder: 'asc', viewrecords: true, autowidth: true, height: '100%' }); Do not forget to keep a backup of the files that you should edit to ensure that you will be able to "come back" in case something breaks out. Quote Link to comment Share on other sites More sharing options...
Imanol Posted January 23, 2018 Author Report Share Posted January 23, 2018 It worked perfectely! Thank you so much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.