PATH:
home
/
letacommog
/
letaweb
/
admin
/
api
/
blog
<?php class PostManager extends BaseManager { //Save post data public function actionsaveForm() { $newsForm = new NewsForm('update'); if (isset($_POST['NewsForm'])) { $newsForm->attributes = $_POST['NewsForm']; if (($news = $newsForm->save()) === false) { $errors = $newsForm->getErrors(); $this->ajaxError($errors); return; } else { $this->ajaxSuccess($news->attributes); return; } } $this->ajaxError(1); } public function actiongetPostCount() { $pc = BNews::model()->count(); $this->ajaxSuccess($pc); } //delete all selected post public function actiondeleteItems() { $ids = $_POST['ids']; $criteria = new CDbCriteria(); $criteria->addInCondition('id', $ids); BNews::model()->deleteAll($criteria); $this->ajaxSuccess(1); } //return post month list for the Filter By Month dropdown public function actiongetnews_monthsList() { $rows = BNews::model()->getDbConnection()->createCommand() ->select('DISTINCT MONTH(DATE_ADDED) as month,YEAR(DATE_ADDED) as year') ->from(BNews::model()->tableSchema->name) ->where('site_id='.Yii::app()->site->model->id) ->queryAll(); for ($i = 0;$i < sizeof($rows);++$i) { $date = strtotime($rows[$i]['year'].'-'.$rows[$i]['month'].'-01'); $rows[$i]['name'] = Yii::app()->dateFormatter->format('MMMM yyyy', $date); $rows[$i]['id'] = $rows[$i]['year'].'-'.$rows[$i]['month']; } $this->ajaxSuccess($rows); } }
[+]
..
[+]
post
[-] PostManager.php
[edit]
[-] CommentManager.php
[edit]