本文整理汇总了PHP中bizley\podium\models\User::getStatuses方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getStatuses方法的具体用法?PHP User::getStatuses怎么用?PHP User::getStatuses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bizley\podium\models\User
的用法示例。
在下文中一共展示了User::getStatuses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rules
/**
* @inheritdoc
*/
public function rules()
{
return [[['id'], 'integer'], [['username', 'email'], 'safe'], [['status'], 'in', 'range' => array_keys(User::getStatuses())], [['role'], 'in', 'range' => array_keys(User::getRoles())]];
}
示例2: jQuery
jQuery(\'#unbanUrl\').attr(\'href\', button.data(\'url\'));
});', View::POS_READY, 'bootstrap-modal-unban');
echo $this->render('/elements/admin/_navbar', ['active' => 'members']);
?>
<br>
<?php
Pjax::begin();
echo PageSizer::widget();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterSelector' => 'select#per-page', 'tableOptions' => ['class' => 'table table-striped table-hover'], 'columns' => [['attribute' => 'id', 'label' => Yii::t('podium/view', 'ID') . Helper::sortOrder('id'), 'encodeLabel' => false, 'contentOptions' => ['class' => 'col-sm-1 text-right'], 'headerOptions' => ['class' => 'col-sm-1 text-right']], ['attribute' => 'username', 'label' => Yii::t('podium/view', 'Username') . Helper::sortOrder('username'), 'encodeLabel' => false], ['attribute' => 'email', 'label' => Yii::t('podium/view', 'E-mail') . Helper::sortOrder('email'), 'encodeLabel' => false, 'format' => 'raw', 'value' => function ($model) {
return Html::mailto($model->email);
}], ['attribute' => 'role', 'label' => Yii::t('podium/view', 'Role') . Helper::sortOrder('role'), 'encodeLabel' => false, 'filter' => User::getRoles(), 'value' => function ($model) {
return Yii::t('podium/view', ArrayHelper::getValue(User::getRoles(), $model->role));
}], ['attribute' => 'status', 'label' => Yii::t('podium/view', 'Status') . Helper::sortOrder('status'), 'encodeLabel' => false, 'filter' => User::getStatuses(), 'value' => function ($model) {
return Yii::t('podium/view', ArrayHelper::getValue(User::getStatuses(), $model->status));
}], ['class' => ActionColumn::className(), 'header' => Yii::t('podium/view', 'Actions'), 'contentOptions' => ['class' => 'text-right'], 'headerOptions' => ['class' => 'text-right'], 'template' => '{view} {pm} {ban} {delete}', 'buttons' => ['view' => function ($url) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, ['class' => 'btn btn-default btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'View Member')]);
}, 'pm' => function ($url, $model) {
if ($model->id !== Yii::$app->user->id) {
return Html::a('<span class="glyphicon glyphicon-envelope"></span>', ['messages/new', 'user' => $model->id], ['class' => 'btn btn-default btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Send Message')]);
} else {
return Html::a('<span class="glyphicon glyphicon-envelope"></span>', '#', ['class' => 'btn btn-xs disabled text-muted']);
}
}, 'ban' => function ($url, $model) {
if ($model->id !== Yii::$app->user->id) {
if ($model->status !== User::STATUS_BANNED) {
return Html::tag('span', Html::tag('button', '<span class="glyphicon glyphicon-ban-circle"></span>', ['class' => 'btn btn-danger btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Ban Member')]), ['data-toggle' => 'modal', 'data-target' => '#podiumModalBan', 'data-url' => $url]);
} else {
return Html::tag('span', Html::tag('button', '<span class="glyphicon glyphicon-ok-circle"></span>', ['class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Unban Member')]), ['data-toggle' => 'modal', 'data-target' => '#podiumModalUnBan', 'data-url' => $url]);
}
示例3: statusLabel
/**
* Gets User status label.
* @param integer|null $status status ID
* @return string label html
*/
public static function statusLabel($status = null)
{
switch ($status) {
case User::STATUS_ACTIVE:
$label = 'info';
$name = ArrayHelper::getValue(User::getStatuses(), $status);
break;
case User::STATUS_BANNED:
$label = 'warning';
$name = ArrayHelper::getValue(User::getStatuses(), $status);
break;
default:
$label = 'default';
$name = ArrayHelper::getValue(User::getStatuses(), User::STATUS_REGISTERED);
}
return Html::tag('span', Yii::t('podium/view', $name), ['class' => 'label label-' . $label]);
}
示例4: function
$this->registerJs("\$('#podiumModalDelete').on('show.bs.modal', function(e) { var button = \$(e.relatedTarget); \$('#deleteUrl').attr('href', button.data('url')); });");
$this->registerJs("\$('#podiumModalBan').on('show.bs.modal', function(e) { var button = \$(e.relatedTarget); \$('#banUrl').attr('href', button.data('url')); });");
$this->registerJs("\$('#podiumModalUnBan').on('show.bs.modal', function(e) { var button = \$(e.relatedTarget); \$('#unbanUrl').attr('href', button.data('url')); });");
$loggedId = User::loggedId();
echo $this->render('/elements/admin/_navbar', ['active' => 'members']);
?>
<br>
<?php
Pjax::begin();
echo PageSizer::widget();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'filterSelector' => 'select#per-page', 'tableOptions' => ['class' => 'table table-striped table-hover'], 'columns' => [['attribute' => 'id', 'label' => Yii::t('podium/view', 'ID') . Helper::sortOrder('id'), 'encodeLabel' => false, 'contentOptions' => ['class' => 'col-sm-1 text-right'], 'headerOptions' => ['class' => 'col-sm-1 text-right']], ['attribute' => 'username', 'label' => Yii::t('podium/view', 'Username') . Helper::sortOrder('username'), 'encodeLabel' => false], ['attribute' => 'email', 'label' => Yii::t('podium/view', 'E-mail') . Helper::sortOrder('email'), 'encodeLabel' => false, 'format' => 'raw', 'value' => function ($model) {
return Html::mailto($model->email);
}], ['attribute' => 'role', 'label' => Yii::t('podium/view', 'Role') . Helper::sortOrder('role'), 'encodeLabel' => false, 'filter' => User::getRoles(), 'value' => function ($model) {
return ArrayHelper::getValue(User::getRoles(), $model->role);
}], ['attribute' => 'status', 'label' => Yii::t('podium/view', 'Status') . Helper::sortOrder('status'), 'encodeLabel' => false, 'filter' => User::getStatuses(), 'value' => function ($model) {
return ArrayHelper::getValue(User::getStatuses(), $model->status);
}], ['class' => ActionColumn::className(), 'header' => Yii::t('podium/view', 'Actions'), 'contentOptions' => ['class' => 'text-right'], 'headerOptions' => ['class' => 'text-right'], 'template' => '{view} {pm} {ban} {delete}', 'buttons' => ['view' => function ($url) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'View Member')]);
}, 'pm' => function ($url, $model) use($loggedId) {
if ($model->id !== $loggedId) {
return Html::a('<span class="glyphicon glyphicon-envelope"></span>', ['messages/new', 'user' => $model->id], ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Send Message')]);
} else {
return Html::a('<span class="glyphicon glyphicon-envelope"></span>', '#', ['class' => 'btn btn-xs disabled text-muted']);
}
}, 'ban' => function ($url, $model) use($loggedId) {
if ($model->id !== $loggedId) {
if ($model->status !== User::STATUS_BANNED) {
return Html::tag('span', Html::tag('button', '<span class="glyphicon glyphicon-ban-circle"></span>', ['class' => 'btn btn-danger btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Ban Member')]), ['data-toggle' => 'modal', 'data-target' => '#podiumModalBan', 'data-url' => $url]);
} else {
return Html::tag('span', Html::tag('button', '<span class="glyphicon glyphicon-ok-circle"></span>', ['class' => 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => Yii::t('podium/view', 'Unban Member')]), ['data-toggle' => 'modal', 'data-target' => '#podiumModalUnBan', 'data-url' => $url]);
}