當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CPagination::applyLimit方法代碼示例

本文整理匯總了PHP中CPagination::applyLimit方法的典型用法代碼示例。如果您正苦於以下問題:PHP CPagination::applyLimit方法的具體用法?PHP CPagination::applyLimit怎麽用?PHP CPagination::applyLimit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CPagination的用法示例。


在下文中一共展示了CPagination::applyLimit方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 public function run()
 {
     $params = array();
     $criteria = new CDbCriteria();
     //        $criteria->select = array('id,username,fullname,phone,address,status');
     $criteria->select = '*';
     if (isset($this->team_lear_id) and $this->team_lear_id != '') {
         $criteria->addCondition('team_lear_id=' . $this->team_lear_id);
     }
     $criteria->params = $params;
     $total = ATrainingTeam::model()->count($criteria);
     $offset = $this->limit * ($this->page - 1);
     $criteria->limit = $this->limit;
     $criteria->offset = $offset;
     $data = ATrainingTeam::model()->findAll($criteria);
     $listTrainee = array();
     if (!empty($data)) {
         foreach ($data as $item) {
             $listTrainee[] = CJSON::decode(CJSON::encode($item->pls_user));
         }
     }
     $data = $listTrainee;
     $pages = new CPagination($total);
     $pages->pageSize = $this->limit;
     $pages->applyLimit($criteria);
     $this->render($this->view, array('data' => $data, 'pages' => $pages));
 }
開發者ID:nguyendvphp,項目名稱:onlinetraining,代碼行數:27,代碼來源:wg_dataUser_Team.php

示例2: generateProductGrid

 /**
  * This function generates the products grid
  * based on the criteria. It also generates the
  * pagination object need for the users to navigate
  * through products.
  *
  * @return void
  */
 public function generateProductGrid()
 {
     $this->_numberOfRecords = Product::model()->count($this->_productGridCriteria);
     $this->_pages = new CPagination($this->_numberOfRecords);
     $this->_pages->setPageSize(CPropertyValue::ensureInteger(Yii::app()->params['PRODUCTS_PER_PAGE']));
     $this->_pages->applyLimit($this->_productGridCriteria);
     $this->_productsGrid = self::createBookends(Product::model()->findAll($this->_productGridCriteria));
 }
開發者ID:uiDeveloper116,項目名稱:webstore,代碼行數:16,代碼來源:ProductGrid.php

示例3: actionIndex

 /**
  *  展示所有或者某一類別同時還沒有被讀過的的信息
  */
 public function actionIndex($cid = 0)
 {
     $criteria = new CDbCriteria();
     // $criteria -> addCondition("uid =:uid ");        //添加查詢條件
     // $criteria -> params[':uid'] = $UID;              //綁定查詢條件的參數
     $criteria->addCondition("status=0");
     $criteria->order = 'create_time desc';
     if ($cid != 0) {
         $criteria->addCondition("cid={$cid}");
     }
     $count = Advice::model()->count($criteria);
     //統計查詢結果集中記錄總數
     $pager = new CPagination($count);
     //實例化CPagination類
     $pager->pageSize = 10;
     //設置一頁顯示記錄數
     // $pager->pageVar = 'p';                            //自定義URL中頁碼的參數,可以不設置
     $pager->applyLimit($criteria);
     //將結果集進行過濾處理
     $advice_list = Advice::model()->findAll($criteria);
     if (count($advice_list) == 0) {
         die('您現在沒有未讀郵件');
     }
     $this->render('index', array('advice_list' => $advice_list, 'pager' => $pager));
     /*$criteria = new CDbCriteria ;
     		// $criteria -> select = 'aid, cid, create_time'; 
     		if($category != 0 ) $criteria -> addCondition("cid = $category");
     		 $criteria -> addCondition("status = 0");
     		 $criteria -> order = 'create_time desc';
     		$advice_list = Advice::model() -> findAll($criteria);
     		// header("charset=utf-8");
     		if( count($advice_list) == 0)  die('您現在沒有未讀郵件');
     		$this -> render('index', array('advice_list' => $advice_list));*/
 }
開發者ID:houyf,項目名稱:class_system,代碼行數:37,代碼來源:AdviceController.php

示例4: actionGetlogisticslist

 public function actionGetlogisticslist()
 {
     $organID = Commonmodel::getOrganID();
     //獲取機構ID
     $criteria = new CDbCriteria();
     $criteria->select = "*";
     $criteria->order = "id DESC";
     $criteria->addCondition("OrganID=" . $organID);
     //查詢條件:根據機構ID查詢物流數據
     $count = Logistics::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->applyLimit($criteria);
     $modeles = Logistics::model()->findAll($criteria);
     foreach ($modeles as $key => $value) {
         $data[$key]['ID'] = $value['ID'];
         $data[$key]['OrganID'] = $value['OrganID'];
         $data[$key]['Company'] = F::msubstr($value['LogisticsCompany']);
         $data[$key]['Description'] = F::msubstr($value['LogisticsDescription']);
         $data[$key]['LogisticsCompany'] = $value['LogisticsCompany'];
         $data[$key]['LogisticsDescription'] = $value['LogisticsDescription'];
         $data[$key]['CreateTime'] = date("Y-m-d H:i:s", $value['CreateTime']);
         $data[$key]['UpdateTime'] = $value['UpdateTime'];
         $data[$key]['Status'] = $value['Status'];
         $address = $this->getAddress($value['ID']);
         $data[$key]['Address'] = $address ? F::msubstr(substr($address, 0, -3)) : '';
         $data[$key]['AddressDetail'] = $address ? substr($address, 0, -3) : '';
         //$data[$key]['Address'] = Area::getCity($address['Province']) . Area::getCity($address['City']) . Area::getCity($address['Area']);
     }
     $rs = array('total' => $count, 'rows' => $data ? $data : array());
     //        var_dump($rs);exit;
     echo json_encode($rs);
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:32,代碼來源:LogisticsController.php

示例5: run

 public function run()
 {
     $model = new User();
     //審核狀態
     $user_status = array('all' => '所有', User::STATUS_AUDIT => '待審核', User::STATUS_DISABLE => '禁用', User::STATUS_NORMAL => '正常');
     //條件
     $criteria = new CDbCriteria();
     $groupid = intval(Yii::app()->request->getParam('groupid'));
     $username = trim(Yii::app()->request->getParam('username'));
     $status = Yii::app()->request->getParam('status', 'all');
     $groupid > 0 && $criteria->addColumnCondition(array('groupid' => $groupid));
     if ($status != 'all') {
         $criteria->addSearchCondition('status', $status);
     }
     $criteria->addSearchCondition('username', $username);
     $criteria->order = 'uid ASC';
     $count = $model->count($criteria);
     //分頁
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     //查詢
     $result = $model->findAll($criteria);
     $this->controller->render('index', array('datalist' => $result, 'pagebar' => $pages, 'status' => $status, 'user_status' => $user_status));
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:25,代碼來源:IndexAction.php

示例6: actionShow

 public function actionShow()
 {
     // handle space visibility changes
     if (isset($_POST['reputationUsers'])) {
         $user = $this->getUser();
         $userSpace = Yii::app()->request->getParam('reputationUsers');
         foreach ($userSpace as $space) {
             if (isset($_POST['reputationUser_' . $space])) {
                 $userSettings = Yii::app()->request->getParam('reputationUser_' . $space);
                 $reputationUser = ReputationUser::model()->findByAttributes(array('space_id' => $space, 'user_id' => $user->id));
                 if ($reputationUser != null) {
                     $reputationUser->visibility = isset($userSettings['visibility']) && $userSettings['visibility'] == 1 ? 1 : 0;
                     $reputationUser->save();
                 }
             }
         }
         Yii::app()->user->setFlash('data-saved', Yii::t('SpaceModule.controllers_AdminController', 'Saved'));
     }
     $user = $this->getUser();
     $criteria = new CDbCriteria();
     $criteria->condition = 'user_id=:userId';
     $criteria->order = 'space_id ASC';
     $criteria->params = array(':userId' => $user->id);
     $itemCount = ReputationUser::model()->count($criteria);
     $pages = new CPagination($itemCount);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     $reputations = ReputationUser::model()->findAll($criteria);
     $this->render('userReputation', array('user' => $user, 'reputations' => $reputations, 'pages' => $pages));
 }
開發者ID:plantoschka,項目名稱:humhub-modules-reputation,代碼行數:30,代碼來源:ProfileReputationController.php

示例7: actionIndex

 /**
  * Handles all incoming requests for the entire site that are not previous defined in CUrlManager
  * Requests come in, are verified, and then pulled from the database dynamically
  * Shows all blog posts for a particular category_id
  * @param $id	- The content ID that we want to pull from the database
  * @return $this->render() - Render of page that we want to display
  **/
 public function actionIndex($id = NULL)
 {
     // Run a pre check of our data
     $this->beforeCiiAction($id);
     // Retrieve the data
     $category = Categories::model()->findByPk($id);
     $this->breadcrumbs = Categories::model()->getParentCategories($id);
     // Parse Metadata
     $meta = Categories::model()->parseMeta($category->metadata);
     $this->setPageTitle(Yii::t('ciims.controllers.Categories', '{{app_name}} | {{label}}', array('{{app_name}}' => Cii::getConfig('name', Yii::app()->name), '{{label}}' => $category->name)));
     $layout = isset($meta['layout']) ? $meta['layout']['value'] : 'default';
     // Set the layout
     $this->setLayout($layout);
     $data = array();
     $pages = array();
     $itemCount = 0;
     $pageSize = Cii::getConfig('categoryPaginationSize', 10);
     $criteria = Content::model()->getBaseCriteria()->addCondition('type_id >= 2')->addCondition("category_id = " . $id)->addCondition('password = ""');
     $criteria->limit = $pageSize;
     $criteria->order = 'created DESC';
     $itemCount = Content::model()->count($criteria);
     $pages = new CPagination($itemCount);
     $pages->pageSize = $pageSize;
     $criteria->offset = $criteria->limit * $pages->getCurrentPage();
     $data = Content::model()->findAll($criteria);
     $pages->applyLimit($criteria);
     $this->render('index', array('id' => $id, 'category' => $category, 'data' => $data, 'itemCount' => $itemCount, 'pages' => $pages, 'meta' => array('description' => $category->getDescription())));
 }
開發者ID:fandikurnia,項目名稱:CiiMS,代碼行數:35,代碼來源:CategoriesController.php

示例8: getWishListForWeb

 public function getWishListForWeb($user_id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "user_id = {$user_id}";
     $wishlists = Wishlist::model()->findAll($criteria);
     $wishlist_arr = array();
     foreach ($wishlists as $wishlist) {
         $wishlist_arr[] = $wishlist->post_id;
     }
     //var_dump($wishlist_arr); die;
     $returnArr = array();
     $criteria_post = new CDbCriteria();
     $criteria_post->addInCondition('t.post_id', $wishlist_arr);
     $count = Posts::model()->count($criteria_post);
     $pages = new CPagination($count);
     $pages->validateCurrentPage = FALSE;
     $pages->pageSize = Yii::app()->params['RESULT_PER_PAGE'];
     $pages->applyLimit($criteria_post);
     $posts = Posts::model()->findAll($criteria_post);
     $is_followed = User::model()->isFollowedByUser(Yii::app()->session['user_id'], $user_id, 'USER');
     $profile = User::model()->findByPk($user_id);
     foreach ($posts as $post) {
         $itemArr = Posts::model()->getPostById($post->post_id, Yii::app()->session['user_id']);
         $returnArr[] = $itemArr;
     }
     return array('data' => $returnArr, 'pages' => $pages, 'profile' => $profile, 'is_followed' => $is_followed);
     // return FALSE;
 }
開發者ID:huynt57,項目名稱:fashion,代碼行數:28,代碼來源:Wishlist.php

示例9: run

 public function run()
 {
     $params = array();
     $criteria = new CDbCriteria();
     $criteria->select = array('lecture_name,training_minute,id,lecture_type');
     if (isset($this->lecture_name) and $this->lecture_name != '') {
         $keyword = addcslashes($this->lecture_name, '%_');
         $criteria->addCondition('lecture_name LIKE :keyword');
         $params[':keyword'] = "%{$keyword}%";
     }
     if (isset($this->lecture_cat) and $this->lecture_cat != '') {
         $criteria->addCondition('lecture_cat_id=' . $this->lecture_cat);
     }
     if (isset($this->trainer) and $this->trainer != '') {
         $criteria->addCondition('created_by=' . $this->trainer);
     }
     if (!empty(Yii::app()->user->id) and Yii::app()->session['group_id'] == 1) {
         $criteria->addCondition('created_by=' . Yii::app()->user->id);
     }
     $criteria->params = $params;
     $criteria->order = 'created_date DESC';
     $total = Lecture::model()->count($criteria);
     $offset = $this->limit * ($this->page - 1);
     $criteria->limit = $this->limit;
     $criteria->offset = $offset;
     $data = Lecture::model()->findAll($criteria);
     if (!empty($data)) {
         $data = CJSON::decode(CJSON::encode($data));
     }
     $pages = new CPagination($total);
     $pages->pageSize = $this->limit;
     $pages->applyLimit($criteria);
     $this->render($this->view, array('data' => $data, 'pages' => $pages));
 }
開發者ID:nguyendvphp,項目名稱:onlinetraining,代碼行數:34,代碼來源:wg_dataLecture.php

示例10: getList

 /**
  * 獲取一定條件下的文章
  * @param array $params = ('condition'=> '額外條件', 'order'=>'排序', 'with'=>'關聯表', 'limit'=>'條數', 'page'=>'是否分頁')
  * @param $pages 分頁widget
  * @return array
  */
 public static function getList($params = array(), &$pages = null)
 {
     $pages = array();
     $params['condition'] = isset($params['condition']) ? $params['condition'] : '';
     $params['order'] = isset($params['order']) ? $params['order'] : '';
     $params['with'] = isset($params['with']) ? $params['with'] : '';
     $params['limit'] = isset($params['limit']) ? $params['limit'] : '';
     $params['page'] = isset($params['page']) ? $params['page'] : '';
     //組合條件
     $criteria = new CDbCriteria();
     $criteria->condition = 't.status=:status';
     $params['condition'] && ($criteria->condition .= $params['condition']);
     $criteria->order = $params['order'] ? $params['order'] : 't.id DESC';
     $criteria->with = array('catalog');
     $criteria->select = "t.title, t.id,t.title_style, ";
     $criteria->select .= " t.copy_from, t.copy_url, t.update_time,t.introduce, t.tags, t.view_count";
     $criteria->params = array(':status' => 'Y');
     $params['with'] && ($criteria->with = (array) $params['with']);
     $limit = $params['limit'] > 0 ? intval($params['limit']) : 15;
     //是否分頁
     if ($params['page']) {
         //分頁
         $count = self::model()->count($criteria);
         $pages = new CPagination($count);
         $pages->pageSize = $limit;
         $pages->applyLimit($criteria);
     } else {
         $criteria->limit = $limit;
     }
     $data = self::model()->findAll($criteria);
     return $data ? $data : array();
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:38,代碼來源:Post.php

示例11: actionFind

 public function actionFind()
 {
     if (isset($_POST['flightNumber'])) {
         $current = date('Y-m-d');
         $flightNumber = $_POST['flightNumber'];
         $criteria = new CDbCriteria();
         $criteria->join = 'LEFT JOIN tbl_mry_user ON tbl_mry_plan.userId=tbl_mry_user.userId';
         $criteria->addCondition('flightNumber=:flightNumber');
         $criteria->params = array(':flightNumber' => $flightNumber);
         $criteria->order = 'startDate DESC';
         $UserModel = User::model();
         $total = $UserModel->count($criteria);
         $pager = new CPagination($total);
         $pager->pageSize = 10;
         $pager->applyLimit($criteria);
         $UserList = $UserModel->findAll($criteria);
         //刪除PASSWORD相關的信息
         $dataFormat = new DataFormat();
         $format = $dataFormat->format($userList, null, null);
         $clientFlash = new ClientFlash();
         if ($total > 0) {
             $clientFlash->pushMobile(0, $format);
         } else {
             _echo(3, 數據為空);
         }
     }
 }
開發者ID:tiger2soft,項目名稱:travelman,代碼行數:27,代碼來源:SameFlightController.php

示例12: actionIndex

 public function actionIndex()
 {
     $this->pageTitle = 'Управление переводом';
     $criteria = new CDbCriteria();
     $criteria->with = array();
     $criteria->order = 't.created_at DESC';
     $filter = array();
     $checkBoxDefaultOn = TRUE;
     $count = Translate::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = TRANSLATES_PER_PAGE;
     $pages->applyLimit($criteria);
     $translates = Translate::model()->findAll($criteria);
     $langs = Langs::model()->findAll();
     $translatesLang = array();
     foreach ($translates as $translate) {
         $translatesLang[$translate->id] = array();
         foreach ($translate->langs as $translateLang) {
             foreach ($langs as $lang) {
                 if (!array_key_exists($lang->alias, $translatesLang[$translate->id])) {
                     $translatesLang[$translate->id][$lang->alias] = '';
                 }
                 if ($translateLang->lang == $lang->alias) {
                     $translatesLang[$translate->id][$lang->alias] = $translateLang->translate;
                 }
             }
         }
     }
     $model = new Translate();
     $modelLang = new TranslateLang();
     $this->include_jquery_form();
     CHtml::asset(Yii::getPathOfAlias('application.modules.admin.modules.translate.css'));
     $this->render('index', array('translates' => $translates, 'pages' => $pages, 'model' => $model, 'modelLang' => $modelLang, 'langs' => $langs, 'translatesLang' => $translatesLang, 'filter' => $filter, 'checkBoxDefaultOn' => $checkBoxDefaultOn));
 }
開發者ID:Wiedzal,項目名稱:araucano,代碼行數:34,代碼來源:StaticController.php

示例13: actionGetstandardparamlists

 public function actionGetstandardparamlists()
 {
     $organID = Commonmodel::getOrganID();
     $criteria = new CDbCriteria();
     $criteria->addCondition('organID=' . $organID);
     $criteria->addCondition('mark="U" and ISdelete="N"');
     $criteria->group = 'standard_id';
     //        //查詢數據總數
     //        $sql='SELECT count(distinct standard_id) as count FROM `tbl_make_goods_template` where organID='.$organID.' and mark="U" and ISdelete="N"';
     //        $count=Yii::app()->db->createCommand($sql)->queryAll();
     //        $total=$count[0]['count'];sss
     $count = MakeGoodsTemplate::model()->count($criteria);
     $criteria->order = 'id desc';
     //分頁
     $pages = new CPagination($count);
     $pages->pageSize = isset($_GET['rows']) ? intval($_GET['rows']) : 10;
     $pages->applyLimit($criteria);
     $datas = MakeGoodsTemplate::model()->findAll($criteria);
     $res = array();
     foreach ($datas as $key => $data) {
         //根據標準名稱id查詢標準名稱
         $res[$key]['id'] = $data['standard_id'];
         $standard = Gcategory::model()->findByPk($data['standard_id']);
         $res[$key]['name'] = $standard['name'];
         $res[$key]['createtime'] = date('Y-m-d H:i:s', $data['createtime']);
         //標準名稱參數對應的商品數量
         $sql = 'select count(b.standard_id) from tbl_make_goods a,tbl_make_goods_version b where a.ISdelete=0 and ' . 'a.NewVersion=b.version_name and a.id=b.goods_id and b.standard_id=' . $data['standard_id'] . ' and b.organID=' . $organID;
         $result = Yii::app()->db->createCommand($sql)->queryRow();
         $res[$key]['count'] = $result['count(b.standard_id)'];
     }
     echo json_encode(array('total' => $count, 'rows' => $res));
 }
開發者ID:zwq,項目名稱:unpei,代碼行數:32,代碼來源:StandardparamsController.php

示例14: actionIndex

 public function actionIndex($key)
 {
     $category = Category::model()->findByPk(3);
     $model = $category->findByAttributes(array('url' => $key));
     if ($model) {
         $childs = $model->descendants()->findAll();
         $ids = array($model->id);
         foreach ($childs as $child) {
             $ids[] = $child->id;
         }
         $cid = implode(',', $ids);
         $criteria = new CDbCriteria(array('condition' => 'category_id in ( ' . $cid . ')', 'order' => 'item_id desc, sort_order desc'));
         $count = Item::model()->count($criteria);
         $pages = new CPagination($count);
         // results per page
         $pages->pageSize = 20;
         $pages->applyLimit($criteria);
         $items = Item::model()->findAll($criteria);
         //	$items = new CActiveDataProvider('Item', array(
         //            'criteria' => $criteria
         //        ));
         $criteria = new CDbCriteria(array('condition' => 'is_hot = 1 and category_id in ( ' . $cid . ')', 'limit' => '4', 'order' => 'item_id desc, sort_order desc'));
         $hotItems = Item::model()->findAll($criteria);
         $this->render('index', array('model' => $model, 'items' => $items, 'pages' => $pages, 'hotItems' => $hotItems, 'key' => $key));
     } else {
         $this->render('index');
     }
 }
開發者ID:jackycgq,項目名稱:advanced,代碼行數:28,代碼來源:CatalogController.php

示例15: actionList

 public function actionList()
 {
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $list = array();
     $criteria = new CDbCriteria();
     $criteria->select = 'sid,name';
     $criteria->order = 'sid ASC';
     $request = Yii::app()->getRequest();
     $id = trim($request->getParam("id"));
     if ($id) {
         $criteria->addCondition("sid = {$id}");
     }
     $sites = new Site();
     $count = $sites->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = Yii::app()->params['postsPerPage'];
     $pager->setCurrentPage($page - 1);
     $pager->applyLimit($criteria);
     $list = $sites->findAll($criteria);
     $res = new Seo();
     $seo = array();
     foreach ($list as $key => $site) {
         $row = $res->find('sid=:sid', array(':sid' => $site->sid));
         $seo[$key] = $row;
     }
     $this->render('list', array('r' => Yii::app()->request->baseUrl . '/', 'pages' => $pager, 'list' => $list, 'seo' => $seo));
 }
開發者ID:humor-zo,項目名稱:woc-yii,代碼行數:27,代碼來源:SeoController.php


注:本文中的CPagination::applyLimit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。