Danny Posted January 19, 2010 Report Share Posted January 19, 2010 Hi.. I want to customize my roster so it doesnt show all the hubs and teh pilots under it. Just the List of pilots and next to the names and hours a collum saying Hub. Is this easily done? Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted January 19, 2010 Report Share Posted January 19, 2010 Yes this is easily done. If you know some html, you have it made in the shade! However, since that file is in the core/templates folder, any edits done to it will be over written in website updates that you do in the future. Ans easy way to avoid this is to go to http://www.phpvms.net/tutorials/skinning_tutorial and follow along closely. In this tutorial they will teach you how to copy your skin to another folder to avoid upgrade over writes. And any files you wish to edit that are in the core/templates folder, you simply copy them to the new skin folder that you will create. Problem solved. ;D Have a look at that link and let us know how it goes. Happy coding! Quote Link to comment Share on other sites More sharing options...
Danny Posted January 19, 2010 Author Report Share Posted January 19, 2010 I know HTML. And i know about coping the file over to stop update. Im just not sure how to get rid of the list of hubs and just have teh table there. and hubs on the end. This is what i have so far http://virtualthomascook.com/index.php/pilots Quote Link to comment Share on other sites More sharing options...
Moderators joeri Posted January 19, 2010 Moderators Report Share Posted January 19, 2010 just a question/heads up did you ask for persission from the real thomas cook. why i am asking this is i know somebody also did a tc va but without the permission and some other tc va sended the link to the real and they got a nice letter from their office 1 Quote Link to comment Share on other sites More sharing options...
flyalaska Posted January 19, 2010 Report Share Posted January 19, 2010 some other tc va sended the link to the real and they got a nice letter from their office :'( Quote Link to comment Share on other sites More sharing options...
AFVA | Mitchell Posted January 19, 2010 Report Share Posted January 19, 2010 BACK UP PILOTS_LIST.TPL 1. Delete everything in pilots_list 2. Copy all this code into it: <?php $roster = PilotData::GetAllPilotsDetailed($start='', $limit=50) ?> <?php if(!$roster) { echo 'There are no pilots!'; return; } ?> <table id="tabledlist" class="tablesorter"> <thead> <tr> <th>Pilot ID</th> <th>Name</th> <th>Rank</th> <th>Flights</th> <th>Hours</th> <th>HUBs</th> </tr> </thead> <tbody> <?php foreach($roster as $pilot) { ?> <tr> <td width="1%" nowrap> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" /> <a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> <td> <center><?php echo $pilot->firstname.' '.$pilot->lastname?></center> </td> <center><td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td></center> <center><td><?php echo $pilot->totalflights?></td></center> <center><td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td></center> <center><td><?php echo $pilot->hub?></td></center> </tr> <?php } ?> </tbody> </table> If it doesn't work restore the backup. Quote Link to comment Share on other sites More sharing options...
Danny Posted January 20, 2010 Author Report Share Posted January 20, 2010 I have emailed them yes and i am waiting for a reply the domain is only a small cost so if i have to change name then thats fine to me I tried that Mitchell But all i got was There are no pilots!There are no pilots!There are no pilots!There are no pilots!There are no pilots!There are no pilots!There are no pilots!There are no pilots!There are no pilots!There are no pilots!There are no pilots! Quote Link to comment Share on other sites More sharing options...
Moderators joeri Posted January 20, 2010 Moderators Report Share Posted January 20, 2010 then probably your pilots aren't in a hub Quote Link to comment Share on other sites More sharing options...
Danny Posted January 20, 2010 Author Report Share Posted January 20, 2010 Joeri your not understanding. I want to get rid of the list of hubs and have just one list of pilots with there hub next to there name. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 20, 2010 Administrators Report Share Posted January 20, 2010 To fix the "there are no pilots issue" that your getting above you need to change <?php $roster = PilotData::GetAllPilotsDetailed($start='', $limit=50) ?> to <?php $roster = PilotData::GetAllPilotsDetailed('', '') ?> This will give you the first 20 pilots in the db unless you have changed the parameters in the PilotDataClass for the getAllPilotsDetailed function. A cleaner way to get all the pilots would probably be -> <?php $roster = PilotData::getAllPilots(); ?> This will return all the pilots and their information that are in the db You can use <?php print_r($roster); ?> after the above call and see everything in the array. After that use a foreach and build your table to your liking. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 20, 2010 Administrators Report Share Posted January 20, 2010 The cleanest is $all_pilots = PilotData::findPilots(array()); But, they all return the same data. Quote Link to comment Share on other sites More sharing options...
Danny Posted January 20, 2010 Author Report Share Posted January 20, 2010 http://virtualthomascook.com/index.php/pilots Ok were slowly getting there :S Any idea why its doing that? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 20, 2010 Administrators Report Share Posted January 20, 2010 Hard to tell without seeing the code but looks like you have the foreach for hubs still in there and you have 11 hubs. You would not need that part anymore if you are just showing a full pilot roster. Quote Link to comment Share on other sites More sharing options...
Danny Posted January 20, 2010 Author Report Share Posted January 20, 2010 This is the code there currently. <?php $roster = PilotData::getAllPilots(); ?> <?php if(!$roster) { echo 'There are no pilots!'; return; } ?> <table id="tabledlist" class="tablesorter"> <thead> <tr> <th>Pilot ID</th> <th>Name</th> <th>Rank</th> <th>Flights</th> <th>Hours</th> <th>HUBs</th> </tr> </thead> <tbody> <?php foreach($roster as $pilot) { ?> <tr> <td width="1%" nowrap> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" /> <a href="<?php echo SITE_URL?>/index.php/profile/view/<?php echo $pilot->pilotid?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> <td> <center><?php echo $pilot->firstname.' '.$pilot->lastname?></center> </td> <center><td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td></center> <center><td><?php echo $pilot->totalflights?></td></center> <center><td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td></center> <center><td><?php echo $pilot->hub?></td></center> </tr> <?php } ?> </tbody> </table> Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 20, 2010 Administrators Report Share Posted January 20, 2010 I just tested your code on a clean install and it works fine - Have you checked the db and see how many entries there are in the pilots table? Quote Link to comment Share on other sites More sharing options...
Danny Posted January 20, 2010 Author Report Share Posted January 20, 2010 Nope there just one entry :/ Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 20, 2010 Administrators Report Share Posted January 20, 2010 How are you calling this? Is this the whole tpl file, or is it embedded in another using a call? Quote Link to comment Share on other sites More sharing options...
Danny Posted January 21, 2010 Author Report Share Posted January 21, 2010 I just edited the pilots_list.tpl thats all i edited so its called the same as before? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted January 21, 2010 Administrators Report Share Posted January 21, 2010 There is a foreach somewhere in the template sturucture you are using that is based on hubs from what I can tell from here, You have 11 hubs by your registration form and you are showing up 11 times in your pilot list..... look through all the templates that are being used when that page is called. Quote Link to comment Share on other sites More sharing options...
Danny Posted January 21, 2010 Author Report Share Posted January 21, 2010 The only one i can see if in pilots.php public function index() { // Get all of our hubs, and list pilots by hub $allhubs = OperationsData::GetAllHubs(); if(!$allhubs) $allhubs = array(); foreach($allhubs as $hub) { $this->set('title', $hub->name); $this->set('icao', $hub->icao); $this->set('allpilots', PilotData::findPilots(array('p.hub'=>$hub->icao))); $this->render('pilots_list.tpl'); } $nohub = PilotData::findPilots(array('p.hub'=>'')); if(!$nohub) { return; } $this->set('title', 'No Hub'); $this->set('icao', ''); $this->set('allpilots', $nohub); $this->render('pilots_list.tpl'); } Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted January 21, 2010 Administrators Report Share Posted January 21, 2010 In the index function you showed, you can replace it with this: public function index() { $this->render('pilots_list.tpl'); } Which should do what you want. I think I'll revamp this function a bit too, so it can be customized a bit more easily Quote Link to comment Share on other sites More sharing options...
Danny Posted January 21, 2010 Author Report Share Posted January 21, 2010 Aha that fixed it Nabeel thanks Quote Link to comment Share on other sites More sharing options...
Guest nedra Posted October 1, 2010 Report Share Posted October 1, 2010 Hi Nabeel, I've been using this thread to help me, and it worked a charm in regards to removing hubs from the roster, however i've posted a screenshot below showing my problem. As you can see, it has the same 2 names about 7 times. I believe this is because I have seven hubs. How can i make it so that i have one single list of everyone in my airline? Also on that, how can i have it so that is lists each member by RANK, rather than by ID? Thanks very much for your help! Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 4, 2010 Administrators Report Share Posted October 4, 2010 Hi Nedra, In the post by Danny where he shows that code, I believe it's in the pilots module, replace it with the code I put in the post above, it'll only show it once then Quote Link to comment Share on other sites More sharing options...
Guest nedra Posted October 5, 2010 Report Share Posted October 5, 2010 Hi Nabeel. I tried that and it returns the error: Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /home/vol9/000space.com/space_4311992/htdocs/core/modules/Pilots/Pilots.php on line 28 Line 28 of my code is: $allhubs = OperationsData::GetAllHubs(); Any idea what the problem is? Quote Link to comment Share on other sites More sharing options...
Guest nedra Posted October 8, 2010 Report Share Posted October 8, 2010 Ok, i've fixed the above error. It seemed to be caused by the public function code which nabeel posted here, so i removed it back to how it was originally and it's working (i put that public function in pilots.php, is that correct?)However the roster is still showing the 2 names 7 times, like in the screenshot i posted above. I've read through this thread 3 times but i still can't work out the solution. I tried to view Danny's website, but it doesn't appear to be up anymore. Can anyone help with this, please, or am i a helpless case? haha Thanks in advance! EDIT:Ok, I've fixed the issue with it appearing 7 times. I did it by going into the pilots.php, and at this bit: // Get all of our hubs, and list pilots by hub $allhubs = OperationsData::GetAllHubs(); if(!$allhubs) $allhubs = array(); foreach($allhubs as $hub) { $this->set('title', $hub->name); $this->set('icao', $hub->icao); $this->set('allpilots', PilotData::findPilots(array('p.hub'=>$hub->icao))); $this->render('pilots_list.tpl'); } And changed "foreach($allhubs as $hub)", to "/** foreach($allhubs as $hub) */", making it a comment, therefore disabling it The only problem i've got to sort now is sorting it by rank, rather than by ID. Can anyone help with that one please? Quote Link to comment Share on other sites More sharing options...
James142 Posted October 25, 2010 Report Share Posted October 25, 2010 Hi Nedra, In the post by Danny where he shows that code, I believe it's in the pilots module, replace it with the code I put in the post above, it'll only show it once then Is there a way to get the name of the airport hub to not show up when there is no pilots based at that hub? If you look at it here: v you can see it says "There are no pilots based at this airport." Is there any way to keep the names of the airports with pilots based there and to stop the airports that have no pilots based at them from showing up? Thanks, james Quote Link to comment Share on other sites More sharing options...
Daniel Posted October 27, 2010 Report Share Posted October 27, 2010 The only one i can see if in pilots.php public function index() { // Get all of our hubs, and list pilots by hub $allhubs = OperationsData::GetAllHubs(); if(!$allhubs) $allhubs = array(); foreach($allhubs as $hub) { $this->set('title', $hub->name); $this->set('icao', $hub->icao); $this->set('allpilots', PilotData::findPilots(array('p.hub'=>$hub->icao))); $this->render('pilots_list.tpl'); } $nohub = PilotData::findPilots(array('p.hub'=>'')); if(!$nohub) { return; } $this->set('title', 'No Hub'); $this->set('icao', ''); $this->set('allpilots', $nohub); $this->render('pilots_list.tpl'); } what folder is this in? Thank you Quote Link to comment Share on other sites More sharing options...
Daniel Posted October 27, 2010 Report Share Posted October 27, 2010 ID Name Rank Flights Hours Vatsim ID IVAO Status How do i only have one of them? for each hub there is table like that. Would it be possible so there is only one table with all pilots in just one list? thanks Daniel Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 28, 2010 Administrators Report Share Posted October 28, 2010 Is there a way to get the name of the airport hub to not show up when there is no pilots based at that hub? If you look at it here: v you can see it says "There are no pilots based at this airport." Is there any way to keep the names of the airports with pilots based there and to stop the airports that have no pilots based at them from showing up? Thanks, james In that loop where it shows the pilots, you can do something like if(count($pilots) == 0) { echo 'No pilots based at this airport'; } 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.