<div class="sidebar float-left">
	<div class="block navigation">
		<div class="header">
			Навигация <i aria-hidden="true" class="fa fa-align-justify float-right"></i>
		</div>
		<? echo $desing['left_menu']; ?>
	</div>
	<div class="block navigation ulist">
		<div class="header">
			Игровые сервера <i aria-hidden="true" class="fa fa-steam float-right"></i>
		</div>
		{servers}
	</div>
	<div class="last-events m-b-25">
		<div class="header">
			Последние события <i aria-hidden="true" class="fa fa-bullhorn float-right"></i>
		</div>
		<div id="lastsignup"></div>
	</div>
	<div class="block">
		<div class="header">
			Последние на форуме
			<i class="fa fa-commenting float-right" aria-hidden="true"></i>
		</div>
		<div id="lastforum"></div>
	</div>
	<div class="block">
		<div class="header">
			Пользователи онлайн
			<span class="float-right" id="users_online_number"></span>
		</div>
		<div class="online-users" id="online_users"></div>
		{func Widgets:online_users()}
	</div>
	<div class="block">
		<div class="header">
			Топ 5 пользователей
			<i class="fa fa-trophy float-right" aria-hidden="true"></i>
		</div>
		<div class="top-users" id="topusers"></div>
	</div>
</div>

<script>
	jQuery(document).ready(function($)
	{
		load_banlist('{start}', '{server}', '');
		server_info('{server}');
	});

	function server_info(id)
	{
		$.ajax({
			type: 'POST',
			url: '../templates/SquareLine/php/server.php',
			data: 'token='+$('#token').val()+'&id='+id,
			success: function(data)
			{
				$('#server_info').html(data);
			}
		});
	}

	function load_banlist(start, server, nick)
	{
		$.ajax({
			type: 'POST',
			url: '../templates/SquareLine/php/banlist.php',
			data: 'token='+$('#token').val()+'&start='+start+'&server='+server+'&nick='+nick,
			success: function(data)
			{
				if(nick == '')
					$('#pages').show();

				if(data.indexOf('<td') != -1)
					$('#bans thead').show();
				else
					$('#bans thead').hide();

				$('#bans').show();
				$('#bans tbody').html(data);

				if(data.indexOf('<td') == -1)
					$('#bans > tbody > div').addClass('m-l-5 m-b-5 m-r-5 m-t-5');
			}
		});
	}

	function search_player()
	{
		$('#pages').hide();

		load_banlist('0', '{server}', $('#data_player').val());
	}
</script>

<? if('{empty}' != '1'){ ?>
<div class="content float-right">
	<div id="server_info"></div>

	<div class="block">
		<div class="header">Статистика</div>
		<div class="block-content">
			<table class="table-list">
				<tbody>
					<tr>
						<td width="25%" align="center"><b>Всего банов:</b> {count}шт.</td>
						<td width="25%" align="center"><b>Активных:</b> {count_active}шт.</td>
						<td width="25%" align="center"><b>Перманентных:</b> {count_permanent}шт.</td>
						<td align="center"><b>Временных:</b> {count_temporal}шт.</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
	<div class="block">
		<div class="header">Поиск игрока</div>
		<div class="block-content">
			<div class="form-input">
				<label for="class">Введите ник / steam_id / ip</label>
				<input type="text" id="data_player">
			</div>
			<div class="message-send">
				<div class="btn float-left" onclick="search_player()">Выполнить поиск</div>
			</div>

			<div class="clear"></div>
		</div>
	</div>
	<div class="block">
		<div class="header">Бан лист</div>
		<? if('{error}' == ''){ ?>
		<table class="table-list th">
			<thead>
					<tr>
					<th align="left" width="20%">Ник</th>
					<th align="left" width="30%">Причина</th>
					<th align="left" width="90">Срок</th>
					<th align="left">Дата окончания</th>
					<th align="left" width="20%">Админ</th>
					</tr>
			</thead>
			{func GetData:banlist("{start}","{server}","{limit}")}
		</table>
		<? } else { ?>
			<div class="block-content">
				<div class="bs-callout bs-callout-error bs-mini"><p>{error}</p></div>
			</div>
		<? } ?>
	</div>

	<center><div id="pages">{pagination}</div></center>
</div>
<? } else { ?>
	<div class="content float-right">
		<div class="block-content">
			<div class="bs-callout bs-callout-error bs-mini"><p>Бан лист пуст. Сервера не привязаны к источникам информации.</p></div>
		</div>
	</div>
<? } ?>