本文整理匯總了PHP中backend\models\User::getStatusName方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getStatusName方法的具體用法?PHP User::getStatusName怎麽用?PHP User::getStatusName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類backend\models\User
的用法示例。
在下文中一共展示了User::getStatusName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: function
<div class="user-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?php
echo Html::a('Добавить пользователя', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'id', 'headerOptions' => ['class' => 'col-md-1']], ['attribute' => 'username', 'format' => 'raw', 'value' => function ($model) {
return Html::a($model->username, 'user/view?id=' . $model->id, ['target' => '_blank']);
}], 'name', ['attribute' => 'status', 'format' => 'raw', 'value' => function ($model) {
if ($model->status == 10) {
$class = 'text-success';
} else {
$class = 'text-danger';
}
return '<span class="' . $class . '">' . User::getStatusName($model->status) . '</span>';
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>
</div>
示例2: date
?>
</h1>
<p>
<?php
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
<?php
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
<?php
if (Yii::$app->user->can('admin')) {
echo Html::a('Изменить пароль', ['password-change', 'id' => $model->id], ['class' => 'btn btn-primary']);
}
?>
</p>
<?php
$status = User::getStatusName($model->status);
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'username', 'name', 'email:email', ['attribute' => 'status', 'format' => 'raw', 'value' => $model->status == 10 ? '<span class="label label-success">' . $status . '</span>' : '<span class="label label-danger">' . $status . '</span>'], ['attribute' => 'created_at', 'value' => date('d-M-Y H:i:s', $model->created_at)], ['attribute' => 'updated_at', 'value' => date('d-M-Y H:i:s', $model->updated_at)]]]);
echo Html::tag('p', 'Назначенные роли');
$auth = AuthAssignment::findAll(['user_id' => $model->id]);
$assignment = [];
foreach ($auth as $item) {
$assignment[] = $item->item_name;
}
echo Html::listBox('roles', null, $assignment);
?>
</div>