Jump to content

List of Pilots online


MAT

Recommended Posts

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

  • Like 1
Link to comment
Share on other sites

	<?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!smile.gif

Link to comment
Share on other sites

  • 2 years later...
  • 3 weeks later...

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

Link to comment
Share on other sites

  • 11 months later...

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.

pilotsonline.png

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

  • Like 2
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...