本文整理汇总了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>