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?
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?
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!
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
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
some other tc va sended the link to the real and they got a nice letter from their office
![]()
BACK UP PILOTS_LIST.TPL
Delete everything in pilots_list
Copy all this code into it:
<?php $roster = PilotData::GetAllPilotsDetailed($start='', $limit=50) ?> <?php if(!$roster) { echo 'There are no pilots!'; return; } ?> <?php foreach($roster as $pilot) { ?> <?php } ?>| Pilot ID | Name | Rank | Flights | Hours | HUBs |
|---|---|---|---|---|---|
|
|
|
<?php echo $pilot->totalflights?> | <?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?> | <?php echo $pilot->hub?> |
If it doesn’t work restore the backup.
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!
then probably your pilots aren’t in a hub
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.
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.
The cleanest is
$all_pilots = PilotData::findPilots(array());
But, they all return the same data.
http://virtualthomascook.com/index.php/pilots
Ok were slowly getting there :S
Any idea why its doing that?
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.
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>
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?
Nope there just one entry ![]()
How are you calling this? Is this the whole tpl file, or is it embedded in another using a call?
I just edited the pilots_list.tpl thats all i edited so its called the same as before?
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.
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');
}