예제 #1
0
파일: view.php 프로젝트: iiyii/getyii
$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
0
 /**
  * 撤消删除
  * @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]);
 }