Ejemplo n.º 1
0
use app\helpers\grid\ActionColumn;
use app\helpers\grid\CheckboxColumn;
/* @var $this yii\web\View */
/* @var $searchModel app\models\AdminSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $id string */
$this->title = '用户列表';
$this->params['breadcrumbs'][] = $this->title;
$id = 'admin-grid';
?>
<div class="row">
  <div class="col-sm-12 admin-index">
    <?php 
echo GridView::widget(['id' => $id, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::className()], 'id', 'username', 'realname', ['attribute' => 'admin_role_id', 'filter' => $honors, 'content' => function ($model, $key, $index, $column) use($honors) {
    return isset($honors[$model['admin_role_id']]) ? $honors[$model['admin_role_id']] : '';
}], ['attribute' => 'parent_id', 'content' => function ($model, $key, $index, $column) {
    return $model['parent'] ? $model['parent']['username'] : '******';
}], 'status:boolean', 'last_time:datetime', ['class' => ActionColumn::className(), 'template' => '{view} {update} {delete} {password}']]]);
?>
  </div>
</div>
<?php 
$this->beginBlock('js');
?>
<script>
jQuery(function($) {
  'use strict';
  
  $('#<?php 
echo $id;
?>
Ejemplo n.º 2
0
<?php

use yii\helpers\Html;
use app\helpers\grid\GridView;
use app\helpers\grid\ActionColumn;
use app\helpers\grid\CheckboxColumn;
/* @var $this yii\web\View */
/* @var $searchModel app\models\AdminRoleSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $id string */
$this->title = '角色列表';
$this->params['breadcrumbs'][] = $this->title;
$id = 'admin-role-grid';
?>
<div class="row">
  <div class="col-sm-8 admin-role-index">
    <?php 
echo GridView::widget(['id' => $id, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => CheckboxColumn::className()], 'id', 'honor', ['attribute' => 'admin_id', 'content' => function ($model, $key, $index, $column) {
    return isset($model['admin']['username']) ? $model['admin']['username'] : '';
}], ['class' => ActionColumn::className(), 'template' => '{view} {update} {delete}']]]);
?>
  </div>
</div>