<div class="white_container">
	
	<h2 style="margin-bottom:20px;"><i class="fa fa-user"></i><span> <?php echo Lang::get('users.users'); ?></span></h2>

	<div class="table-responsive">
		<table class="table table-striped">
			<tr class="table-header">
				<th><?php echo Lang::get('common.username'); ?></th>
				<th><?php echo Lang::get('common.num_of_flags'); ?></th>
				<th><?php echo Lang::get('common.actions'); ?></th>
				<?php foreach($users as $user): ?>
				<tr>
					<td><a href="<?php echo URL::to('user') . '/' . $user->username; ?>" target="_blank">
						<?php if(strlen($user->username) > 40){
								echo substr($user->username, 0, 40) . '...';
							  } else {
							  	echo $user->username;
							  }
						?>
						</a>
					</td>
					<td>
						<?php echo $user->totalFlags(); ?>
					</td>
					<td>
						<?php if($user->active): ?>
							<a href="<?php echo URL::to('admin/deactivate_user') . '/' . $user->id; ?>" class="btn btn-xs btn-danger"><span class="fa fa-minus-circle"></span> <?php echo Lang::get('admin.disable_user'); ?></a>
						<?php else: ?>
							<a href="<?php echo URL::to('admin/activate_user') . '/' . $user->id; ?>" class="btn btn-xs btn-success"><span class="fa fa-plus-circle"></span> <?php echo Lang::get('admin.enable_user'); ?></a>
						<?php endif; ?>
					</td>
					
				</tr>
				<?php endforeach; ?>
		</table>
	</div>
	
</div>