Jump to content

Recommended Posts

Posted

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?

Posted

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!

  • Moderators
Posted

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

  • Like 1
Posted

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.

Posted

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!

  • Administrators
Posted

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.  ;)

  • Administrators
Posted

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.

Posted

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>

  • Administrators
Posted

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?

  • Administrators
Posted

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.

Posted

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');
}

  • Administrators
Posted

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

  • 8 months later...
Posted

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!

post-933-034883200 1285934174_thumb.jpg

  • Administrators
Posted

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

Posted

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?

Posted

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 :D

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?

  • 3 weeks later...
Posted

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

Posted

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

Posted

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

  • Administrators
Posted

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'; }

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...