list.php 4.57 KB
<?php
use yii\web\View;
use yii\helpers\Html;

$this->title = $this->params['main_title'].'-'.$this->params['sub_title'];
?>
<?php
$this->registerCssFile('/css/select2.css',array('postion'=>View::POS_END));

$this->registerJsFile('/js/select2.min.js',array('postion'=>View::POS_END));
?>
<script type="text/javascript">
<?php $this->beginBlock('javascript');?>
jQuery(document).ready(function() {
    // Select2
    jQuery(".select-basic").select2();

});
<?php 
$this->endBlock();
$this->registerJs($this->blocks['javascript'],View::POS_END)
?>
</script>

<div class="col-md-6">
    <form id="form" method="POST" action="">
        <div class="panel panel-default">
            <div class="panel-body">
                    <div class="row">
                        <div class="form-group">
                            <div class="col-sm-4">
                                <input type="text" name="username" class="form-control" required="required" placeholder="用户名">
                            </div>
                            <div class="col-sm-5">
                                <input type="text" name="email" class="form-control" required="required" placeholder="邮箱">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4">
                                <input type="password" name="password" class="form-control" required="required" placeholder="密码">
                            </div>
                            <div class="col-sm-5">
                                <?php echo Html::dropDownList('role', null,$roles, ['class' => 'width300 select-basic']);?>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-3">
                                <button class="btn btn-primary mr5" id="upload_button" onclick="return confirm('确定加入?')">加入</button>
                            </div>
                        </div>
                    </div><!-- row -->
            </div><!-- panel-body -->
        </div><!-- panel -->
    </form>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="table-responsive">
            <table class="table mb30">
                <thead>
                    <tr style="white-space:nowrap">
                        <th><input type="checkbox" onclick="checkall(this)">选择</th>
                        <th>用户名</th>
                        <th>邮箱</th>
                        <th>权限</th>
                        <th>状态</th>
                        <th>加入时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($list as $model):?>
                    <tr data-stock="1" data-source="1" data-status="2" data-id="5011880">
                        <td><input type="checkbox" value="<?=$model->id?>" name="room[]"></td>
                        <td><?=$model->username?></td>
                        <td><?=$model->email?></td>
                        <td><?=$model->role?></td>
                        <td><?=$model->status?></td>
                        <td style="white-space:nowrap"><?=date('Y-m-d H:i:s',$model->create_time)?></td>
                        <td>
                            
                            <?php if (!in_array($model->username,['admin','super_admin'])):?>
                            
                            <a href="/live/roomedit/<?=$model->id?>" class="btn btn-default btn-white">编辑</a>
                         
                            <?php if ($model->status == 0)://未开始?>
                            <a onclick="return confirm('启用用户?')" href="/admin/operate/<?=$model->id?>?type=enable" class="btn btn-success btn-metro">启用</a>
                            <?php else:?>
                            <a onclick="return confirm('禁用用户?')" href="/admin/operate/<?=$model->id?>?type=disable" class="btn btn-danger btn-metro">禁用</a>
                            <?php endif;?>
                            
                            <a onclick="return confirm('删除用户?')" href="/admin/operate/<?=$model->id?>?type=del" class="btn btn-danger btn-metro">删除</a>
                            
                            <?php endif;?>
                        </td>
                    </tr>
                    <?php endforeach;?>
                </tbody>
            </table>
        </div>
        <!-- table-responsive -->
    </div>
    <!-- col-md-12 -->
</div>