index.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. use yii\grid\GridView;
  3. use yii\helpers\Html;
  4. use yii\widgets\Pjax;
  5. /* @var $this yii\web\View */
  6. /* @var $dataProvider yii\data\ActiveDataProvider */
  7. /* @var $searchModel rbac\models\searchs\Assignment */
  8. $this->title = Yii::t('rbac', 'Users');
  9. $this->params['breadcrumbs'][] = $this->title;
  10. ?>
  11. <div class="assignment-index">
  12. <p>
  13. <?= Html::a(Yii::t('rbac', 'Create User'), ['/user/create'], ['class' => 'btn btn-success btn-flat']) ?>
  14. </p>
  15. <div class="box box-primary">
  16. <div class="box-body">
  17. <?php
  18. Pjax::begin();
  19. echo GridView::widget([
  20. 'dataProvider' => $dataProvider,
  21. 'filterModel' => $searchModel,
  22. 'columns' => [
  23. ['class' => 'yii\grid\SerialColumn'],
  24. [
  25. 'class' => 'yii\grid\DataColumn',
  26. 'attribute' => $usernameField,
  27. ],
  28. [
  29. 'class' => 'yii\grid\ActionColumn',
  30. 'template' => '{view} {update}',
  31. 'buttons' => [
  32. 'update' => function ($url, $model) {
  33. return Html::a('<span class="glyphicon glyphicon-pencil"></span>', [
  34. '/user/update',
  35. 'id' => $model->id,
  36. ], [
  37. 'title' => Yii::t('yii', 'Update'),
  38. 'aria-label' => Yii::t('yii', 'Update'),
  39. 'data-pjax' => '0',
  40. ]);
  41. },
  42. 'view' => function ($url, $model) {
  43. return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', [
  44. 'view',
  45. 'id' => $model->id,
  46. ], [
  47. 'title' => Yii::t('rbac', 'Assigned'),
  48. 'aria-label' => Yii::t('rbac', 'Assigned'),
  49. 'data-pjax' => '0',
  50. ]);
  51. },
  52. ],
  53. ],
  54. ],
  55. ]);
  56. Pjax::end();
  57. ?>
  58. </div>
  59. </div>
  60. </div>