<!-- начало пользователи -->
<div id="admin_users_main">
	<h1>Список пользователей</h1>
	<div><a title="добавить пользователя"  href="{url action="add"}"><img src="/skins/default/images/icons/user_add.png" alt="добавить пользователя" /></a><a title="найти клонов"  href="{url action="clones" var1=1 var2=1}"><img src="/skins/default/images/icons/user_find_clones.png" alt="найти клонов" /></a></div>

	<form method="get" action="{url}">
		<p>
			<input type="text" name="search" value="{$smarty.get.var3|default:$smarty.get.search|escape}" />
			<input type="submit" value="Найти" />
		</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">
		<colgroup>
			<col width="18" />
			<col />
			<col />
			<col width="150" />
			<col />
			<col width="18" />
		</colgroup>
		<tr>
			<td></td>
			<td><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></td>
			<td><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></td>
			<td 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></td>
			<td><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></td>
			{if $access_delete}<td><img src="/skins/default/images/icons/simple_delete.png" alt="удалить" /></td>{/if}
		</tr>
		{foreach $users as $user}
		<tr>
			<td>{if $user.group_id==1}<img src="/skins/default/images/icons/superadmin_small.png" alt="суперадминистратор" />{else}<img src="/skins/default/images/icons/user_small.png" alt="пользователь" />{/if}</td>
			<td>{$user.user_id}</td>
			<td><a href="{url action="edit" var1=$user.user_id}">{$user.login|escape}</a></td>
			<td><select class="status" name='group_id[{$user.user_id}]'>
				{foreach $possible_groups as $group_id=>$group}
					<option{if $group_id==$user.group_id} selected="selected"{/if}{if $group.disabled} disabled="disabled"{/if} value="{$group_id}">{$group.name_html}</option>
				{/foreach}</select></td>
			<td><a href="mailto:{$user.email|escape}">{$user.email}</a></td>
			<td><input type="checkbox" name="delete[{$user.user_id}]" /></td>
		</tr>
		{/foreach}
		<tr>
			<td colspan="6"><input 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>
<!-- конец пользователи -->