/** * Change comment visibility status */ public function actiontogglestatus() { if (!Yii::app()->user->checkAccess('op_users_manage_comments')) { $this->redirect(Yii::app()->request->getUrlReferrer()); } if (isset($_GET['id']) && ($model = UserComments::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()); } }
/** * Delete a record comment. * * @return void * @access public */ public function deleteRecordComment() { include_once 'services/Record/UserComments.php'; $user = UserAccount::isLoggedIn(); if ($user === false) { return $this->output(translate('You must be logged in first'), JSON::STATUS_NEED_AUTH); } if (!UserComments::deleteComment($_GET['id'], $user)) { return $this->output(translate('An error has occurred'), JSON::STATUS_ERROR); } return $this->output(translate('Done'), JSON::STATUS_OK); }
?> </td> <td><?php echo Yii::app()->format->number(UserComments::model()->count()); ?> </td> </tr> <tr> <td><?php echo Yii::t('adminindex', 'Latest Comments'); ?> </td> <td> <ul> <?php $lastusercomments = UserComments::model()->with(array('user'))->findAll(array('order' => 'postdate DESC', 'limit' => 5)); ?> <?php foreach ($lastusercomments as $lastcomment) { ?> <li><?php echo $lastcomment->user->getModelLink(); ?> </li> <?php } ?> </ul> </td> </tr> </table>