当前位置: 首页>>代码示例>>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;未经允许,请勿转载。