Example #1
0
/* @var $this yii\web\View */
$this->title = 'User Roles';
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="row">
<?php 
Pjax::begin(['id' => 'container-pjax', 'timeout' => false]);
?>

    <!-- BEGIN customer portlet -->
    <div class="col-md-12">
    <?php 
Portlet::begin(['id' => 'user-portlet', 'title' => 'Users', 'subtitle' => 'showing all...', 'buttons' => [Html::a('<i class="fa fa-trash"></i>', ['user-role/delete-all'], ['title' => 'Delete All User Roles', 'class' => 'btn btn-circle red btn-sm', 'data-confirm' => 'Are you sure you want to delete all items?', 'data-method' => 'post', 'data-pjax' => 0])]]);
?>

    <?php 
echo GridView::widget(['id' => 'user-gridview', 'dataProvider' => $dataProvider, 'columns' => User::column()->username()->role()->actions('{update-user-role} {delete-user-role}')->all()]);
?>

    <?php 
Portlet::end();
?>
    </div>
    <!-- END customer portlet -->

<?php 
Pjax::end();
?>
</div>
Example #2
0
 /**
  * Lists all UserRole models.
  * @return mixed
  */
 public function actionIndex()
 {
     Yii::$app->user->setReturnUrl(['/' . $this->getRoute()]);
     $query = User::find()->byTenant()->hasAuth()->orderBy('username');
     return $this->render('index', ['dataProvider' => new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]])]);
 }