<title>Top Players - <?php echo Config::$_SITE_NAME; ?></title>
<?php
if(!defined('panel'))
	die('Nope.');
?>
</div>
	<div class="main-content">
			<div class="breadcrumbs" id="breadcrumbs">
				<script type="text/javascript">
					try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
				</script>

				<ul class="breadcrumb">
					<li>
						<i class="ace-icon fa fa-home home-icon"></i>
						<a href="<?php echo Config::$_PAGE_URL; ?>">Home</a>
					</li>
					<li class="active">Top players</li>
				</ul><!-- /.breadcrumb -->

				<div class="nav-search" id="nav-search">
					<form method="POST" action="search">
						<span class="input-icon">
							<input type="text" placeholder="Search ..." name="sname" id="username" type="submit" class="nav-search-input" autocomplete="on"> 
							<i class="ace-icon fa fa-search nav-search-icon"></i>
						</span>
					</form>
				</div> <!-- /.nav-search -->
			</div>	
			
<div class="page-content">
<div class="row-fluid"><div class="span12">
<div class="table-responsive">
<h2>Top players</h2>
<table class="table table-hover">
<tr class="alert-info table-bordered">
			<td>#</td>
			<td>Name</td>
			<td> </td>
			<td>Level</td>		
			<td>Played hours</td>
			<td>Respect points</td>
		</tr>
		</thead>
		<tbody>
			<?php
				$q = Config::$g_con->prepare('SELECT * FROM `users` ORDER BY `ConnectedTime` DESC LIMIT 100');
				$q->execute();
				$counter = 1; 
				while($row = $q->fetch(PDO::FETCH_OBJ)) {
					if($row->Status == 0) {
						$status = 'red';
					} if($row->Status == 1) {
						$status = 'green';
					} if($row->Status == 2) {
						$status = 'orange';
					}
					echo 
					"<tr>
						<td>". $counter ."</td>
						<td><i class='icon-circle light-". $status ." middle'></i> &nbsp; <a href='".Config::$_PAGE_URL.'profile/'.$row->id."'><font color='#0088CC'>{$row->name}</font></a></td>"; ?>
						<td>
						<?php if(Config::getID('users','Admin',$row->name) >= 6) { ?><span class="label label-success arrowed-in-right"><i class="icon-shield white"></i> owner </span><br/><?php } ?>
						<?php if(Config::getID('users','Admin',$row->name) > 0 && Config::getID('users','Admin',$row->name) <= 5) { ?><span class="label label-success arrowed-in-right"><i class="icon-shield white"></i> admin</span><br/><?php } ?>
						<?php if(Config::getID('users','Helper',$row->name) > 0) { ?><span class="label label-purple arrowed-in-right"><i class="icon-question-sign white"></i> helper</span><br/><?php } ?>
						<?php if(Config::getID('users','Leader',$row->name) > 0) { ?><span class="label label-purple arrowed-in-right"><i class="icon-group white"></i> faction leader</span><br/><?php } ?>
						</td>
					<?php echo"<td>{$row->Level}</td>
						<td>{$row->ConnectedTime}</td>
						<td>{$row->Respect}</td>
					</tr>";
				$counter++;
				}
			?>
		</tbody>
	</table>
</div>
