public function actionDelete($id)
 {
     $model = CmsComment::model()->findByPk($id);
     if (Yii::app()->user->id == $model->user_id) {
         if (CmsComment::model()->deleteByPk($id)) {
             $this->redirect(array('/page/view', 'id' => $model->page_id));
         }
     }
 }
 public function actionDeleteComment()
 {
     if ($id = Yii::app()->request->getParam('id')) {
         if ($id == Yii::app()->user->id) {
             return $this->sendResponse(self::STATUS_OK, CmsComment::model()->deleteByPk($id));
         }
     } else {
         return $this->sendResponse(self::STATUS_INTERNAL_SERVER_ERROR, "Запись не удалена");
     }
 }
Exemplo n.º 3
0
?>
        </div>
        <hr/>




    </div>

</div>

<div class="row">

    <div class="thumbnail textCom">
        <?php 
echo CmsComment::model()->countByAttributes(array('page_id' => $model->id, 'status' => 1));
?>
  &nbsp; коментариев
        <?php 
$flag = CmsSetting::model()->findByPk(1);
if (!Yii::app()->user->isGuest || Yii::app()->user->isGuest && $flag->gost_com) {
    ?>
        <a class="linkCom" id="linkComId"><i class="fa fa-pencil-square-o">&nbsp;Оставить Комментарий</i></a>
        <?php 
}
?>
    </div>
</div>

    <?php 
if ($model->status != 0 && $model->status != 1) {
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return CmsComment the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = CmsComment::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 5
0
    ?>
                                <td class="text-left wid"><span>Опубликовано постов </span></td>
                                <td><i class="fa fa-newspaper-o" style="margin-left: 15px"></i> </td>
                                <td class="text-center wid"><?php 
    echo CmsPage::model()->count($criteria);
    ?>
</td>
                            <?php 
}
?>
                </tr>
                <tr>
                    <?php 
$criteria->condition = 'user_id=:id AND status=1';
$criteria->params = array(':id' => $id);
$ct = CmsComment::model()->count($criteria);
if ($ct != 0) {
    ?>
                        <td class="text-left wid"><span>Опубликовано комментариев </span></td>
                        <td><i class="fa fa-comment-o" style="margin-left: 15px"></i></td>
                        <td class="text-center wid"><?php 
    echo $ct;
    ?>
</td>
                    <?php 
}
?>
                </tr>
                <tr>
                    <?php 
$criteria = new CDbCriteria();
Exemplo n.º 6
0
                <span>
                    <?php 
switch ($data->user->role) {
    case 1:
        echo CHtml::link($data->user->username, array('UserPersonal/index', 'id' => $data->user->id));
        break;
    case 2:
        echo CHtml::link('Модератор', array('UserPersonal/index', 'id' => $data->user->id));
        break;
    case 3:
        echo CHtml::link(CHtml::openTag('i', array('class' => 'fa fa-user')) . '&nbsp;' . '&nbsp;' . 'Администратор' . '</i>', array('UserPersonal/index', 'id' => $data->user->id));
        break;
}
?>
                    /
                    <?php 
echo CHtml::link(CHtml::openTag('i', array('class' => 'fa fa-calendar')) . '&nbsp;' . '&nbsp;' . date('j F Y', $data->created) . '</i>', array('page/PageCriteria', 'data' => date('Y-m-j', $data->created)));
?>
                   /
                    <?php 
echo CHtml::link(CHtml::openTag('i', array('class' => 'fa fa-comment')) . '&nbsp;' . CmsComment::model()->countByAttributes(array('page_id' => $data->id)) . '&nbsp;' . "Комментариев" . '</i>', array('page/view', 'id' => $data->id));
?>
                </span>

            </div>

        </div>

</div>