<!-- начало пользователи -->
<div id="admin_users_main">
	<h1>Список пользователей</h1>
	<div class="btn-group">
		<a class="btn btn-default" title="добавить пользователя"  href="{url action="add"}"><img src="/skins/default/images/icons/user_add.png" alt="добавить пользователя" /></a>
		<a class="btn btn-default" title="найти клонов по ip"  href="{url action="clones" var1=1 var2=1}"><img src="/skins/default/images/icons/user_find_clones.png" alt="найти клонов ip" /></a>
		{if $_cfg.module.login.use_ec}
			<a class="btn btn-default" title="найти клонов по кукам"  href="{url action="clones_ec" var1=10}"><img src="/skins/default/images/icons/user_find_clones.png" alt="найти клонов по кукам" /></a>
		{/if}
	</div>

	<form method="get" action="{url}" class="form-inline">
		<p class="input-append">
			<input class="input-medium search-query" type="text" name="search" value="{$smarty.get.var3|default:$smarty.get.search|escape}" />
			<button class="btn btn-default" type="submit">Найти</button>
		</p>
	</form>



	{if $smarty.get.var3}<div><a href="{url}">все пользователи</a></div>{/if}
	<form method="post" action="#">
		<div><input type="hidden" name="token" value="{$_user->token}" /></div>
	<table id="users" class="table table-striped">
		<colgroup>
			<col style="width:18px" />
			<col />
			<col />
			<col style="width:150px" />
			<col />
			<col style="width:18px" />
			<col />
		</colgroup>
		<thead>
			<tr>
				<th></th>
				<th><a href="{if $smarty.get.var2<1}{url action='users' var1=$pager.current var2=1 var3=$smarty.get.var3}{else}{url action='users' var1=$pager.current var2=0 var3=$smarty.get.var3}{/if}">id</a></th>
				<th><a href="{if $smarty.get.var2==2}{url action='users' var1=$pager.current var2=3 var3=$smarty.get.var3}{else}{url action='users' var1=$pager.current var2=2 var3=$smarty.get.var3}{/if}">Имя</a></th>
				<th style="width:150px"><a href="{if $smarty.get.var2==4}{url action='users' var1=$pager.current var2=5 var3=$smarty.get.var3}{else}{url action='users' var1=$pager.current var2=4 var3=$smarty.get.var3}{/if}">Группа</a></th>
				<th><a href="{if $smarty.get.var2==6}{url action='users' var1=$pager.current var2=7 var3=$smarty.get.var3}{else}{url action='users' var1=$pager.current var2=6 var3=$smarty.get.var3}{/if}">email</a></th>
				<th><a href="{if $smarty.get.var2==8}{url action='users' var1=$pager.current var2=9 var3=$smarty.get.var3}{else}{url action='users' var1=$pager.current var2=8 var3=$smarty.get.var3}{/if}">статус</a></th>
				{if access('delete')}<th><img src="/skins/default/images/icons/simple_delete.png" alt="удалить" /></th>{/if}
			</tr>
		</thead>
		{foreach $users as $user}
		<tr>
			<td>{if $user->group_id==1}<img src="/skins/default/images/icons/superadmin_small.png" alt="{$user->group_name|escape}" />{else}<img src="/skins/default/images/icons/user_small.png" alt="пользователь" />{/if}</td>
			<td>{$user->id}</td>
			<td><a href="{url action="edit" var1=$user->id}">{$user->login|escape}</a></td>
			<td style="white-space:nowrap">{$user->group_name|escape}</td>
			<td><a href="mailto:{$user->email|escape}">{$user->email}</a></td>
			<td>{$statuses[$user->status]}</td>
			<td>{if $user->status>=0}<input type="checkbox" name="delete[{$user->id}]" />{/if}</td>
		</tr>
		{/foreach}
		<tr>
			<td colspan="{if access('delete')}7{else}6{/if}"><input class="btn btn-default pull-right" type="submit" value="Удалить" /></td>
		</tr>
	</table>
	</form>
	
	{if $pager.pages}
	<div class="navigate">
		{foreach $pager.pages as $page}
			{if !$page} ... {elseif $page==$pager.current}
				<b>{$page}</b>	
			{else}
				<a href="{url action='users' var1=$page var2=$smarty.get.var2 var3=$smarty.get.var3}">{$page}</a>
			{/if}
			{if !$page@last}|{/if}
		{/foreach}
	</div>
	{/if}
</div>
<!-- конец пользователи -->