Jump to content

Pilot Hub List


dimitris

Recommended Posts

  • Administrators

To collect the data you can use the existing PilotData class ->

<?php $pilots = PilotData::getAllPilotsByHub('EDDF'); ?>

Then you will have the $pilots variable loaded with just the pilots from EDDF and you can use it to display them in a table or whatever you would like.

Link to comment
Share on other sites

hello !

thank you simpilot :P i try it but no results <_< me code is :

<h3>Thessaloniki Airport  (LGTS)</h3>
<?php $pilots = PilotData::getAllPilotsByHub('LGTS'); ?>
<table id="tabledlist" class="tablesorter" width="800" border="0">
 <tr>
   <th>Pilot</th>
   <th>Country</th>
<th>Rank</th>
 </tr>
 <tr>
   <td><?php echo ($pilots->code, $pilots->pilotid); ?></td>
   <td><img src="<?php echo Countries::getCountryImage($pilot->location);?>"
		alt="<?php echo Countries::getCountryName($pilot->location);?>" /></td>
   <td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td>
 </tr>
</table>

but without any success... can you help me ?

Link to comment
Share on other sites

  • Administrators

You need to break up your $pilots array with a foreach loop. You have $pilots in some places and $pilot in others. You really should have the datacall back in the controller as well, not in the template but if you are using the cms/page function I see why you are doing it this way. Try this, I just did a quick clean up but it should work, you will have to style it to exactly what you want.

<h3>Thessaloniki Airport  (LGTS)</h3>
<?php $pilots = PilotData::getAllPilotsByHub('LGTS'); ?>
<table id="tabledlist" class="tablesorter" width="800" border="0">
   <tr>
       <th>Pilot</th>
       <th>Country</th>
       <th>Rank</th>
   </tr>
   <?php
   foreach ($pilots as $pilot) {
   ?>
       <tr>
           <td><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid); ?></td>
           <td><img src="<?php echo Countries::getCountryImage($pilot->location); ?>"
                    alt="<?php echo Countries::getCountryName($pilot->location); ?>" /></td>
           <td><img src="<?php echo $pilot->rankimage ?>" alt="<?php echo $pilot->rank; ?>" /></td>
       </tr>
   <?php
   }
   ?>
</table>

  • Like 1
Link to comment
Share on other sites

You need to break up your $pilots array with a foreach loop. You have $pilots in some places and $pilot in others. You really should have the datacall back in the controller as well, not in the template but if you are using the cms/page function I see why you are doing it this way. Try this, I just did a quick clean up but it should work, you will have to style it to exactly what you want.

<h3>Thessaloniki Airport  (LGTS)</h3>
<?php $pilots = PilotData::getAllPilotsByHub('LGTS'); ?>
<table id="tabledlist" class="tablesorter" width="800" border="0">
   <tr>
       <th>Pilot</th>
       <th>Country</th>
       <th>Rank</th>
   </tr>
   <?php
   foreach ($pilots as $pilot) {
   ?>
       <tr>
           <td><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid); ?></td>
           <td><img src="<?php echo Countries::getCountryImage($pilot->location); ?>"
                    alt="<?php echo Countries::getCountryName($pilot->location); ?>" /></td>
           <td><img src="<?php echo $pilot->rankimage ?>" alt="<?php echo $pilot->rank; ?>" /></td>
       </tr>
   <?php
   }
   ?>
</table>

You are the BEST !!!! Thank you so much !!!! working :P also if i want to show the pireps i can use this code ?

<?php $pireps = PirepData::getAllPirepsByHub('LGTS'); ?>

?

Link to comment
Share on other sites

You need to break up your $pilots array with a foreach loop. You have $pilots in some places and $pilot in others. You really should have the datacall back in the controller as well, not in the template but if you are using the cms/page function I see why you are doing it this way. Try this, I just did a quick clean up but it should work, you will have to style it to exactly what you want.

<h3>Thessaloniki Airport  (LGTS)</h3>
<?php $pilots = PilotData::getAllPilotsByHub('LGTS'); ?>
<table id="tabledlist" class="tablesorter" width="800" border="0">
   <tr>
       <th>Pilot</th>
       <th>Country</th>
       <th>Rank</th>
   </tr>
   <?php
   foreach ($pilots as $pilot) {
   ?>
       <tr>
           <td><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid); ?></td>
           <td><img src="<?php echo Countries::getCountryImage($pilot->location); ?>"
                	alt="<?php echo Countries::getCountryName($pilot->location); ?>" /></td>
           <td><img src="<?php echo $pilot->rankimage ?>" alt="<?php echo $pilot->rank; ?>" /></td>
       </tr>
   <?php
   }
   ?>
</table>

Thanks Simpilot! I've always wanted a dynamic Hub page but just couldn't figure it out. This has helped me at least get the ball rolling. I am also interested in having a list of the last 50 PIREPS for that hub as well as a list of 50 schedules leaving that hub.

I did some research on the forums and some goolging using PirepData::getAllPirepsByHub and boy did I make a mess. LOL. I spent over an hour on different things with no luck. I have to say this is fun but I just wish I could get this to stick in my head.

Anyways, thanks for getting me started on this.

Keith

Link to comment
Share on other sites

  • Administrators

Thanks Keith,

try putting a

print_r($yourvariable);

right after your datacall and see what is available to you as far as field names, I believe it should be everything out of that table for PIREPS. Then you can break up the array using a foreach loop, then display what you want using

echo $yourvariable->fieldname

Link to comment
Share on other sites

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