当前位置: 首页>>代码示例>>PHP>>正文


PHP CPagination::setPageSize方法代码示例

本文整理汇总了PHP中CPagination::setPageSize方法的典型用法代码示例。如果您正苦于以下问题:PHP CPagination::setPageSize方法的具体用法?PHP CPagination::setPageSize怎么用?PHP CPagination::setPageSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPagination的用法示例。


在下文中一共展示了CPagination::setPageSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: actionPosts

 public function actionPosts($name)
 {
     $tag = urldecode($name);
     $this->setSiteTitle(t('tag_posts', 'main', array('{name}' => $tag)));
     // @todo 关键字的描述没有指定
     $this->setPageKeyWords($tag);
     $this->setPageDescription(t('tag_posts_page_description', 'main', array('{name}' => $tag)));
     cs()->registerMetaTag('all', 'robots');
     $cmd = app()->getDb()->createCommand()->select('p.id')->from(TABLE_TAG . ' t')->where('t.name = :tagname', array(':tagname' => $tag))->join(TABLE_POST_TAG . ' pt', 'pt.tag_id = t.id')->join(TABLE_POST . ' p', 'p.id = pt.post_id');
     $ids = $cmd->queryColumn();
     if (count($ids) > 0) {
         $criteria = new CDbCriteria();
         if (param('post_list_type') == POST_LIST_TYPE_TITLE) {
             $criteria->select = array('t.id', 't.title', 't.visit_nums', 't.comment_nums', 't.create_time');
         }
         $criteria->order = 't.istop, t.create_time desc, t.id desc';
         $criteria->addInCondition('t.id', $ids)->addCondition('t.state = :state');
         $criteria->params += array(':state' => POST_STATE_ENABLED);
         $count = Post::model()->count($criteria);
         $pages = new CPagination($count);
         $pages->setPageSize(param('postCountOfTitleListPage'));
         $pages->applyLimit($criteria);
         $posts = Post::model()->findAll($criteria);
     }
     $listType = param('post_list_type');
     $view = $listType == POST_LIST_TYPE_SUMMARY ? '/post/_summary_list' : '/post/_title_list';
     $blockTitle = t('tag_posts', 'main', array('{name}' => $tag));
     $data = array('blockTitle' => $blockTitle, 'posts' => $posts, 'pages' => $pages);
     $postListHtml = $this->renderPartial($view, $data, true);
     $this->render('posts', array('postListHtml' => $postListHtml));
 }
开发者ID:rainsongsky,项目名称:24beta,代码行数:31,代码来源:TagController.php

示例3: actionPersonnel

 public function actionPersonnel()
 {
     if (isset($_GET['id'])) {
         $model = $this->loadPersonnelModel($_GET['id']);
         $this->render('personnel_detail', array('model' => $model));
     } else {
         if (isset($_GET['type_id'])) {
             $type_id = $_GET['type_id'];
             $type = PersonnelType::model()->findByPk($_GET['type_id']);
             $criteria = new CDbCriteria();
             $criteria->condition = 'status = 1 AND personnel_type_id =' . $type_id;
             $criteria->order = 'sort_order';
             $total = Personnel::model()->count($criteria);
             $pages = new CPagination($total);
             $pages->setPageSize(10);
             $pages->applyLimit($criteria);
             $model = Personnel::model()->findAll($criteria);
             $this->render('personnel', array('model' => $model, 'type' => $type, 'pages' => $pages));
         } else {
             $criteria = new CDbCriteria();
             $criteria->select = '*';
             $criteria->condition = 'status = 1';
             $criteria->order = 'sort_order';
             $total = Personnel::model()->count($criteria);
             $pages = new CPagination($total);
             $pages->setPageSize(10);
             $pages->applyLimit($criteria);
             $model = Personnel::model()->findAll($criteria);
             $this->render('personnel', array('model' => $model, 'pages' => $pages));
         }
     }
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:32,代码来源:AboutController.php

示例4: actioncxIndex

 public function actioncxIndex()
 {
     //print_r( ucfirst($this->getId() ) );
     //$this->actionId     = $this->getAction()->getId();
     $controllerId = $this->controllerId;
     $criteria = new CDbCriteria();
     if (isset($_GET['keyword']) || !empty($_GET['keyword']) || strlen($_GET['keyword']) > 0) {
         $keyword = trim($_GET['keyword']);
         $criteria->condition = 'title like :keyword ';
         $criteria->params = array(':keyword' => "%{$keyword}%");
         $is_partial = true;
     }
     $imodel = new $controllerId();
     $item_count = call_user_func(array($imodel, 'count'), $criteria);
     $page_size = 10;
     $pages = new CPagination($item_count);
     $pages->setPageSize($page_size);
     $pagination = new CLinkPager();
     $pagination->cssFile = false;
     $pagination->setPages($pages);
     $pagination->init();
     $criteria->limit = $page_size;
     $criteria->offset = $pages->offset;
     $select_pagination = new CListPager();
     $select_pagination->header = '跳转到:';
     $select_pagination->htmlOptions['onchange'] = "";
     $select_pagination->setPages($pages);
     $select_pagination->init();
     $list = call_user_func(array($imodel, 'findAll'), $criteria);
     if ($is_partial) {
         $this->renderPartial('_index', array('list' => $list, 'pagination' => $pagination, 'select_pagination' => $select_pagination), false, true);
     } else {
         $this->render('index', array('list' => $list, 'pagination' => $pagination, 'select_pagination' => $select_pagination), false, true);
     }
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:35,代码来源:ArticleController.php

示例5: actionIndex

 public function actionIndex($id = null)
 {
     if (!empty($this->arrSystem)) {
         $this->pageTitle = "Hình ảnh - " . $this->arrSystem->title;
     }
     $criteria = new CDBCriteria();
     $title = "";
     if ($id == null) {
         $criteria->addCondition("is_product = 1");
         $title = "Hình ảnh hoạt động";
     } else {
         if ($id == 2) {
             $criteria->addCondition("is_product = 2");
             $title = "Sản phẩm mới";
         } else {
             throw new CHttpException(404, 'Không tìm thấy trang!.');
         }
     }
     $countItem = Slides::model()->count($criteria);
     $pages = new CPagination($countItem);
     $pages->setPageSize(12);
     $pages->applyLimit($criteria);
     $arrNew = Slides::model()->findAll($criteria);
     $arrImage = Slides::model()->findALl($criteria);
     $this->render("index", array('arrImage' => $arrImage, 'item_count' => $countItem, 'page_size' => 12, 'pages' => $pages, 'title' => $title));
 }
开发者ID:phiphi1992,项目名称:alongaydep,代码行数:26,代码来源:ImageController.php

示例6: actionList

 public function actionList()
 {
     $_default_item_perpage = 10;
     if (isset($_GET['limit']) && (int) $_GET['limit'] > 0) {
         Yii::app()->session['current'] = $_GET['limit'];
         $_default_item_perpage = Yii::app()->session['current'];
     } else {
         if (isset(Yii::app()->session['current'])) {
             $_default_item_perpage = Yii::app()->session['current'];
         } else {
             Yii::app()->session['current'] = $_default_item_perpage;
         }
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition('current=1 AND web=1');
     $q = Yii::app()->getRequest()->getQuery('q');
     if ($q) {
         $criteria->addCondition('`title` LIKE "%' . $q . '%" OR `code` LIKE "%' . $q . '%" OR `description_short` LIKE "%' . $q . '%"');
     }
     $criteria->order = _xls_get_sort_order();
     $item_count = Product::model()->count($criteria);
     $pages = new CPagination($item_count);
     $pages->setPageSize($_default_item_perpage);
     $pages->applyLimit($criteria);
     $model = Product::model()->findAll($criteria);
     $this->render('list', array('model' => $model, 'item_count' => $item_count, 'page_size' => $_default_item_perpage, 'items_count' => $item_count, 'pages' => $pages));
 }
开发者ID:hyperspace-dev,项目名称:Lightspeed-Plugins,代码行数:27,代码来源:ZoomproductController.php

示例7: actionMembers

 /**
  * Action for the members section of the directory
  *
  * @todo Dont pass lucene hits to view, build user array inside of action
  */
 public function actionMembers()
 {
     $details = Yii::app()->db->createCommand()->select('companyname, username, firstname, lastname, title, guid')->from('user, profile')->where('user.id=profile.user_id and group_id=3')->order('companyname')->queryAll();
     $companycount = Yii::app()->db->createCommand()->select('count(distinct(companyname)) as count')->from('profile')->where('companyname not like \'student\'')->order('companyname')->queryAll();
     $item_count = (int) $companycount[0]["count"];
     $page_size = (int) $companycount[0]["count"];
     $pages = new CPagination($item_count);
     $pages->setPageSize($page_size);
     $end = $pages->offset + $pages->limit <= $item_count ? $pages->offset + $pages->limit : $item_count;
     $sample = array();
     $y = "";
     $i = 0;
     $j = 0;
     foreach ($details as $x) {
         if ($x["companyname"] != $y) {
             $sample[$i++] = array('cname' => $x["companyname"], 'detail' => array());
             $j = 0;
         }
         $sample[$i - 1]["detail"][$j++] = $x;
         $y = $x["companyname"];
     }
     $pg_content = array();
     for ($i = $pages->offset; $i < $end; $i++) {
         $pg_content[$i] = $sample[$i];
     }
     $this->render('members', array('item_count' => $item_count, 'page_size' => $page_size, 'items_count' => $item_count, 'pages' => $pages, 'sample' => $pg_content));
 }
开发者ID:skapl,项目名称:design,代码行数:32,代码来源:CompaniesController.php

示例8: actionPickAtt

 public function actionPickAtt()
 {
     $return_id = $_GET['return_id'];
     $rtype = $_GET['rtype'];
     $criteria = new CDbCriteria();
     if (isset($_GET['keyword'])) {
         $screen_name = trim($_GET['keyword']);
         $criteria->condition = 'screen_name like :screen_name';
         $criteria->params = array(':screen_name' => "%{$screen_name}%");
         $partial_tpl = '_att';
         //$atts = Attachment::model()->findAll($criteria);
         //$this->renderPartial('_att',array('return_id' => $return_id,'atts' => $atts,'rtype' => $rtype ),false,true);
     } else {
         $partial_tpl = 'pickatt';
         //$atts = Attachment::model()->findAll();
         //$this->renderPartial('pickatt',array('return_id' => $return_id,'atts' => $atts ,'rtype' => $rtype ),false,true);
     }
     $item_count = Attachment::model()->count($criteria);
     $page_size = 10;
     $pages = new CPagination($item_count);
     $pages->setPageSize($page_size);
     $pagination = new CLinkPager();
     $pagination->cssFile = false;
     $pagination->setPages($pages);
     $pagination->init();
     $criteria->limit = $page_size;
     $criteria->offset = $pages->offset;
     $select_pagination = new CListPager();
     $select_pagination->htmlOptions['onchange'] = "";
     $select_pagination->setPages($pages);
     $select_pagination->init();
     $atts = Attachment::model()->findAll($criteria);
     $this->renderPartial($partial_tpl, array('return_id' => $return_id, 'atts' => $atts, 'rtype' => $rtype, 'pagination' => $pagination, 'select_pagination' => $select_pagination), false, true);
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:34,代码来源:RelController.php

示例9: actionIndex

 public function actionIndex()
 {
     if (isset($_GET['type_id'])) {
         $criteria = new CDbCriteria();
         $criteria->select = '*';
         $criteria->condition = 'status = 1 AND report_type_id =' . $_GET['type_id'];
         $criteria->order = 'sort_order';
         $total = Report::model()->count($criteria);
         $pages = new CPagination($total);
         $pages->setPageSize(20);
         $pages->applyLimit($criteria);
         $model = Report::model()->findAll($criteria);
         $type = ReportType::model()->findByPK($_GET['type_id']);
         $this->render('index', array('model' => $model, 'type' => $type, 'pages' => $pages));
     } else {
         if (isset($_GET['id'])) {
             $model = Report::model()->findByPk($_GET['id']);
             $this->render('detail', array('model' => $model));
         } else {
             $criteria = new CDbCriteria();
             $criteria->select = '*';
             $criteria->condition = 'status = 1';
             $criteria->order = 'sort_order';
             $total = Report::model()->count($criteria);
             $pages = new CPagination($total);
             $pages->setPageSize(20);
             $pages->applyLimit($criteria);
             $model = Report::model()->findAll($criteria);
             $this->render('index', array('model' => $model, 'pages' => $pages));
         }
     }
 }
开发者ID:ultr4h4ck,项目名称:project_gspa,代码行数:32,代码来源:ReportController.php

示例10: actionTag

 public function actionTag()
 {
     $data = array();
     $alias = urlGETParams('alias');
     $query = "SELECT * FROM tbl_tags_youtube WHERE alias = :alias";
     $values = array(':alias' => $alias);
     $row = $this->db->createCommand($query)->bindValues($values)->queryRow();
     if (empty($row)) {
         $this->redirect($this->createUrl('video/index'));
     }
     $data['row'] = $row;
     $tag_id = $row['id'];
     $where = " AND tags LIKE '%," . $tag_id . ",%' ";
     $query_count = "SELECT COUNT(id) FROM tbl_youtube WHERE 1 " . $where;
     $item_count = $this->db->createCommand($query_count)->queryScalar();
     $pages = new CPagination($item_count);
     $perPage = 30;
     $pages->setPageSize($perPage);
     $page = isset($_GET['page']) ? intval($_GET['page']) : 0;
     if ($page <= 0) {
         $page = 1;
     }
     $offset = ($page - 1) * $perPage;
     $query = "SELECT * FROM tbl_youtube WHERE 1 " . $where . " " . " ORDER BY id DESC " . "LIMIT " . $offset . "," . $perPage;
     $data['listVideo'] = $this->db->createCommand($query)->queryAll();
     $title = $data['row']['name'] . ' videos';
     if ($page > 1) {
         $title .= ' - page ' . $page;
     }
     $this->_meta = array('title' => $title . ' - Techz24', 'description' => 'All videos in topic . ' . $data['row']['name'] . ' on Techz24');
     $this->_style_class = 'page right-sidebar singular fade-imgs-in-appear one-side-wide both-sidebars archive-page';
     $this->render('tag', array('data' => $data, 'item_count' => $item_count, 'page_size' => $perPage, 'pages' => $pages));
 }
开发者ID:haanhman,项目名称:techz24,代码行数:33,代码来源:VideoController.php

示例11: search

 public function search($begin, $end)
 {
     $condition = 'time>=:begin AND time<=:end';
     $params = ['begin' => $begin, 'end' => $end];
     $model = Logging::model();
     $pager = new CPagination($model->count($condition, $params));
     $pager->setPageSize(100);
     $logging = $model->findAll(['condition' => $condition, 'params' => $params, 'offset' => $pager->getOffset(), 'limit' => $pager->getLimit(), 'order' => 'time desc']);
     $this->render('index', ['logging' => new RedArrayDataProvider($logging), 'pager' => $pager]);
 }
开发者ID:syxoasis,项目名称:wakfu-sae,代码行数:10,代码来源:LoggingController.php

示例12: actionIndex

 public function actionIndex()
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'id DESC';
     if ($_GET['find']) {
         if ($_GET['activity_type'] != NULL and $_GET['start_date'] == NULL and $_GET['end_date'] == NULL) {
             $type = $_GET['activity_type'];
             $criteria->condition = 'activity_type LIKE :type';
             $criteria->params[':type'] = $type;
         } elseif ($_GET['activity_type'] == NULL and $_GET['start_date'] != NULL and $_GET['end_date'] != NULL) {
             $start_date = date('Y-m-d', strtotime($_GET['start_date']));
             $end_date = date('Y-m-d', strtotime($_GET['end_date']));
             if ($start_date == $end_date) {
                 $criteria->condition = 'DATE(activity_time) LIKE :date';
                 $criteria->params[':date'] = $start_date;
             } else {
                 $criteria->condition = 'DATE(activity_time) BETWEEN :start_date AND :end_date';
                 $criteria->params[':start_date'] = $start_date;
                 $criteria->params[':end_date'] = $end_date;
             }
         } elseif ($_GET['activity_type'] == NULL and $_GET['start_date'] != NULL and $_GET['end_date'] == NULL) {
             $start_date = date('Y-m-d', strtotime($_GET['start_date']));
             $criteria->condition = 'DATE(activity_time) >= :date';
             $criteria->params[':date'] = $start_date;
         } elseif ($_GET['activity_type'] == NULL and $_GET['start_date'] == NULL and $_GET['end_date'] != NULL) {
             $end_date = date('Y-m-d', strtotime($_GET['end_date']));
             $criteria->condition = 'DATE(activity_time) <= :date';
             $criteria->params[':date'] = $end_date;
         } elseif ($_GET['activity_type'] != NULL and $_GET['start_date'] != NULL and $_GET['end_date'] != NULL) {
             $type = $_GET['activity_type'];
             $start_date = date('Y-m-d', strtotime($_GET['start_date']));
             $end_date = date('Y-m-d', strtotime($_GET['end_date']));
             $criteria->condition = 'activity_type LIKE :type';
             $criteria->params[':type'] = $type;
             if ($start_date == $end_date) {
                 $criteria->condition = $criteria->condition . ' AND DATE(activity_time) LIKE :date';
                 $criteria->params[':date'] = $start_date;
             } else {
                 $criteria->condition = $criteria->condition . ' AND DATE(activity_time) BETWEEN :start_date AND :end_date';
                 $criteria->params[':start_date'] = $start_date;
                 $criteria->params[':end_date'] = $end_date;
             }
         }
     }
     $total = ActivityFeed::model()->count($criteria);
     // Count feeds
     $pages = new CPagination($total);
     $pages->setPageSize(Yii::app()->params['listPerPage']);
     $pages->applyLimit($criteria);
     $feeds = ActivityFeed::model()->findAll($criteria);
     // Get feeds
     /*echo $pages->getCurrentPage().'-'.$pages->getPageCount().'---'.count($feeds).'....';
     		echo $total;exit;*/
     $this->render('index', array('feeds' => $feeds, 'type' => $type, 'start_date' => $_GET['start_date'], 'end_date' => $_GET['end_date'], 'pages' => $pages, 'criteria' => $criteria));
 }
开发者ID:akilraj1255,项目名称:rajeshwari,代码行数:55,代码来源:ActivityFeedController.php

示例13: actionHlist

 public function actionHlist()
 {
     $this->layout = '//layouts/blank';
     $criteria = Advertisement::model()->setFetchCondition();
     $count = Advertisement::model()->count($criteria);
     $pagination = new CPagination($count);
     $pagination->setPageSize(15);
     $pagination->applyLimit($criteria);
     $dataProvider = Advertisement::model()->findAll($criteria);
     $this->render('hlist', array('model' => $model, 'dataProvider' => $dataProvider, 'pagination' => $pagination));
 }
开发者ID:yunsite,项目名称:my-advertise,代码行数:11,代码来源:ArchiverController.php

示例14: actionBasicPager

 public function actionBasicPager()
 {
     $item_count = 32;
     $page_size = 5;
     $pages = new CPagination($item_count);
     $pages->setPageSize($page_size);
     // simulate the effect of LIMIT in a sql query
     $end = $pages->offset + $pages->limit <= $item_count ? $pages->offset + $pages->limit : $item_count;
     $sample = range($pages->offset + 1, $end);
     $this->render('basic_pager', array('item_count' => $item_count, 'page_size' => $page_size, 'items_count' => $item_count, 'pages' => $pages, 'sample' => $sample));
 }
开发者ID:TianJinRong,项目名称:yiiplayground,代码行数:11,代码来源:PaginationController.php

示例15: __construct

 /**
  * Constructor.
  * @param CDataProvider $dataProvider the data provider to iterate over
  * @param integer       $pageSize     pageSize to use for iteration. This is the number of objects loaded into memory at the same time.
  */
 public function __construct(CDataProvider $dataProvider, $pageSize = null)
 {
     $this->_dataProvider = $dataProvider;
     $this->_totalItemCount = $dataProvider->getTotalItemCount();
     if (($pagination = $this->_dataProvider->getPagination()) === false) {
         $this->_dataProvider->setPagination($pagination = new CPagination());
     }
     if ($pageSize !== null) {
         $pagination->setPageSize($pageSize);
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:16,代码来源:DataProviderIterator.php


注:本文中的CPagination::setPageSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。