Jump to content

staff online


Virtualei

Recommended Posts

Hi everyone,

I was wondering if anyone would be able to help me. On my site I have the normal pilots online,guests online. I would like to be able to show staff members online. has anyone any ideas. I have simpilots staff module so maybe i could use it in some way

All help appreciated . Thanks in advance

  • Like 1
Link to comment
Share on other sites

  • Moderators

I don't have the simpilot staff module though, but this can be little bit easier for everyone....

This code will only show staff online. ;)

<?php
$staff = StatsData::UsersOnline();
foreach($staff as $pilot)
{
if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN))
{
?>
<a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a><br />
<?php
}
}
?>

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • Moderators

If you had searched the forum, you would have found the solution without bumping the topic!!

	    <?php
    $shown = array();
   foreach($usersonline as $pilot)  
    {
	    if(in_array($pilot->pilotid, $shown))
		    continue;
    else
		    $shown[] = $pilot->pilotid;	     
    ?>

Link to comment
Share on other sites

Your code did help a little but wasn't quite correct. Thanks for the bit that did help.

If you had searched the forum, you would have found the solution without bumping the topic!!

Maybe if you had read the question correctly you would have realized what I was asking :rolleyes:

Here is the full code for anyone interested.

Thank you

<?php
$shown = array();
$staff = StatsData::UsersOnline();
foreach($staff as $pilot)
{
if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN))
{
if(in_array($pilot->pilotid, $shown))
						 continue;
		 else
						 $shown[] = $pilot->pilotid;
?>
<a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a><br />
<?php
}
}
?>	

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 months later...

OK...

<?php

$shown = array();

$staff = StatsData::UsersOnline();

foreach($staff as $pilot)

{

if(PilotGroups::group_has_perm(PilotGroups::getUserGroups($pilot->pilotid), ACCESS_ADMIN))

{

if(in_array($pilot->pilotid, $shown))

continue;

else

$shown[] = $pilot->pilotid;

?>

<a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a><br />

<?php

}

}

?>

How to insert a condition if ... "no staff online"? thanks for any response...

Link to comment
Share on other sites

  • 1 month later...
  • 2 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>			 

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