public function actionLoadLinkData() { $modelCategoryLanguage = CategoryLanguage::model()->getListCategoryWithLanguage($this->getLanguageCode()); $modelPostLanguage = PostLanguage::model()->getListPostLanguage($this->getLanguageCode()); $modelStaticHtml = StaticHtml::model()->findAll(); echo $this->renderPartial('_linkData', array('modelCategoryLanguage' => $modelCategoryLanguage, 'modelPostLanguage' => $modelPostLanguage, 'modelStaticHtml' => $modelStaticHtml)); }
public function actionDelete() { if (Yii::app()->request->getPost('post_id')) { $postid = Yii::app()->request->getPost('post_id'); $transaction = Yii::app()->db->beginTransaction(); try { $cmt = new Comment(); $postl = new PostLanguage(); $post = new Post(); $cmt->deleteAll("post_id=:id", array(':id' => $postid)); $postl->deleteAll("post_id=:id", array(':id' => $postid)); $post->deleteAll("id=:id", array(':id' => $postid)); $transaction->commit(); Yii::app()->user->setFlash('Success', Yii::t('post', 'Success Delete Post with ID :') . $postid); $this->redirect(array('/' . backend . '/post/trash')); } catch (Exception $e) { Yii::app()->user->setFlash('Failure', Yii::t('post', 'Delete failure')); $transaction->rollback(); $this->redirect(array('/' . backend . '/post/trash')); } } else { throw new CHttpException(404, Yii::t('post', 'The specified post cannot be found.')); } }