{{function name="countPages" iPages=1 iPageNumber=1 sUrl="" sUrl2=""}}
	{{if $iPageNumber > 1}}
		<a href="{{$sUrl}}{{if $iPageNumber > 2}}&amp;iPage={{$iPageNumber - 1}}{{/if}}{{$sUrl2}}">&laquo;&nbsp;{{$lang.pages_prev}}</a>
	{{/if}}
	{{$iPaginationSpacer = false}}
	{{section name=pages start=1 loop=$iPages+1 step=1}}
		{{if $smarty.section.pages.index != $iPageNumber && (abs($smarty.section.pages.index - $iPageNumber) <= $config.pagination_counter_admin || $smarty.section.pages.index <= $config.pagination_counter_admin || $smarty.section.pages.index >=  + $iPages - $config.pagination_counter_admin + 1)}}
			<a href="{{$sUrl}}{{if $smarty.section.pages.index > 1}}&amp;iPage={{$smarty.section.pages.index}}{{/if}}{{$sUrl2}}">{{$smarty.section.pages.index}}</a>
		{{$iPaginationSpacer = false}}
		{{elseif $smarty.section.pages.index == $iPageNumber}}
			<strong>{{$smarty.section.pages.index}}</strong>
		{{else}}
			{{if $iPaginationSpacer === false}}
			<strong>...</strong>
			{{$iPaginationSpacer = true}}
			{{/if}}
		{{/if}}
	{{/section}}
	{{if $iPageNumber < $iPages}}
		<a href="{{$sUrl}}&amp;iPage={{$iPageNumber + 1}}{{$sUrl2}}">{{$lang.pages_next}}&nbsp;&raquo;</a>
	{{/if}}
{{/function}}

<h1>{{$lang.Users}}</h1>
<a href="?p=users-form" class="new_element">{{$lang.New_client}}</a>
<div class="filter">
<form method="get" id="users-search-form">
	<input type="hidden" name="p" value="users-list" />
	<label for="product-search">{{$lang.search}}</label>
	<input type="text" name="sPhrase" value="{{$_GET.sPhrase}}" />
	<label><input type="checkbox" name="iAnon" value="1" {{if $_GET.iAnon}}checked="checked"{{/if}} class="checkbox" /> {{$lang.Anon_show}}</label>
	<button type="submit" class="submit" name="p" value="users-list-export-xml">{{$lang.Export}} XML</button>
	<button type="submit" class="submit" name="p" value="users-list-export-csv">{{$lang.Export}} Excel</button>
	<input type="submit" class="submit" value="{{$lang.search}}" />
</form>
<div class="clear"></div>
</div>
{{if count( $aUsers.aUsers ) > 0}}
	<table class="list" id="users">
		<thead>
			<tr><td class="pages" colspan="8">{{if $aUsers.aPagesCountData.iCount > 1}}{{$lang.Pages}}: {{countPages iPages=$aUsers.aPagesCountData.iCount iPageNumber=$aUsers.aPagesCountData.iPageNumber sUrl='admin.php?p=users-'|cat:$a sUrl2=$sUrlExt}}{{/if}}</td></tr>
			<tr><th class="id">{{$lang.Id}}</th><th class="name">{{$lang.First_surname}}</th><th class="name">{{$lang.Company}}</th><th>{{$lang.Login}}</th><th class="email">{{$lang.Email}}</th><th class="date">{{$lang.Register_time}}</th><th>{{$lang.Group}}</th><th class="actions">{{$lang.Actions}}</th></tr>
		</thead>
		<tfoot>
			<tr><td class="pages" colspan="8">{{if $aUsers.aPagesCountData.iCount > 1}}{{$lang.Pages}}: {{countPages iPages=$aUsers.aPagesCountData.iCount iPageNumber=$aUsers.aPagesCountData.iPageNumber sUrl='admin.php?p=users-'|cat:$a sUrl2=$sUrlExt}}{{/if}}</td></tr>
		</tfoot>
		<tbody>
			{{foreach from=$aUsers.aUsers item=aUser}}
				<tr>
					<td class="id">{{$aUser.iUser}}</td><td class="name"><a href="?p=users-form&amp;iUser={{$aUser.iUser}}">{{$aUser.sLastName}} {{$aUser.sFirstName}}</a></td><td class="name">{{$aUser.sCompanyName}}</td><td class="login">{{$aUser.sLogin}}</td><td class="mail"><a href="mailto:{{$aUser.sEmail}}">{{$aUser.sEmail}}</a></td><td class="date">{{$aUser.iRegisterTime}}</td>
					<td>{{$aUser.sGroups}}</td>
					<td class="actions">
						<a href="?p=users-login&amp;iUser={{$aUser.iUser}}"><img src="{{$config.dir_templates}}images/888888_ffffff_ff8400/ico_login.png" alt="{{$lang.Login_as}}" title="{{$lang.Login_as}}" /></a>
						<a href="?p=orders-list&amp;sPhrase=&amp;iStatus=&amp;iUser={{$aUser.iUser}}"><img src="{{$config.dir_templates}}admin/images/ico/invoice.png" alt="{{$lang.Display_orders}}" title="{{$lang.Display_orders}}" /></a>
						<a href="?p=users-form&amp;iUser={{$aUser.iUser}}" class="user-edit"><img src="{{$config.dir_templates}}admin/images/ico/edit.png" alt="{{$lang.Edit}}" title="{{$lang.Edit}}" /></a>
						<a href="?p=users-delete&amp;iUser={{$aUser.iUser}}" class="user-delete delete"><img src="{{$config.dir_templates}}admin/images/ico/delete.png" alt="{{$lang.Delete}}" title="{{$lang.Delete}}" /></a>
					</td>
				</tr>
			{{/foreach}}
		</tbody>
	</table>
{{else}}
	<div class="msg" id="error">
		<img src="{{$config.dir_templates}}admin/images/ico/msg_error.png" class="imgv" alt="" /> {{$lang.Data_not_found}}
	</div>
{{/if}}