public function actionIndex() { $c = array('conditions' => array('status' => array('==' => 1))); $total = WebArticlesModel::model()->count($c); $pager = new CPagination($total); $itemOnPaging = 5; $pager->pageSize = 10; $curr_page = $pager->getCurrentPage(); $limit = $pager->getLimit(); $offset = $pager->getOffset(); $c = array('conditions' => array('status' => array('==' => 1)), 'sort' => array('_id' => EMongoCriteria::SORT_DESC), 'limit' => $limit, 'offset' => $offset); $data = FeedModel::model()->findAll($c); $this->render('index', compact('data', 'pager', 'itemOnPaging')); }
/** * Displays a particular model. */ public function actionView() { $id = Yii::app()->request->getParam('id'); $genre = Yii::app()->request->getParam('url_key_cat1'); $this->activemenu = $genre; $article = WebArticlesModel::model()->model()->findByPk(new MongoId($id)); if (!$article) { throw new CHttpException(404, "There is not found!"); } $limit = 10; $offset = 0; $c = array('conditions' => array('status' => array('==' => 1)), 'sort' => array('_id' => EMongoCriteria::SORT_DESC), 'limit' => $limit, 'offset' => $offset); $data = FeedModel::model()->findAll($c); $this->render('view', array('article' => $article, 'data' => $data)); }
public function actionIndex() { $keyword = Yii::app()->request->getParam('keyword', ''); $page = Yii::app()->request->getParam('page', 1); // Find all records witch have first name starring on a, b and c, case insensitive search $keyRegexPattern = self::formatKeywordsPatternSearch($keyword); if (empty($keyRegexPattern)) { $data = null; } else { $regexObj = new MongoRegex($keyRegexPattern); $c = array('conditions' => array('status' => array('==' => 1), 'title' => array('==' => $regexObj))); $total = WebArticlesModel::model()->count($c); $pager = new CPagination($total); $itemOnPaging = 5; $pager->pageSize = 10; $curr_page = $pager->getCurrentPage(); $limit = $pager->getLimit(); $offset = $pager->getOffset(); $c = array('conditions' => array('status' => array('==' => 1), 'title' => array('==' => $regexObj)), 'limit' => $limit, 'offset' => $offset); $data = WebArticlesModel::model()->findAll($c); } $this->render('index', compact('data', 'pager', 'itemOnPaging', 'keyword', 'limit')); }
public function run() { $data = WebArticlesModel::model()->getMostPopular(); $this->render('list', compact('data')); }