本文整理匯總了PHP中common\models\User::getStatuses方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getStatuses方法的具體用法?PHP User::getStatuses怎麽用?PHP User::getStatuses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common\models\User
的用法示例。
在下文中一共展示了User::getStatuses方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
<?php
use common\models\User;
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\search\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('backend', 'Users');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?php
echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => 'User']), ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', 'username', 'email:email', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => User::getStatuses(), 'filter' => User::getStatuses()], 'created_at:datetime', 'logged_at:datetime', ['class' => 'yii\\grid\\ActionColumn']]]);
?>
</div>
示例2:
<?php
use common\models\User;
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\search\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('backend', '用戶管理');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<!-- <?php
echo Html::a(Yii::t('backend', '創建用戶', ['modelClass' => 'User']), ['create'], ['class' => 'btn btn-success']);
?>
-->
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', ['attribute' => 'username', 'label' => '用戶名'], ['attribute' => 'email', 'label' => '郵箱'], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => User::getStatuses(), 'filter' => User::getStatuses(), 'label' => '狀態'], ['attribute' => 'created_at', 'label' => '創建時間', 'format' => 'datetime'], ['attribute' => 'logged_at', 'label' => '登錄時間', 'format' => 'datetime'], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
</div>