Kalo Posted November 7, 2012 Report Share Posted November 7, 2012 hello, I was wondering how I could edit my pilot list, so instead of categorizing pilots by their Pilot ID, it would categorize pilots by "Hours". I want it so that it shows the pilots with the most hours at the top of the list. I am familiar with editing php files and what not. here is my list: http://www.msflights.net/pilots/phpvms/index.php/pilots Basically I just need to know what file to edit and what to put in it. Thanks alot! -Kalo- Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 7, 2012 Moderators Report Share Posted November 7, 2012 You need to create a PHP file in common folder then address the tpl to use the created PHP file. Now inside that PHP you need to write a query from DB to get all pilots and sort them by their hours and finally show that in a table If you know what I mean. Quote Link to comment Share on other sites More sharing options...
Strider Posted November 7, 2012 Report Share Posted November 7, 2012 Alternatively find the code that controls the pilots list, and change the query that it contains, and set it from order by pilot_id to hours. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 7, 2012 Moderators Report Share Posted November 7, 2012 Alternatively find the code that controls the pilots list, and change the query that it contains, and set it from order by pilot_id to hours. This is correct but not good if you don't want to change the default coding. Quote Link to comment Share on other sites More sharing options...
Strider Posted November 7, 2012 Report Share Posted November 7, 2012 Well obviously if you dont want to edit the default. But a fair amount of people do, they want to use phpvms as a base system, and customise it totally. Quote Link to comment Share on other sites More sharing options...
Kalo Posted November 7, 2012 Author Report Share Posted November 7, 2012 thanks for the quick reply fellows, I will try it out and let you know how it went Quote Link to comment Share on other sites More sharing options...
Kalo Posted November 7, 2012 Author Report Share Posted November 7, 2012 do you guys by any chance know where the file is located to edit rank? so far the closest thing I have found is the "pilot_list" template located in: "phpvms\core\templates"......however I don't see anything in this template about ordering by Pilot ID. For instance in this template I see for the "Pilot ID" column: <td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> but I don't see where this code tells it to categorize by ID? Forgive my lack of knowledge on the subject...but I can't seem to find the file that orders the pilot list. thanks. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 8, 2012 Moderators Report Share Posted November 8, 2012 do you guys by any chance know where the file is located to edit rank? so far the closest thing I have found is the "pilot_list" template located in: "phpvms\core\templates"......however I don't see anything in this template about ordering by Pilot ID. For instance in this template I see for the "Pilot ID" column: <td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> but I don't see where this code tells it to categorize by ID? Forgive my lack of knowledge on the subject...but I can't seem to find the file that orders the pilot list. thanks. The reason is that you're in the wrong place. Looking at the function in modules/pilots/index(), I tried to see if I can order pilots by total hours but I think a lot of parts need to be changed if you want to go that way. I think creating a common php file for this and edit the template would be a much easier solution without having to change the file system. Quote Link to comment Share on other sites More sharing options...
Kalo Posted November 8, 2012 Author Report Share Posted November 8, 2012 hmm thanks for your response parkho, but I don't have a index file in the modules/pilots folder. I just have a pilots.php. I wonder if anyone else has tried to do this in the past....can't find any while searching. It seems like most people would rather have it categorized by hours instead of Pilot ID. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 9, 2012 Moderators Report Share Posted November 9, 2012 Index is not a file, it's a function inside pilots.php Quote Link to comment Share on other sites More sharing options...
Kalo Posted November 9, 2012 Author Report Share Posted November 9, 2012 ok, so are you saying I should not edit the pilots.php file...and edit the "pilot_list.tpl" template located in: "phpvms\core\templates" instead? Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 9, 2012 Moderators Report Share Posted November 9, 2012 Well! as I mentioned in my first post you'll need a class file in common folder that pulls out the data sorted by pilot total hour then edit the pilot's list to call that function and show the data in a table. Keep in mind that doing so will results in a table with all the pilots sorted based on hours and not showing the pilots in HUB sections any more. Quote Link to comment Share on other sites More sharing options...
Kalo Posted November 10, 2012 Author Report Share Posted November 10, 2012 ok thanks, I will try but this is a little more complicated then I thought..or may be-able to do (I thought it would be as easy as editing 1 line ) It's actually perfect that it would not show pilots per hub, that's exactly what I wanted! I'd rather for people to be-able to look at 1 list and see who is the most active, rather then scrolling down to look at each hub separately. Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 10, 2012 Moderators Report Share Posted November 10, 2012 Install the attached module in the order of the folders and access it by "http"//www.yoursite.com/index.php/pilotlist". Screenshot: PilotList.zip Quote Link to comment Share on other sites More sharing options...
Kalo Posted November 13, 2012 Author Report Share Posted November 13, 2012 thanks parkho! Your a real asset to this community! This is how it looks now http://www.msflights...x.php/pilotlist I do have one problem tho....for some reason the rank images do not show up now...do I need to place them in a different folder now that I am using this template? Thanks! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 14, 2012 Moderators Report Share Posted November 14, 2012 Reinstall the module as attached, Revised: PilotList.zip Quote Link to comment Share on other sites More sharing options...
Kalo Posted November 14, 2012 Author Report Share Posted November 14, 2012 thanks! worked like a charm! I made a change but I am not sure if I did it the best way: to display all of my pilots instead of just 2 like the default template you gave me, I put 100 in the parenthesis instead of the standard 2: "$pilots = PilotListData::pilotlist(100);" Is there another command that would list all pilots? Or is it OK to just put a number much higher then the actual pilots in your database? Thanks parkho! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 14, 2012 Moderators Report Share Posted November 14, 2012 That's fine you can choose any number. The reason I put it there was I thought you might wanna show less records to shorten the page. You could also use a pagination. Quote Link to comment Share on other sites More sharing options...
Kalo Posted November 22, 2012 Author Report Share Posted November 22, 2012 ok thanks again, you helped out alot 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.