本文整理匯總了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]);
}