<{include file="file:admin_style.css"}>
<script type="text/javascript">
	function setSort(sortkey,order){
		document.usersearchList.sortkey.value = sortkey;
		document.usersearchList.newOrder.value = order;
		document.usersearchList.action = 'index.php?action=UserSearchList&key='+sortkey+'&order='+order;
		document.usersearchList.method = 'post';
		document.usersearchList.submit();
	}
	function pageSubmit(val){
		document.usersearchList.action = val;
		document.usersearchList.method = 'post';
		document.usersearchList.submit();
	}
	function searchAgainSubmit(){
		document.usersearchList.action = 'index.php?action=UserSearch&searchType=1';
		document.usersearchList.submit();
	}
		
</script>

<div class="adminnavi">
  <a href="./index.php"><{$smarty.const._MI_USER_NAME}></a>
  &raquo;&raquo; <a href="./index.php?action=UserSearch"><{$smarty.const._MI_USER_ADMENU_USER_SEARCH}></a>
  &raquo;&raquo; <span class="adminnaviTitle"><{$smarty.const._AD_USER_LANG_USER_SEARCH_LIST}></span>
</div>

<h3 class="admintitle"><{$smarty.const._AD_USER_LANG_USER_SEARCH_LIST}></h3>
<form name="usersearchList" method="post">
<input type="hidden" name="sortkey" value="<{$sortkey}>"/>
<input type="hidden" name="newOrder" value="<{$order}>"/>
<ul class="toptab">
  <li><a href="index.php?action=UserEdit"><{$smarty.const._AD_USER_LANG_USER_NEW}></a></li>
<!--  <li><a href="#"><{$smarty.const._AD_USER_LANG_IMPORT}></a></li>
  <li><a href="#"><{$smarty.const._AD_USER_LANG_EXPORT}></a></li> -->
  <li><a href="#" onclick="searchAgainSubmit();"><{$smarty.const._AD_USER_LANG_SEARCH_AGAIN}></a></li>
  <li><a href="index.php?action=MailjobEdit"><{$smarty.const._AD_USER_LANG_SEND_MAIL_BY_THIS_CONDITION}></a></li>
</ul>

<table class="outer">
  <tr>
    <th>&nbsp;</th>
    <th><{$smarty.const._MD_USER_LANG_UID}><br />
    <input type="image" src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" 
  		onclick="setSort('uid','ASC');"/>
      	<input type="image" src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" 
      	onclick="setSort('uid','DESC');"/></th>
    <th><{$smarty.const._MD_USER_LANG_UNAME}><br />
      <input type="image" src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" 
  		onclick="setSort('uname','ASC');"/>
      	<input type="image" src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" 
      	onclick="setSort('uname','DESC');"/></th>
    <th><{$smarty.const._MD_USER_LANG_NAME}><br />
      <input type="image" src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" 
  		onclick="setSort('name','ASC');"/>
      	<input type="image" src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" 
      	onclick="setSort('name','DESC');"/></th>
    <th><{$smarty.const._AD_USER_LANG_REGDATE}><br />
      <input type="image" src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" 
  		onclick="setSort('user_regdate','ASC');"/>
      	<input type="image" src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" 
      	onclick="setSort('user_regdate','DESC');"/></th>
    <th><{$smarty.const._AD_USER_LANG_LASTLOGIN}><br />
      <input type="image" src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" 
  		onclick="setSort('last_login','ASC');"/>
      	<input type="image" src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" 
      	onclick="setSort('last_login','DESC');"/></th>
    <th><{$smarty.const._MD_USER_LANG_POSTS}><br />
      <input type="image" src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" 
  		onclick="setSort('posts','ASC');"/>
      	<input type="image" src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" 
      	onclick="setSort('posts','DESC');"/></th>
    <th><{$smarty.const._MD_USER_LANG_LEVEL}><br />
      <input type="image" src="<{"icons/up.png"|theme}>" alt="<{$smarty.const._ASCENDING}>" title="<{$smarty.const._ASCENDING}>" 
  		onclick="setSort('level','ASC');"/>
      	<input type="image" src="<{"icons/down.png"|theme}>" alt="<{$smarty.const._DESCENDING}>" title="<{$smarty.const._DESCENDING}>" 
      	onclick="setSort('level','DESC');"/></th>
    <th><{$smarty.const._AD_USER_LANG_CONTROL}></th>
  </tr>
  <{foreach item=user from=$userList}>
    <tr class="<{cycle values='odd,even'}>">
      <td class="<{$dirname}>_list_image"><img src="<{"icons/user.png"|theme}>" alt="<{$smarty.const._AD_USER_LANG_USER}>" title="<{$smarty.const._AD_USER_LANG_USER}>" /></td>
      <td class="<{$dirname}>_list_id"><{$user.uid}></td>
      <td class="<{$dirname}>_list_name"><{$user.uname|xoops_escape}></td>
      <td class="<{$dirname}>_list_name"><{$user.name|xoops_escape}></td>
      <td class="<{$dirname}>_list_date"><{$user.user_regdate|xoops_formattimestamp}></td>
      <td class="<{$dirname}>_list_date"><{$user.last_login|xoops_formattimestamp:l}></td>
      <td class="<{$dirname}>_list_number"><{$user.posts}></td>
      <td class="<{$dirname}>_list_order">
      <{assign var='userLevel' value=$smarty.const._AD_USER_LANG_LEVEL_INACTIVE}>
      <{if $user.level eq 1}>
      	 <{assign var='userLevel' value=$smarty.const._AD_USER_LANG_LEVEL_PENDING}>
      <{elseif $user.level eq 2}>
      	 <{assign var='userLevel' value=$smarty.const._AD_USER_LANG_LEVEL_ACTIVE}>
      <{elseif $user.level eq 5}>
      	 <{assign var='userLevel' value=$smarty.const._AD_USER_LANG_LEVEL_ROOT}>
      <{/if}>		 	 
      <{$userLevel}>
      </td>
      <td class="user_list_control">
        <a href="./index.php?action=UserView&amp;uid=<{$user.uid}>"><img src="<{"icons/property.png"|theme}>" alt="<{$smarty.const._VIEW}>" title="<{$smarty.const._VIEW}>" /></a>
        <a href="./index.php?action=UserEdit&amp;uid=<{$user.uid}>"><img src="<{"icons/edit.png"|theme}>" alt="<{$smarty.const._EDIT}>" title="<{$smarty.const._EDIT}>" /></a>
        <{if $user.uid != 1 }>
          <a href="index.php?action=UserDelete&amp;uid=<{$user.uid}>"><img src="<{"icons/delete.png"|theme}>" alt="<{$smarty.const._DELETE}>" title="<{$smarty.const._DELETE}>" /></a>
        <{/if}>
        <{if $user.uid != $userId && $user.activate == 2}>
        <a href="<{$xoops_url}>/modules/<{$dirname}>/index.php?action=userSu&uid=<{$user.uid}>"><img src="<{"icons/update.png"|theme}>" alt="<{$smarty.const._AD_USER_LANG_ACCOUNT_CHANGE}>" title="<{$smarty.const._AD_USER_LANG_ACCOUNT_CHANGE}>" /></a>
        <{/if}>
      </td>
    </tr>
  <{/foreach}>
</table>

<!-- set search data-->
<{if $hiddenData}>
	<{foreach item=hiddenValue key=key from=$hiddenData}>
	<{if is_array($hiddenValue)}>
		<{foreach item=v from=$hiddenValue}>
			<input type="hidden" name="<{$key|cat:'[]'}>" value="<{$v}>">
		<{/foreach}>
	<{else}>
		<input type="hidden" name="<{$key}>" value="<{$hiddenValue}>">
	<{/if}>
	<{/foreach}>
<{/if}>

<!-- page -->
<{if $pagenavi}>
	<table>
		<tr>
			<td align="center">
	<{if $page neq 1}>
		<{foreach item=pageValue key=key from=$pagenavi}>
			<{if $key eq $page-1}>
			<a href="#" onclick="pageSubmit('<{$pageValue}>');">&laquo;</a>
			<{/if}>
		<{/foreach}>
	<{/if}>	
	
	<{assign var='counter' value=1}>	
	<{assign var='offset' value=4}>
	<{assign var='totalPages' value=$pagenavi|@count}>
	<{foreach item=pageValue key=key from=$pagenavi}>
	<{if $counter eq $page}>
		<strong>(<{$key}>)</strong>
	<{elseif ($counter>$page-$offset && $counter<$page+$offset)||$counter eq 1||$counter eq $totalPages}>	
		<{if $counter eq $totalPages && $page<$totalPages-$offset}>
		...
		<{/if}>
		<a href="#" onclick="pageSubmit('<{$pageValue}>');"><{$counter}></a>
		<{if $counter eq 1 && $page>1+$offset}>
		...
		<{/if}>
	<{/if}>
	<{assign var='counter' value=$counter+1}>
	<{/foreach}>
	
	<{if $page neq $pagenavi|@count}>
		<{foreach item=pageValue key=key from=$pagenavi}>
			<{if $key eq $page+1}>
			<a href="#" onclick="pageSubmit('<{$pageValue}>');">&raquo;</a>
			<{/if}>
		<{/foreach}>
	<{/if}>
			</td>		
		</tr>
	</table>
<{/if}>
</form>

