Advertisement
CalcioNit

user-index.php

Oct 21st, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.38 KB | None | 0 0
  1. <?php
  2.  
  3. use yii\helpers\Html;
  4. use yii\grid\GridView;
  5. use yii\jui\DatePicker;
  6.  
  7. /* @var $this yii\web\View */
  8. /* @var $searchModel common\models\UserSearch */
  9. /* @var $dataProvider yii\data\ActiveDataProvider */
  10.  
  11. $this->title = Yii::t('app', 'Users');
  12. $this->params['breadcrumbs'][] = $this->title;
  13. ?>
  14. <div class="user-index">
  15.     <p>
  16.         <?= Html::a(Yii::t('app', 'Create User'), ['create'], ['class' => 'btn btn-success']) ?>
  17.     </p>
  18.  
  19.     <?= GridView::widget([
  20.         'dataProvider' => $dataProvider,
  21.         'filterModel' => $searchModel,
  22.         'columns' => [
  23.             [
  24.                 'attribute' => 'id',
  25.                 'headerOptions' => ['class' => 'col-sm-1 text-center'],
  26.                 'contentOptions' => ['class' => 'text-center'],
  27.             ],
  28.             [
  29.                 'attribute' => 'username',
  30.                 'headerOptions' => ['class' => 'col-sm-1 text-center'],
  31.                 'contentOptions' => ['class' => 'text-center'],
  32.             ],
  33.             'email:email',
  34.             [
  35.                 'attribute' => 'status',
  36.                 'filter' => $searchModel->getUserStatus(),
  37.                 'format' => 'userStatusHighlighted',
  38.                 'headerOptions' => ['class' => 'col-sm-2 text-center'],
  39.                 'contentOptions' => ['class' => 'text-center'],
  40.             ],
  41.             [
  42.                 'attribute' => 'created_at',
  43.                 'filter' => '<div class="drp-container input-group">'.
  44.                 DatePicker::widget([
  45.                     'model' => $searchModel,
  46.                     'attribute'=>'created_at',
  47.                     'language' => 'pt-BR',
  48.                     'dateFormat' => 'dd/MM/yyyy',
  49.                     'options' => [
  50.                         'class' => 'form-control'
  51.                     ],
  52.                 ]) . '<span class="input-group-addon">
  53.                    <i class="glyphicon glyphicon-calendar"></i></span>
  54.                </div>',
  55.                 'format' => 'date',
  56.                 'headerOptions' => ['class' => 'col-sm-2 text-center'],
  57.                 'contentOptions' => ['class' => 'text-center'],
  58.             ],
  59.             [
  60.                 'attribute' => 'updated_at',
  61.                 'format' => 'date',
  62.                 'filter' => '<div class="drp-container input-group">'.
  63.                 DatePicker::widget([
  64.                     'model' => $searchModel,
  65.                     'attribute'=>'updated_at',
  66.                     'language' => 'pt-BR',
  67.                     'dateFormat' => 'dd/MM/yyyy',
  68.                     'options' => [
  69.                         'class' => 'form-control'
  70.                     ],
  71.                 ]) . '<span class="input-group-addon">
  72.                    <i class="glyphicon glyphicon-calendar"></i></span>
  73.                </div>',
  74.                 'headerOptions' => ['class' => 'col-sm-2 text-center'],
  75.                 'contentOptions' => ['class' => 'text-center'],
  76.             ],
  77.  
  78.             [
  79.                 'class' => 'yii\grid\ActionColumn',
  80.                 'header' => 'Actions',
  81.                 'headerOptions' => ['class' => 'col-sm-1 text-center'],
  82.                 'contentOptions' => ['class' => 'text-center'],
  83.                 'template' => '{view} {update} {delete} {change-password}',
  84.                 'buttons' => [
  85.                     'delete' => function ($url, $model) {
  86.                         return Html::a('<span class="glyphicon glyphicon-trash text-danger"></span>', $url, [
  87.                             'name' => 'Delete',
  88.                             'data-confirm' => sprintf(
  89.                                 'Do you wish delete user %s?',
  90.                                 $model->username
  91.                             ),
  92.                             'data-method' => 'POST'
  93.                         ]);
  94.                     },
  95.                     'change-password' => function ($url, $model) {
  96.                         return '&nbsp;' . Html::a('<span class="glyphicon glyphicon-lock text-warning"></span>', $url, [
  97.                             'name' => 'Change password',
  98.                             'data-confirm' => sprintf(
  99.                                 'Are you sure you want to change the password user %s?',
  100.                                 $model->username
  101.                             ),
  102.                         ]);
  103.                     },
  104.                 ]
  105.             ],
  106.         ],
  107.     ]); ?>
  108.  
  109.  
  110. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement