index.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. use yii\grid\GridView;
  3. use yii\helpers\Html;
  4. /* @var $this yii\web\View */
  5. /* @var $dataProvider yii\data\ActiveDataProvider */
  6. $this->title = '用户';
  7. $this->params['breadcrumbs'][] = $this->title;
  8. ?>
  9. <?php $this->beginBlock('content-header') ?>
  10. <?= $this->title . ' ' . Html::a('新用户', ['create'], ['class' => 'btn btn-primary btn-flat btn-xs']) ?>
  11. <?php $this->endBlock() ?>
  12. <!--搜索-->
  13. <?php echo $this->render('_search', ['model' => $searchModel]); ?>
  14. <div class="box box-primary">
  15. <div class="box-body">
  16. <?= GridView::widget([
  17. 'dataProvider' => $dataProvider,
  18. // 'filterModel' => $searchModel,
  19. 'columns' => [
  20. 'id',
  21. 'pid',
  22. 'nickname',
  23. [
  24. 'attribute' => 'avatar',
  25. "format" => [
  26. "image", [
  27. "width" => "60",
  28. "height" => "60",
  29. "class" => 'img-circle'
  30. ]
  31. ]
  32. ],
  33. // 'dataCount[0][count]:text:日课',
  34. [
  35. 'label' => '日课',
  36. 'format' => 'raw',
  37. 'value' => function ($model) {
  38. return $model->dataCount[0]['count'];
  39. },
  40. ],
  41. [
  42. 'label' => '总课',
  43. 'format' => 'raw',
  44. 'value' => function ($model) {
  45. return $model->dataCount[1]['count'];
  46. },
  47. ],
  48. [
  49. 'label' => '辅助课',
  50. 'format' => 'raw',
  51. 'value' => function ($model) {
  52. return $model->dataCount[2]['count'];
  53. },
  54. ],
  55. 'allRoleDesc:text:角色',
  56. 'tel',
  57. 'email',
  58. 'created_at:datetime',
  59. 'login_at:datetime',
  60. [
  61. 'class' => 'yii\grid\ActionColumn',
  62. 'template' => '{update} {delete}'
  63. ]
  64. ],
  65. ]); ?>
  66. </div>
  67. </div>