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


PHP CPagination::getOffset方法代码示例

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


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

示例1: run

 /**
  * Executes the widget.
  */
 public function run()
 {
     if ($this->pagination->getPageCount() == $this->pagination->getCurrentPage() + 1) {
         return;
     }
     $showMoreUrl = CHtml::normalizeUrl(Yii::app()->createUrl('comment/comment/show', array('contentModel' => get_class($this->object), 'contentId' => $this->object->getPrimaryKey(), 'page' => $this->pagination->getCurrentPage() + 2)));
     $moreCount = $this->pagination->getPageSize();
     if ($this->pagination->getPageCount() == $this->pagination->getCurrentPage() + 2) {
         $moreCount = $this->pagination->getItemCount() - $this->pagination->getPageSize() - $this->pagination->getOffset();
     }
     $this->render('showMore', array('object' => $this->object, 'pagination' => $this->pagination, 'id' => get_class($this->object) . "_" . $this->object->getPrimaryKey(), 'showMoreUrl' => $showMoreUrl, 'moreCount' => $moreCount));
 }
开发者ID:skapl,项目名称:design,代码行数:15,代码来源:CommentsShowMoreWidget.php

示例2: actionMyPlaylist

 public function actionMyPlaylist()
 {
     if (!$this->userPhone) {
         $this->redirect("/account/login");
         Yii::app()->end();
     }
     $limit = Yii::app()->params['numberPerPage'];
     $user = UserModel::model()->find("phone=" . $this->userPhone);
     $page = Yii::app()->request->getParam('page', 1);
     if ($user) {
         $userId = $user->id;
         $count = WapPlaylistModel::model()->countPlaylistUserIDPhone($userId, $this->userPhone);
         $pager = new CPagination($count);
         $pager->setPageSize($limit);
         $playlist = WapPlaylistModel::model()->getPlaylistByUser($userId, $this->userPhone, $limit, $pager->getOffset());
     } else {
         $userId = null;
         $count = WapPlaylistModel::model()->countPlaylistByPhone($this->userPhone);
         $pager = new CPagination($count);
         $pager->setPageSize($limit);
         $playlist = WapPlaylistModel::model()->getPlaylistByPhone($this->userPhone, $limit, $pager->getOffset());
     }
     $callBack = Yii::app()->request->getParam('call_back', 0);
     $callBackLink = Yii::app()->createUrl("playlist/myPlaylist");
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajaxList", compact('playlist', 'pager', 'callBackLink'));
         Yii::app()->end();
     }
     $this->render('myplaylist', array('playlist' => $playlist, 'pager' => $pager, 'callBackLink' => $callBackLink));
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:31,代码来源:PlaylistController.php

示例3: Pages

 /**
  * 
  * Enter description here ...
  * @param unknown_type $params
  */
 public static function Pages($params = array())
 {
     //设置默认参数
     $_defaults_params = array('allow_cache' => true, 'page' => isset($_GET['page']) ? intval($_GET['page']) : 1, 'pagesize' => 30);
     $params = array_merge($_defaults_params, $params);
     $cmd = Yii::app()->db->createCommand();
     $cmd->select('COUNT(u.collect_log_id) AS COUNT')->from('{{collect_log}} u');
     if (intval($params['collect_log_insert_time'])) {
         $__addons = array('AND', 'u.collect_log_insert_time=:collect_log_insert_time');
         $__params = array(':collect_log_insert_time' => $params['collect_log_insert_time']);
     }
     if ($params['collect_log_msg']) {
         $__addons[] = array('AND', array('OR LIKE', 'u.collect_log_msg', "%{$params[collect_log_msg]}%"));
     }
     if (is_array($__addons) && is_array($__params)) {
         $cmd->where($__addons, $__params);
     }
     //统计数量
     $count = $cmd->queryScalar();
     //分页处理
     $pages = new CPagination($count);
     //设置分页大小
     $pages->pageSize = $params['pagesize'];
     //清空前面执行过的SQL
     $cmd->setText('');
     if (isset($params['orderby']) && $params['orderby']) {
         $cmd->order($params['orderby']);
     } else {
         $cmd->order(array('u.collect_log_id DESC'));
     }
     $cmd->select('u.*')->limit($pages->getLimit())->offset($pages->getOffset());
     $_r['pages'] = $pages;
     $_r['rows'] = $cmd->queryAll();
     return $_r;
 }
开发者ID:nbaiwan,项目名称:yav,代码行数:40,代码来源:CollectLog.php

示例4: fetchAllByPage

 public function fetchAllByPage($conditions = "", $pageSize = null)
 {
     $pages = new CPagination($this->countByCondition($conditions));
     $pageSize = is_null($pageSize) ? Yii::app()->params["basePerPage"] : $pageSize;
     $pages->setPageSize(intval($pageSize));
     $criteria = new CDbCriteria(array("limit" => $pages->getLimit(), "offset" => $pages->getOffset()));
     $pages->applyLimit($criteria);
     $fields = "r.resumeid,rd.detailid,rd.realname,rd.positionid,rd.gender,rd.birthday,rd.education,rd.workyears,r.flag,r.status";
     $sql = "SELECT {$fields} FROM {{resume}} r LEFT JOIN {{resume_detail}} rd ON r.resumeid=rd.resumeid ";
     if (!empty($conditions)) {
         $sql .= " WHERE " . $conditions;
     }
     $offset = $pages->getOffset();
     $limit = $pages->getLimit();
     $sql .= " ORDER BY r.entrytime DESC LIMIT {$offset},{$limit}";
     $records = $this->getDbConnection()->createCommand($sql)->queryAll();
     return array("pages" => $pages, "datas" => $records);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:18,代码来源:Resume.php

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

示例6: actionView

 /**
  * Displays a particular model.
  *
  * @param integer $id
  *        	the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $count = CopyrightInputContentModel::model()->getCountSong($id);
     $page = new CPagination($count);
     $page->pageSize = 100;
     $songs = CopyrightInputContentModel::model()->getListSong($id, $page->getLimit(), $page->getOffset());
     /* $inputModel = new CopyrightSongInputModel("search");
     		$inputModel->unsetAttributes ();
     		$inputModel->setAttribute("input_file", $id); */
     $this->render('view', array('model' => $this->loadModel($id), 'songs' => $songs, 'page' => $page));
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:17,代码来源:DefaultController.php

示例7: view

 private function view()
 {
     $query = $this->request->getPost('Setting', []);
     $model = Setting::model();
     $model->attributes = $query;
     $condition = $this->createSearchCriteria($query);
     $pager = new CPagination($model->count($condition));
     $pager->setPageSize(20);
     $condition['offset'] = $pager->getOffset();
     $condition['limit'] = $pager->getLimit();
     $data = $model->findAll($condition);
     $this->render('setting', ['data' => new RedArrayDataProvider($data), 'pager' => $pager, 'model' => $model]);
 }
开发者ID:syxoasis,项目名称:wakfu-sae,代码行数:13,代码来源:DashboardController.php

示例8: run

 public function run()
 {
     $query = $this->request->getQuery('Service', []);
     $model = Service::model();
     $model->attributes = $query;
     $condition = $this->createSearchCriteria($query);
     $pager = new CPagination($model->count($condition));
     $pager->setPageSize(20);
     $condition['offset'] = $pager->getOffset();
     $condition['limit'] = $pager->getLimit();
     $condition['order'] = 'status asc, uid asc';
     $data = $model->findAll($condition);
     $this->render('pac', ['data' => new RedArrayDataProvider($data), 'pager' => $pager, 'model' => $model]);
 }
开发者ID:syxoasis,项目名称:wakfu-sae,代码行数:14,代码来源:PacAction.php

示例9: actionBilling

 public function actionBilling()
 {
     $query = ['uid' => $this->user->getId()];
     $model = Traffic::model();
     $model->attributes = $query;
     $condition = ['condition' => 'uid=:uid', 'params' => ['uid' => $query['uid']]];
     $pager = new CPagination($model->count($condition));
     $pager->setPageSize(20);
     $condition['offset'] = $pager->getOffset();
     $condition['limit'] = $pager->getLimit();
     $condition['order'] = 'date desc';
     $data = $model->findAll($condition);
     $this->render('billing', ['data' => new RedArrayDataProvider($data), 'pager' => $pager]);
 }
开发者ID:syxoasis,项目名称:wakfu-sae,代码行数:14,代码来源:IndexController.php

示例10: actionIndex

 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'));
 }
开发者ID:phuongitvn,项目名称:vdh,代码行数:14,代码来源:SiteController.php

示例11: actionSearch

 public function actionSearch()
 {
     $keyword = Yii::app()->request->getParam('q');
     if ($keyword == '') {
         $this->redirect(Yii::app()->homeUrl);
     }
     $keyword = Common::RemoveXSS($keyword);
     $order = Yii::app()->request->getParam('order', 1);
     $channel = strtolower(Yii::app()->request->getParam('channel', 'web'));
     $pagesize = 12;
     $count = ProductModel::model()->countsearchProduct($channel, $keyword);
     $page = new CPagination($count);
     $page->pageSize = $pagesize;
     $product_web = ProductModel::model()->searchProduct($channel, $keyword, $order, $page->getLimit(), $page->getOffset());
     $this->render('search', compact('product_web', 'page', 'keyword', 'order', 'channel', 'count'));
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:16,代码来源:ProductController.php

示例12: fetchAllAndPage

 public function fetchAllAndPage($conditions = "", $pageSize = null)
 {
     $pages = new CPagination($this->countByCondition($conditions));
     $pageSize = is_null($pageSize) ? Yii::app()->params["basePerPage"] : $pageSize;
     $pages->setPageSize(intval($pageSize));
     $offset = $pages->getOffset();
     $limit = $pages->getLimit();
     $criteria = new CDbCriteria(array("limit" => $limit, "offset" => $offset));
     $pages->applyLimit($criteria);
     $fields = "*";
     $sql = "SELECT {$fields} FROM {{tasks}}";
     if (!empty($conditions)) {
         $sql .= " WHERE " . $conditions;
     }
     $sql .= " ORDER BY sort DESC LIMIT {$offset},{$limit}";
     $records = $this->getDbConnection()->createCommand($sql)->queryAll();
     return array("pages" => $pages, "datas" => $records);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:18,代码来源:Tasks.php

示例13: actionAlbum

 public function actionAlbum()
 {
     $callBack = (int) Yii::app()->request->getParam('call_back', 0);
     $page = (int) Yii::app()->request->getParam('page', 1);
     $limit = self::_NUMBER_ITEM_VIEW;
     $count = WapAlbumModel::countListByCollection('ALBUM_DOC_QUYEN');
     $albums = WapAlbumModel::getListByCollection('ALBUM_DOC_QUYEN', $page, $limit);
     $pager = new CPagination($count);
     $pager->setPageSize($limit);
     $offset = $pager->getOffset();
     $callBackLink = Yii::app()->createUrl("/shell/album");
     if ($callBack) {
         $this->layout = false;
         $this->render("_ajax_album_list", compact('videos', 'pager', 'callBackLink'));
     } else {
         $this->render('album', array('albums' => $albums, 'pager' => $pager, 'callBackLink' => $callBackLink));
     }
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:18,代码来源:ShellController.php

示例14: fetchAllByPage

 public function fetchAllByPage($condition = "", $pageSize = 0)
 {
     $count = empty($condition) ? $this->count() : $this->countBySearchCondition($condition);
     $pagination = new CPagination($count);
     $pageSize = empty($pageSize) ? Yii::app()->params["basePerPage"] : $pageSize;
     $pagination->setPageSize($pageSize);
     $offset = $pagination->getOffset();
     $limit = $pagination->getLimit();
     $criteria = new CDbCriteria(array("limit" => $limit, "offset" => $offset));
     $pagination->applyLimit($criteria);
     $fields = "rd.realname,rb.checkid,rb.resumeid,rb.company,rb.position,rb.entrytime,rb.quittime";
     $sql = "SELECT {$fields} FROM {{resume_bgchecks}} rb LEFT JOIN {{resume_detail}} rd ON rb.resumeid=rd.resumeid ";
     if (!empty($condition)) {
         $sql .= " WHERE " . $condition;
     }
     $sql .= " LIMIT {$offset},{$limit}";
     $records = $this->getDbConnection()->createCommand($sql)->queryAll();
     return array("pagination" => $pagination, "data" => $records);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:19,代码来源:ResumeBgchecks.php

示例15: actionTopics

 public function actionTopics($page = 1)
 {
     $limit = 20;
     $token = $this->getToken();
     $res = RpcClient_STD_Topic::Instance()->getTopicList($token, $page, "", $limit, 0, true);
     $data = $res['data'];
     $total = isset($data['total']) ? $data['total'] : 0;
     $pages = new CPagination($total);
     $pages->pageSize = $limit;
     $pages->applyLimit(new CDbCriteria());
     $params['topics'] = $data['list'] ? $data['list'] : array();
     $params['pages'] = $pages;
     $params['total'] = $total;
     $params['current_page'] = $pages->getOffset();
     $this->jsApp = array('controller/list', 'Init', array("type" => "topic", "apis" => array("delete" => "admin/removetopics")));
     $params['current_time'] = date('y-m-d h:i:s', time());
     $params['current_from'] = $pages->getCurrentPage() * $limit + 1;
     $params['current_to'] = $params['current_from'] + count($params['topics']) - 1;
     $this->render('topics', $params);
 }
开发者ID:nangong92t,项目名称:go_src,代码行数:20,代码来源:ContentController.php


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