本文整理汇总了PHP中common\models\User::getThrones方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getThrones方法的具体用法?PHP User::getThrones怎么用?PHP User::getThrones使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\User
的用法示例。
在下文中一共展示了User::getThrones方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$favorite = Html::a(Html::tag('i', '', ['class' => 'fa fa-bookmark']) . ' 收藏', '#', ['data-do' => 'favorite', 'data-id' => $model->id, 'data-type' => $model->type, 'class' => $model->favorite ? 'active' : '']);
if ($model->isCurrent()) {
echo Html::a(Html::tag('i', '', ['class' => 'fa fa-thumbs-o-up']) . ' ' . Html::tag('span', $model->like_count) . ' 个赞', 'javascript:;');
} else {
echo $like, $hate;
echo $thanks;
}
echo $follow;
echo $favorite;
if ($admin) {
$class = $model->status == 2 ? ['class' => 'active'] : null;
echo Html::a(Html::tag('i', '', ['class' => 'fa fa-trophy']) . ' 加精', ['/topic/default/excellent', 'id' => $model->id], $class);
}
?>
<?php
if ($model->isCurrent() || \common\models\User::getThrones()) {
?>
<span class="pull-right">
<?php
echo Html::a(Html::tag('i', '', ['class' => 'fa fa-pencil']) . ' 修改', ['/topic/default/update', 'id' => $model->id]);
?>
<?php
if ($model->comment_count == 0) {
?>
<?php
echo Html::a(Html::tag('i', '', ['class' => 'fa fa-trash']) . ' 删除', ['/topic/default/delete', 'id' => $model->id], ['data' => ['confirm' => "您确认要删除文章「{$model->title}」吗?", 'method' => 'post']]);
?>
<?php
}
?>
</span>
示例2: actionRevoke
/**
* 撤消删除
* @param $id
* @return \yii\web\Response
* @throws NotFoundHttpException
*/
public function actionRevoke($id)
{
$model = Topic::findDeletedTopic($id);
if (!($model && (User::getThrones() || $model->isCurrent()))) {
throw new NotFoundHttpException();
}
TopicService::revoke($model);
$this->flash("「{$model->title}」文章撤销删除成功。", 'success');
return $this->redirect(['/topic/default/view', 'id' => $model->id]);
}