<?php if ($this->_var['full_page']): ?>
<!-- $Id: users_list.htm 17053 2010-03-15 06:50:26Z sxc_shop $ -->
<?php echo $this->fetch('pageheader.htm'); ?>
<?php echo $this->smarty_insert_scripts(array('files'=>'../js/utils.js,listtable.js')); ?>
<div class="form-div">
  <form action="javascript:searchUser()" name="searchForm">
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
	&nbsp;狀態 <select name="status">
    <option value="-1"><?php echo $this->_var['lang']['select_all']; ?></option>
    <option value="0">上架</option>
    <option value="1">下架</option>
    </select>
	&nbsp;<?php echo $this->_var['lang']['label_user_name']; ?> &nbsp;<input type="text" name="keyword" placeholder="會員帳號/名稱/電話"/>
	  <input type="submit" value="<?php echo $this->_var['lang']['button_search']; ?>" />
  </form>
</div>

<form method="POST" action="" name="listForm" onsubmit="return confirm_bath()">

<!-- start users list -->
<div class="list-div" id="listDiv">
<?php endif; ?>
<!--用户列表部分-->
<table cellpadding="3" cellspacing="1">
  <tr>
    <th>
<!--      <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox"> -->
      <a href="javascript:listTable.sort('user_id'); "><?php echo $this->_var['lang']['record_id']; ?></a><?php echo $this->_var['sort_user_id']; ?>
    </th>
    <th><a href="javascript:listTable.sort('user_name'); "><?php echo $this->_var['lang']['username']; ?></a><?php echo $this->_var['sort_user_name']; ?></th>
    <th>名稱</th>
    <th>電話</th>
    <th>Email</th>
<!--		<th>地址</th>-->
    <th><a href="javascript:listTable.sort('reg_time'); ">建立日期</a><?php echo $this->_var['sort_reg_time']; ?></th>
    <th><a href="javascript:listTable.sort('last_time'); ">更新日期</a><?php echo $this->_var['sort_last_time']; ?></th>
		<th>是否上架</th>
		<th><?php echo $this->_var['lang']['handler']; ?></th>
  <tr>
  <?php $_from = $this->_var['user_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'user');if (count($_from)):
    foreach ($_from AS $this->_var['user']):
?>
  <tr>
    <td>
    	<!--<input type="checkbox" name="checkboxes[]" value="<?php echo $this->_var['user']['user_id']; ?>" notice="<?php if ($this->_var['user']['user_money'] != 0): ?>1<?php else: ?>0<?php endif; ?>"/>-->
    	<?php echo $this->_var['user']['user_id']; ?></td>
    <td class="first-cell">
					<span style="margin-bottom: 2px; line-height: 14px; display: block;"><?php echo htmlspecialchars($this->_var['user']['user_name']); ?></span>
						<!-- <?php if ($this->_var['user']['rank_name'] != null): ?> -->
						<!-- <?php if ($this->_var['user']['is_special'] == 0): ?> -->
						<span style="border: 1px #6DD26A solid; background-color: #6DD26A; padding: 1px 2px 0px 2px; color: white; display: inline; border-radius: 2px;"> <?php echo $this->_var['user']['rank_name']; ?> </span>
						<!-- <?php else: ?> -->
						<span style="border: 1px #FBB24E solid; background-color: #FBB24E; padding: 1px 2px 0px 2px; color: white; display: inline; border-radius: 2px;"> <?php echo $this->_var['user']['name']; ?> </span>
						<!-- <?php endif; ?> -->
						<!-- <?php endif; ?> -->
					<!-- <?php if ($this->_var['user']['enable'] == 1): ?> -->
						&nbsp;&nbsp;<span style="border: 1px #d6bd07 solid; background-color: #d6bd07; padding: 1px 2px 0px 2px; color: white; display: inline; border-radius: 2px;"> <?php echo $this->_var['lang']['enable_value_1']; ?> </span>
					<!-- <?php elseif ($this->_var['user']['enable'] == 2): ?> -->
						&nbsp;&nbsp;<span style="border: 1px #fd6017 solid; background-color: #fd6017; padding: 1px 2px 0px 2px; color: white; display: inline; border-radius: 2px;"> <?php echo $this->_var['lang']['enable_value_2']; ?> </span>
					<!-- <?php elseif ($this->_var['user']['enable'] == 3): ?> -->						
						&nbsp;&nbsp;<span style="border: 1px #b53c04 solid; background-color: #b53c04; padding: 1px 2px 0px 2px; color: white; display: inline; border-radius: 2px;"> <?php echo $this->_var['lang']['enable_value_3']; ?> </span>
					<!-- <?php endif; ?> -->

    </td>
    <td><?php echo $this->_var['user']['name']; ?></td>
    <td><?php echo $this->_var['user']['tel']; ?></td>
    <td><?php echo $this->_var['user']['email']; ?></td>
<!--    <td><?php echo $this->_var['user']['address']; ?></td>-->
	<td align="center"><?php echo $this->_var['user']['reg_time']; ?></td>
	<td align="center"><?php echo $this->_var['user']['last_time']; ?></td>
	<td align="center">
		<img src="images/<?php if ($this->_var['user']['status'] == '0'): ?>yes<?php else: ?>no<?php endif; ?>.gif" onclick="listTable.toggle(this, 'toggle_status', <?php echo $this->_var['user']['id']; ?>)" />
		</td>
		<td align="center">
	 <?php if ($this->_var['user']['web']): ?>		
      <a href="http://<?php echo $this->_var['user']['web']; ?>" target="_blank" title="網站前台">
      	網站前台
      </a>
	  <?php endif; ?>
      <a href="users.php?act=user_ad&id=<?php echo $this->_var['user']['user_id']; ?>" title="<?php echo $this->_var['lang']['view']; ?>">
      	廣告
      </a>
      <a href="../back/privilege.php?act=rsignin&uid=<?php echo $this->_var['user']['user_id']; ?>" target="_blank" title="網站後台">
      	網站後台
      </a>
      <a href="users.php?act=edit&id=<?php echo $this->_var['user']['user_id']; ?>" title="<?php echo $this->_var['lang']['edit']; ?>">
      	編輯
      </a>
      <a href="javascript:confirm_redirect('<?php if ($this->_var['user']['user_money'] != 0): ?><?php echo $this->_var['lang']['still_accounts']; ?><?php endif; ?><?php echo $this->_var['lang']['remove_confirm']; ?>', 'users.php?act=remove&id=<?php echo $this->_var['user']['user_id']; ?>')" title="<?php echo $this->_var['lang']['remove']; ?>">
      	刪除
      </a>
	</td>
  </tr>
  <?php endforeach; else: ?>
  <tr><td class="no-records" colspan="14"><?php echo $this->_var['lang']['no_records']; ?></td></tr>
  <?php endif; unset($_from); ?><?php $this->pop_vars();; ?>
  <tr>
      <td align="right" nowrap="true" colspan="15">
      <?php echo $this->fetch('page.htm'); ?>
      </td>
  </tr>
</table>

<?php if ($this->_var['full_page']): ?>
</div>
<!-- end users list -->
</form>
<script type="text/javascript" language="JavaScript">
<!--
listTable.recordCount = <?php echo $this->_var['record_count']; ?>;
listTable.pageCount = <?php echo $this->_var['page_count']; ?>;

<?php $_from = $this->_var['filter']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'item');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['item']):
?>
listTable.filter.<?php echo $this->_var['key']; ?> = '<?php echo $this->_var['item']; ?>';
<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>


onload = function()
{
    document.forms['searchForm'].elements['keyword'].focus();
    // 开始检查订单
}

/**
 * 搜索用户
 */
function searchUser()
{
    listTable.filter['keywords'] = Utils.trim(document.forms['searchForm'].elements['keyword'].value);
    listTable.filter['status'] = document.forms['searchForm'].elements['status'].value;;
    listTable.filter['page'] = 1;
    listTable.loadList();
}

function confirm_bath()
{
  userItems = document.getElementsByName('checkboxes[]');

  cfm = '<?php echo $this->_var['lang']['list_remove_confirm']; ?>';

  for (i=0; userItems[i]; i++)
  {
    if (userItems[i].checked && userItems[i].notice == 1)
    {
      cfm = '<?php echo $this->_var['lang']['list_still_accounts']; ?>' + '<?php echo $this->_var['lang']['list_remove_confirm']; ?>';
      break;
    }
  }

  return confirm(cfm);
}
//-->
</script>

<?php echo $this->fetch('pagefooter.htm'); ?>
<?php endif; ?>