index.php 5.02 KB
<?php
use yii\helpers\Url;
use app\ht\widgets\LinkPager;

$this->title =  "管理日志";
$this->params['breadcrumbs'][] = '系统管理';
$this->params['breadcrumbs'][] =  $this->title;
?>

<div class="panel panel-default">
    <div class="panel-body">
        <form action="" method="get" id="search-form" class="filter-form">
            <table width="100%" class="table table-bordered">
                <tbody>
                <tr >
                    <td width="10%" class="text-right">操作人员:</td>
                    <td width="10%"  class="text-left">
                        <select  class="form-control" name="user_id">
                            <option value="0">全部</option>
                            <?php foreach ($sysUser as $item): ?>
                                <?php if(isset($item->id)) {?>
                                <option value="<?php echo $item->id ?>" <?php if ($gets['user_id'] == $item->id) { echo "selected"; } ?>><?php echo isset($item->username)?$item->username:'' ?></option>
                                <?php }?>
                            <?php endforeach; ?>
                        </select>
                    </td>
                    <td width="10%"  class="text-right">开始时间:</td>
                    <td width="20%" class="text-left"><input type="date" class="form-control" name="time_start" value="<?php if (!empty($gets['time_start'])){ echo $gets['time_start']; } ?>"></td>
                    <td width="10%"  class="text-right">结束时间:</td>
                    <td width="20%" class="text-left"><input type="date" class="form-control" name="time_end" value="<?php if (!empty($gets['time_end'])){ echo $gets['time_end']; } ?>"></td>
                </tr>
                <tr >
                    <td class="text-right">操作路由:</td>
                    <td class="text-left"><input type="text" class="form-control" name="route" value="<?php if (!empty($gets['route'])){ echo $gets['route']; } ?>"></td>
                    <td class="text-right">操作描述:</td>
                    <td class="text-left"><input type="text" class="form-control" name="description" value="<?php if (!empty($gets['description'])){ echo $gets['description']; } ?>"></td>
                    <td class="text-right">IP地址:</td>
                    <td class="text-left"><input type="text" class="form-control" name="ip" value="<?php if (!empty($gets['ip'])){ echo $gets['ip']; } ?>"></td>
                </tr>
                <tr class="search">
                    <td colspan="6"  class="text-center">
                        <button type="submit" class="btn btn-primary btncls" id="search"><i class="glyphicon glyphicon-search"></i> 查 询  </button>
                        <a class="btn btn-default btncls" href="<?=Url::toRoute("/system/admin-log/index")?>">重&nbsp;&nbsp;&nbsp;&nbsp;置</a>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>

<div class="panel panel-default">
    <div  class="panel-body">
        <table class="table table-striped table-bordered"  id="brand-table">
            <thead>
            <tr>
                <th width="6%">ID</th>
                <th width="10%">操作员</th>
                <th width="20%">访问路由</th>
                <th width="40%">操作描述</th>
                <th width="8%">IP地址</th>
                <th width="8%">创建时间</th>
                <th width="8%">更新时间</th>
            </tr>
            </thead>

            <tbody>
            <?php foreach ($adminLog as $log) : ?>
                <tr>
                    <td style="padding:12px;">
                        <?= $log['id'] ?>
                    </td>
                    <td style="padding:12px;">
                        <?= $log['username'] . '(' . $log['realname'] . ')' ?>
                    </td>
                    <td style="padding:12px;">
                        <?php
                        $route = $log['route'];
                        $route = preg_replace('/(.*)\?{1}([^\?]*)/i', '$1', $route);
                        ?>
                        <div><a title="<?= $log['route'] ?>"><?= $route ?></a></div>
                    </td>
                    <td style="padding:12px;">
                        <?= $log['description'] ?>
                    </td>
                    <td style="padding:12px;">
                        <?= $log['ip'] ?>
                    </td>
                    <td style="padding:12px;">
                        <?= date("Y-m-d H:i:s",$log['created_at']) ?>
                    </td>
                    <td style="padding:12px;">
                        <?= date("Y-m-d H:i:s",$log['updated_at']) ?>
                    </td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>

    <div class="panel-footer">
        <div class="hqy-panel-pager">
            <?= LinkPager::widget([
                'pagination' => $pages,
            ]); ?>
            <div class="clearfix"></div>
        </div>
    </div>
</div>