/**
  * Delete comment action
  */
 public function actiondeletecomment()
 {
     // Perms
     if (!Yii::app()->user->checkAccess('op_blog_deletecomments')) {
         throw new CHttpException(403, Yii::t('error', 'Sorry, You don\'t have the required permissions to enter this section'));
     }
     if (isset($_GET['id']) && ($model = BlogComments::model()->findByPk($_GET['id']))) {
         $model->delete();
         Yii::app()->user->setFlash('success', Yii::t('adminblog', 'Comment Deleted.'));
         $this->redirect(array('comments'));
     } else {
         $this->redirect(array('comments'));
     }
 }
 /**
  * Change comment visibility status
  */
 public function actiontogglestatus()
 {
     if (!Yii::app()->user->checkAccess('op_blog_comments')) {
         $this->redirect(Yii::app()->request->getUrlReferrer());
     }
     if (isset($_GET['id']) && ($model = BlogComments::model()->findByPk($_GET['id']))) {
         $model->visible = $model->visible == 1 ? 0 : 1;
         $model->save();
         Yii::app()->user->setFlash('success', Yii::t('global', 'Comment Updated.'));
         $this->redirect(Yii::app()->request->getUrlReferrer());
     } else {
         $this->redirect(Yii::app()->request->getUrlReferrer());
     }
 }
?>
</td>
						<td><?php 
echo Yii::app()->format->number(Yii::app()->db->createCommand('SELECT COUNT(id) as total FROM {{blogcomments}} WHERE visible=0')->queryScalar());
?>
</td>
					</tr>
					<tr>
						<td><?php 
echo Yii::t('adminindex', 'Last Comments');
?>
</td>
						<td>
							<ul>
								<?php 
$lastblogcomments = BlogComments::model()->with(array('post'))->findAll(array('order' => 't.postdate DESC', 'limit' => 5));
?>
								<?php 
foreach ($lastblogcomments as $blogcomm) {
    ?>
								<li><?php 
    echo $blogcomm->post->getModelLink();
    ?>
</li>
								<?php 
}
?>
							</ul>
						</td>
					</tr>
				</table>