/** * Toggle post status */ public function actiontogglepost() { if (!Yii::app()->user->checkAccess('op_forum_posts')) { throw new CHttpException(403, Yii::t('forum', 'Sorry, You are not allowed to perform that operation.')); } if (isset($_GET['id']) && ($model = ForumPosts::model()->findByPk($_GET['id']))) { $model->visible = $model->visible == 1 ? 0 : 1; $model->update(); Yii::app()->user->setFlash('success', Yii::t('forum', 'Post Status Changed.')); $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 {{forumposts}} WHERE visible = 0')->queryScalar()); ?> </td> </tr> <tr> <td><?php echo Yii::t('adminindex', 'Last Posts'); ?> </td> <td> <ul> <?php $lastforumposts = ForumPosts::model()->with(array('topic'))->findAll(array('order' => 't.dateposted DESC', 'limit' => 5)); ?> <?php foreach ($lastforumposts as $postcomm) { ?> <li><?php echo $postcomm->topic->getLink(); ?> </li> <?php } ?> </ul> </td> </tr> </table>