public function actionLoadMore() { if (Yii::app()->request->isAjaxRequest) { $postsObj = new Posts(); $postsObj->_owner_type = Yii::app()->getRequest()->getPost('owner_type'); $postsObj->_owner_id = Yii::app()->getRequest()->getPost('owner_id'); $postsObj->_post_type = Yii::app()->getRequest()->getPost('post_type'); $postsObj->_limit = Yii::app()->params->maxPostPerRequest; $postsObj->_last_id = Yii::app()->getRequest()->getPost('lastEntryId'); $posts = $postsObj->loadMore(); foreach ($posts as $item) { $res .= $this->renderPartial('//posts/_postItem', array('item' => $item, 'display' => 'none'), true); } echo json_encode(array('status' => 'ok', 'data' => $res)); } else { throw new CException('Not Found', 404); } }
public function actionLoadMore($id) { if (Yii::app()->request->isAjaxRequest) { $postsObj = new Posts(); $postsObj->_owner = $id; $postsObj->_limit = Yii::app()->params->maxPostPerRequest; $postsObj->_last_id = Yii::app()->getRequest()->getPost('lastEntryId'); $posts = $postsObj->loadMore(); $posts_files = PostsFiles::model(); foreach ($posts as $item) { $files = $posts_files->findAll('posts_id = :posts_id', array(':posts_id' => $item['id'])); $res .= $this->renderPartial('//profile/profile/_wallItem', array('item' => $item, 'files' => $files, 'display' => 'none'), true); } echo json_encode(array('status' => 'ok', 'data' => $res)); } else { throw new CException('Not Found', 404); } }