index.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * Author: lf
  4. * Blog: https://blog.feehi.com
  5. * Email: job@feehi.com
  6. * Created at: 2016-03-23 17:51
  7. */
  8. /**
  9. * @var $this yii\web\View
  10. * @var $dataProvider yii\data\ActiveDataProvider
  11. * @var $searchModel backend\models\search\AdminUserSearch
  12. */
  13. use backend\grid\DateColumn;
  14. use backend\grid\GridView;
  15. use common\models\User;
  16. use backend\widgets\Bar;
  17. use backend\grid\CheckboxColumn;
  18. use backend\grid\ActionColumn;
  19. $this->title = 'Users';
  20. $this->params['breadcrumbs'][] = Yii::t('app', 'Users');
  21. ?>
  22. <div class="row">
  23. <div class="col-sm-12">
  24. <div class="ibox">
  25. <?= $this->render('/widgets/_ibox-title') ?>
  26. <div class="ibox-content">
  27. <?= Bar::widget([
  28. 'template' => '{refresh} {create} {delete}',
  29. ]) ?>
  30. <?= GridView::widget([
  31. 'dataProvider' => $dataProvider,
  32. 'filterModel' => $searchModel,
  33. 'columns' => [
  34. [
  35. 'class' => CheckboxColumn::className(),
  36. ],
  37. [
  38. 'attribute' => 'id',
  39. ],
  40. [
  41. 'attribute' => 'username',
  42. ],
  43. [
  44. 'attribute' => 'email',
  45. ],
  46. [
  47. 'attribute' => 'status',
  48. 'label' => Yii::t('app', 'Status'),
  49. 'value' => function ($model) {
  50. if($model->status == User::STATUS_ACTIVE){
  51. return Yii::t('app', 'Normal');
  52. }else if( $model->status == User::STATUS_DELETED ){
  53. return Yii::t('app', 'Disabled');
  54. }
  55. },
  56. 'filter' => User::getStatuses(),
  57. ],
  58. [
  59. 'class' => DateColumn::className(),
  60. 'attribute' => 'created_at',
  61. ],
  62. [
  63. 'class' => DateColumn::className(),
  64. 'attribute' => 'updated_at',
  65. ],
  66. [
  67. 'class' => ActionColumn::className(),
  68. 'width' => '190px',
  69. ],
  70. ]
  71. ]); ?>
  72. </div>
  73. </div>
  74. </div>
  75. </div>