<?php
/**
 * @var \yii\web\View $this
 * @var array $params
 * @var array $data
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>BIT System 后台管理平台</title>
    <?= $this->render('/common/css_js_main'); ?>
</head>
<body id="main">
<div class="main-nav"> <span class="fn-left">管理员列表 总记录数: <?= $data['totalCount'] ?> (共<?= $data['pageCount'] ?>页)</span> <span class="fn-right"><a href="javascript:history.go(-1);"><i class="icon-chevron-left"></i>返回</a></span>
    <div class="fn-clear"></div>
</div>
<form id="list-form" action="/cp/admin/list" method="get">
    <div class="main-content">
        <div class="main-action-bar">
            <a class="btn fn-left" href="/cp/admin/add"><i class="icon-plus"></i>添加</a>
            <div class="fn-left">
                &nbsp;&nbsp;搜索：
                <select name="searchBy" class="span1">
                    <option value="username" <?= $params['searchBy'] == 'username' ? 'selected="selected"' : '' ?> >用户名</option>
                    <option value="email" <?= $params['searchBy'] == 'email' ? 'selected="selected"' : '' ?> >邮箱</option>
                </select>
                &nbsp;
            </div>
            <input type="text" name="keyword" value="<?= $params['keyword'] ?>" class="input-medium search-query fn-left" autocomplete="off">
            <button id="search-button" type="submit" class="btn fn-left">Search</button>
            &nbsp;&nbsp;每页显示：
            <select name="pageSize" id="page-size" class="span1">
                <option value="10" <?= $params['pageSize'] == 10 ? 'selected="selected"' : '' ?> >
                    10
                </option>
                <option value="20" <?= $params['pageSize'] == 20 ? 'selected="selected"' : '' ?> >
                    20
                </option>
                <option value="50" <?= $params['pageSize'] == 50 ? 'selected="selected"' : '' ?> >
                    50
                </option>
                <option value="100" <?= $params['pageSize'] == 100 ? 'selected="selected"' : '' ?> >
                    100
                </option>
            </select>
        </div>
        <div class="form-or-table">
            <table id="list-table" class="table table-striped table-bordered">
                <thead>
                <tr>
                    <th class="table-checkbox"><input type="checkbox" class="all-check"></th>
                    <th><a href="javascript:;" class="sort" name="username">用户名</a></th>
                    <th><a href="javascript:;" class="sort" name="email">E-mail</a></th>
                    <th><a href="javascript:;" class="sort" name="login_date">最后登录时间</a></th>
                    <th><a href="javascript:;" class="sort" name="login_ip">最后登录IP</a></th>
                    <th class="table-action">操作</th>
                </tr>
                </thead>
                <tbody>
                <?php if (!empty($data['dataList'])) : ?>
                    <?php foreach ($data['dataList'] as $k => $v) : ?>
                        <tr>
                            <td><input name="ids" type="checkbox" value="<?= $v['id'] ?>"></td>
                            <td><?= $v['username'] ?></td>
                            <td><?= $v['email'] ?></td>
                            <td><?= $v['login_date'] ?></td>
                            <td><a href="http://www.ip138.com/ips138.asp?ip=<?= $v['login_ip'] ?>" target="_blank"><?= $v['login_ip'] ?></a></td>
                            <td><?= $v['status'] ?></td>
                            <td><a href="/cp/admin/edit?id=<?= $v['id'] ?>"><i class="icon-edit"></i> 编辑</a></td>
                        </tr>
                    <?php endforeach; ?>
                <?php else : ?>
                    <tr><td colspan="7">没有数据</td></tr>
                <?php endif; ?>
                </tbody>
            </table>

            <?php if ($data['pageCount'] > 1) : ?>
                <div class="main-footer-action-bar"> <a id="delete-button" class="btn fn-left" url="/cp/admin/delete" disabled=""><i class="icon-trash"></i> 删除</a>
                    <?= $this->render('/common/pager', ['pageCount' => $data['pageCount']]) ?>
                </div>
            <?php endif; ?>
        </div>
    </div>
    <input type="hidden" name="pageNumber" id="page-number" value="<?= $params['pageNumber'] ?>" />
    <input type="hidden" name="orderBy" id="order-by" value="<?= $params['orderBy'] ?>" />
    <input type="hidden" name="order" id="order" value="<?= $params['order'] ?>" />
</form>
<div id="delete-modal" class="modal hide fade" style="display: none; ">
    <div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
        <p><strong>您确定要删除吗?</strong></p>
    </div>
    <div class="modal-body">
        <p>删除之后将不可恢复,请确定!</p>
    </div>
    <div class="modal-footer"> <a href="javascript:;" id="delete-modal-sure-btn" class="btn btn-primary">确定</a> <a href="javascript:;" class="btn" data-dismiss="modal">返回</a> </div>
</div>
</body>
</html>