RichardRodgers Posted July 31, 2015 Report Share Posted July 31, 2015 Hi guys, I have several HUBS set up for my VA (http://www.rafairuk....ndex.php/pilots), but like us all I have a number of inactive or 0 hour pilots on roster. What I am trying to do is put all the pilots who I feel need to not be shown in the main rosters into on HUB that can then be hidden. That is the easy part and I can do that no probs. What I cant do is sort out the coding so that my current Rosters page will not display the HUB I have called "Holding Sqn" I have searched for something like this and the only thing I can find mentions something like "Skip it in the foreach loop in the pilot_list.tpl file". That may well be the answer but I have now clue how to implement it in my pilots_list.tpl code. I would be gratefuf if someone could poss point me in the right direction on this. Here is my current coding:- <h3><?php echo $title?></h3> <?php if(!$allpilots) { echo 'There are no pilots!'; return; } ?> <table id="tabledlist" class="tablesorter"> <thead> <tr> <th>Pilot ID</th> <th>Name</th> <th>Rank & Awards</th> <th>Joined</th> <th>Flights</th> <th>Hours</th> <th>Last Flight</th> <th>Status</th> </tr> </thead> <tbody> <?php foreach($allpilots as $pilot) { /* To include a custom field, use the following example: <td> <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?> </td> For instance, if you added a field called "IVAO Callsign": echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign'); */ // To skip a retired pilot, uncomment the next line: //if($pilot->retired == 1) { continue; } ?> <tr> <td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> <td> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" /> <?php echo $pilot->firstname.' '.$pilot->lastname?> </td> <td align="center"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td> <td align="center"><?php echo $pilot->joindate?></td> <td align="center"><?php echo $pilot->totalflights?></td> <td align="center"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td> <td align="center"><?php echo $pilot->lastpirep?></td> <td><?php if($pilot->retired == '1') {echo '<img src="'.SITE_URL.'/lib/skins/rafairuk/images/red_thumbs_button_b.jpg" alt="warning" /> - Inactive';} else {echo '<img src="'.SITE_URL.'/lib/skins/rafairuk/images/green_thumbs_button_b.jpg" alt="warning" /> - Active';} ?></td> <?php } ?> </tbody> </table> Thanks guys Richard Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted July 31, 2015 Moderators Report Share Posted July 31, 2015 You can use the "philosophy" it already has (commented) for the retired pilots. <h3><?php echo $title?></h3> <?php if(!$allpilots) { echo 'There are no pilots!'; return; } ?> <table id="tabledlist" class="tablesorter"> <thead> <tr> <th>Pilot ID</th> <th>Name</th> <th>Rank & Awards</th> <th>Joined</th> <th>Flights</th> <th>Hours</th> <th>Last Flight</th> <th>Status</th> </tr> </thead> <tbody> <?php foreach($allpilots as $pilot) { /* To include a custom field, use the following example: <td> <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?> </td> For instance, if you added a field called "IVAO Callsign": echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign'); */ // To skip a retired pilot, uncomment the next line: //if($pilot->retired == 1) { continue; } if($pilot->hub == 'Set here the ICAO of the HUB') {echo continue; } ?> <tr> <td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> <td> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" /> <?php echo $pilot->firstname.' '.$pilot->lastname?> </td> <td align="center"><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td> <td align="center"><?php echo $pilot->joindate?></td> <td align="center"><?php echo $pilot->totalflights?></td> <td align="center"><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td> <td align="center"><?php echo $pilot->lastpirep?></td> <td><?php if($pilot->retired == '1') {echo '<img src="'.SITE_URL.'/lib/skins/rafairuk/images/red_thumbs_button_b.jpg" alt="warning" /> - Inactive';} else {echo '<img src="'.SITE_URL.'/lib/skins/rafairuk/images/green_thumbs_button_b.jpg" alt="warning" /> - Active';} ?></td> <?php } ?> </tbody> </table> Quote Link to comment Share on other sites More sharing options...
RichardRodgers Posted July 31, 2015 Author Report Share Posted July 31, 2015 Thank you bud. That works great. I just need to set things in the Pilots.php so that it will not display the heading name for that HUB Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted July 31, 2015 Moderators Report Share Posted July 31, 2015 Then i think that you can straight add the if statement (and make the required changes) on your Pilot.php file. If you exclude the hub from the beginning, you will not have to add the if statement on the pilots_list file. 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.