/**
  * Delete comment action
  */
 public function actiondeletecomment()
 {
     // Perms
     if (!Yii::app()->user->checkAccess('op_tutorials_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 = TutorialsComments::model()->findByPk($_GET['id']))) {
         $model->delete();
         Yii::app()->user->setFlash('success', Yii::t('admintuts', 'Comment Deleted.'));
         $this->redirect(array('comments'));
     } else {
         $this->redirect(array('comments'));
     }
 }
 /**
  * Change comment visibility status
  */
 public function actiontogglestatus()
 {
     if (!Yii::app()->user->checkAccess('op_tutorials_comments')) {
         $this->redirect(Yii::app()->request->getUrlReferrer());
     }
     if (isset($_GET['id']) && ($model = TutorialsComments::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 {{tutorialscomments}} WHERE visible=0')->queryScalar());
?>
</td>
					</tr>
					<tr>
						<td><?php 
echo Yii::t('adminindex', 'Last Comments');
?>
</td>
						<td>
							<ul>
								<?php 
$lasttutcomments = TutorialsComments::model()->with(array('tutorial'))->findAll(array('order' => 't.postdate DESC', 'limit' => 5));
?>
								<?php 
foreach ($lasttutcomments as $tutcomm) {
    ?>
								<li><?php 
    echo $tutcomm->tutorial->getModelLink();
    ?>
</li>
								<?php 
}
?>
							</ul>
						</td>
					</tr>
				</table>