?> </td> <td><?php echo Yii::app()->format->number(Yii::app()->db->createCommand('SELECT COUNT(id) as total FROM {{extensionsfiles}}')->queryScalar()); ?> </td> </tr> <tr> <td><?php echo Yii::t('adminindex', 'Last Comments'); ?> </td> <td> <ul> <?php $lastextcomments = ExtensionsComments::model()->with(array('extension'))->findAll(array('order' => 't.postdate DESC', 'limit' => 5)); ?> <?php foreach ($lastextcomments as $extcomm) { ?> <li><?php echo $extcomm->extension->getModelLink(); ?> </li> <?php } ?> </ul> </td> </tr> </table>
/** * Delete comment action */ public function actiondeletecomment() { // Perms if (!Yii::app()->user->checkAccess('op_extensions_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 = ExtensionsComments::model()->findByPk($_GET['id']))) { $model->delete(); Yii::app()->user->setFlash('success', Yii::t('extensions', 'Comment Deleted.')); $this->redirect(array('comments')); } else { $this->redirect(array('comments')); } }
/** * Change comment visibility status */ public function actiontogglestatus() { if (!Yii::app()->user->checkAccess('op_extensions_comments')) { $this->redirect(Yii::app()->request->getUrlReferrer()); } if (isset($_GET['id']) && ($model = ExtensionsComments::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()); } }