MAT Posted September 14, 2010 Report Share Posted September 14, 2010 Hello All, Does anybody have the code for this? I cannot remember which VA it was on but it shows a list of all pilot's online Thanks! Quote Link to comment Share on other sites More sharing options...
MrAmsterdam Posted September 15, 2010 Report Share Posted September 15, 2010 Is this the right location to post a request?? Anyway, i would like to know this too :-) Regards Lucas Quote Link to comment Share on other sites More sharing options...
Alex Posted September 15, 2010 Report Share Posted September 15, 2010 <?php $usersonline = StatsData::UsersOnline(); $guestsonline = StatsData::GuestsOnline(); ?> <h4>Pilots Online</h4> <?php $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; echo "<p>"; echo '<img src="'.Countries::getCountryImage($pilot->location).'" alt="'.Countries::getCountryName($pilot->location).'" />'; echo " {$pilot->firstname} {$pilot->lastname}<br />"; echo "</p>"; } ?> <h4>Guests Online</h4> <p class="txt-red10">Currently <?php echo count($guestsonline);?> guest(s) visiting. would be something like this 1 Quote Link to comment Share on other sites More sharing options...
MAT Posted September 15, 2010 Author Report Share Posted September 15, 2010 <?php $usersonline = StatsData::UsersOnline(); $guestsonline = StatsData::GuestsOnline(); ?> <h4>Pilots Online</h4> <?php $shown = array(); foreach($usersonline as $pilot) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; echo "<p>"; echo '<img src="'.Countries::getCountryImage($pilot->location).'" alt="'.Countries::getCountryName($pilot->location).'" />'; echo " {$pilot->firstname} {$pilot->lastname}<br />"; echo "</p>"; } ?> <h4>Guests Online</h4> <p class="txt-red10">Currently <?php echo count($guestsonline);?> guest(s) visiting. would be something like this works fine, thanks! Quote Link to comment Share on other sites More sharing options...
Stealthbird97 Posted November 4, 2012 Report Share Posted November 4, 2012 Any way of adding a link to the pilots profile in this? Quote Link to comment Share on other sites More sharing options...
Stealthbird97 Posted November 7, 2012 Report Share Posted November 7, 2012 anyone know ^ Quote Link to comment Share on other sites More sharing options...
Felipe Posted November 22, 2012 Report Share Posted November 22, 2012 anyone know ^ In the line... echo " {$pilot->firstname} {$pilot->lastname}<br />"; ... do like this: echo "<a href=\"http://your-domain.com/index.php/profile/view/". $pilot->pilotid ."\"> {$pilot->firstname} {$pilot->lastname}</a><br />"; Quote Link to comment Share on other sites More sharing options...
Tom Posted November 23, 2012 Report Share Posted November 23, 2012 In the line... echo " {$pilot->firstname} {$pilot->lastname}<br />"; ... do like this: echo "<a href=\"http://your-domain.com/index.php/profile/view/". $pilot->pilotid ."\"> {$pilot->firstname} {$pilot->lastname}</a><br />"; Best to make use of the url function: echo '<a href="'.url('/profile/view/'.$pilot->pilotid).'"> '.$pilot->firstname.' '.$pilot->lastname.'</a><br />'; Quote Link to comment Share on other sites More sharing options...
Stealthbird97 Posted November 23, 2012 Report Share Posted November 23, 2012 Thanks! Would there be a way of getting it to say " No Pilots Online" if there are no pilots online? Quote Link to comment Share on other sites More sharing options...
Sava Posted November 25, 2012 Report Share Posted November 25, 2012 You can put the enitre code for dispalying in an if statement. if ($usersonline) { before the foreach loop amd then close it } else echo 'no pilots online'; Quote Link to comment Share on other sites More sharing options...
Stealthbird97 Posted November 26, 2012 Report Share Posted November 26, 2012 Thanks Sava! Quote Link to comment Share on other sites More sharing options...
LuxuryCEO Posted December 1, 2012 Report Share Posted December 1, 2012 were do i put this code what file ?? Quote Link to comment Share on other sites More sharing options...
Stealthbird97 Posted December 4, 2012 Report Share Posted December 4, 2012 Depends where you want it to show up. you could put in in your Layout.tpl or maybe the frontpage_main.tpl. It can go on any page, Quote Link to comment Share on other sites More sharing options...
warpennys Posted November 7, 2013 Report Share Posted November 7, 2013 PILOTS ONLINE and STAFF ONLINE with avatar, country, and link to profile It was late, so the only thing to add in this code is to have the counts show '0' when there are no pilots to count for staff and pilots online. Know that an admin must have access to your admin panel in order to be included in the Staff Online side of the table. Also, the pic below is not accurate, but only the first attempt. The code posted has been fixed to show staff only on the left and pilots only on the right. Also, the only problem with the code is the counts. Guests are counted correctly, however when a pilot or staff member is online with kacars and flying a flight, they are counted again, so when it says there's 2 there is actually only 1. If anyone can find a fix or knows of a fix, this code would be 100%. Thank You. <table class="(to your favorite table style in your css)" border="0" align="center" width="100%" height="300"> <th colspan="1" align="center" class="(to your favorite th style in your css)">Pilots Online</th> <tr> <td> <table align="center" width="100%" style="text-align:center; background-color: #F1AD43; font-weight: bold; color: #000000; height: 10px;"> <tr> <td>STAFF ONLINE</td> <td>PILOTS ONLINE</td> </tr> </table> <table border="0" align="center" width="100%" height="150"> <tr> <!-- ==================================================VVVV STAFF ONLINE VVVV============================================== --> <td align="left" width="50%" style="padding-left: 100px;"> <div style="overflow-y: auto; overflow-x: hidden; height: 150px; background: transparent;"> <?php $shown = array(); $staff = StatsData::UsersOnline(); foreach($staff as $pilot) { if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN) == true) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; ?> <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>" title="Visit Pilots Profile"><img style="padding-bottom: 2px; border: 1px; border-radius: 4px;" align="center" height="28px" width="28px" src="<?php echo PilotData::getPilotAvatar($pilot->pilotid);?>"/> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" title="<?php echo Countries::getCountryName($pilot->location);?>" /> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' - ' .$pilot->firstname . ' ' . $pilot->lastname?> </a><br /> <?php } } if(count($shown) < 1){ echo '<br /><br /><br /><h3><font color="#ff0000"><p style="padding-left: 50px;">No Staff Online</p></font></h3>'; } ?> </div> </td> <!-- ==================================================VVVV PILOTS ONLINE VVVV============================================== --> <td align="left" width="50%" style="padding-left: 100px;"> <div style="overflow-y: auto; overflow-x: hidden; height: 150px; background: transparent;"> <?php $shown = array(); $usersonline = StatsData::UsersOnline(); foreach($usersonline as $pilot) { if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN) == false) { if(in_array($pilot->pilotid, $shown)) continue; else $shown[] = $pilot->pilotid; ?> <a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>" title="Visit Pilots Profile"><img style="padding-bottom: 2px; border: 1px; border-radius: 4px;" align="center" height="28px" width="28px" src="<?php echo PilotData::getPilotAvatar($pilot->pilotid);?>"/> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" title="<?php echo Countries::getCountryName($pilot->location);?>" /> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' - ' .$pilot->firstname . ' ' . $pilot->lastname?> </a><br /> <?php } } if(count($shown) < 1){ echo '<br /><br /><br /><h3><font color="#ff0000"><p style="padding-left: 50px;">No Pilots Online</p></font></h3>'; } ?> </div> </td> </tr> </table> </td> </tr> <tr> <td> <hr /> <?php $userCount = 0; $staffCount = 0; $guestsonline = count(StatsData::GuestsOnline()); $pilots = StatsData::UsersOnline(); foreach($pilots as $staff){ if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($staff->pilotid), ACCESS_ADMIN) == true) { $staffCount++; }else{ $userCount++; } } ?> <p align="center"> <b> <font color="#F1AD43">Staff Online:</font> <font color="#00FF00"><?php echo $staffCount; ?></font> <font color="#F1AD43">Pilots Online:</font> <font color="#00FF00"><?php echo $userCount; ?></font> <font color="#F1AD43">Guests Online:</font> <font color="#00FF00"><?php echo $guestsonline; ?></font> </b> </p> <br /> </td> </tr> </table> 2 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.