Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CBasePager
  • CLinkPager
  • CListPager
  • MobileRecordIndexPager
  • MobileTopicsPager
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * CBasePager class file.
  4:  *
  5:  * @author Qiang Xue <qiang.xue@gmail.com>
  6:  * @link http://www.yiiframework.com/
  7:  * @copyright 2008-2013 Yii Software LLC
  8:  * @license http://www.yiiframework.com/license/
  9:  */
 10: 
 11: /**
 12:  * CBasePager is the base class for all pagers.
 13:  *
 14:  * It provides the calculation of page count and maintains the current page.
 15:  *
 16:  * @property CPagination $pages The pagination information.
 17:  * @property integer $pageSize Number of items in each page.
 18:  * @property integer $itemCount Total number of items.
 19:  * @property integer $pageCount Number of pages.
 20:  * @property integer $currentPage The zero-based index of the current page. Defaults to 0.
 21:  *
 22:  * @author Qiang Xue <qiang.xue@gmail.com>
 23:  * @package system.web.widgets.pagers
 24:  * @since 1.0
 25:  */
 26: abstract class CBasePager extends CWidget
 27: {
 28:     private $_pages;
 29: 
 30:     /**
 31:      * Returns the pagination information used by this pager.
 32:      * @return CPagination the pagination information
 33:      */
 34:     public function getPages()
 35:     {
 36:         if($this->_pages===null)
 37:             $this->_pages=$this->createPages();
 38:         return $this->_pages;
 39:     }
 40: 
 41:     /**
 42:      * Sets the pagination information used by this pager.
 43:      * @param CPagination $pages the pagination information
 44:      */
 45:     public function setPages($pages)
 46:     {
 47:         $this->_pages=$pages;
 48:     }
 49: 
 50:     /**
 51:      * Creates the default pagination.
 52:      * This is called by {@link getPages} when the pagination is not set before.
 53:      * @return CPagination the default pagination instance.
 54:      */
 55:     protected function createPages()
 56:     {
 57:         return new CPagination;
 58:     }
 59: 
 60:     /**
 61:      * @return integer number of items in each page.
 62:      * @see CPagination::getPageSize
 63:      */
 64:     public function getPageSize()
 65:     {
 66:         return $this->getPages()->getPageSize();
 67:     }
 68: 
 69:     /**
 70:      * @param integer $value number of items in each page
 71:      * @see CPagination::setPageSize
 72:      */
 73:     public function setPageSize($value)
 74:     {
 75:         $this->getPages()->setPageSize($value);
 76:     }
 77: 
 78:     /**
 79:      * @return integer total number of items.
 80:      * @see CPagination::getItemCount
 81:      */
 82:     public function getItemCount()
 83:     {
 84:         return $this->getPages()->getItemCount();
 85:     }
 86: 
 87:     /**
 88:      * @param integer $value total number of items.
 89:      * @see CPagination::setItemCount
 90:      */
 91:     public function setItemCount($value)
 92:     {
 93:         $this->getPages()->setItemCount($value);
 94:     }
 95: 
 96:     /**
 97:      * @return integer number of pages
 98:      * @see CPagination::getPageCount
 99:      */
100:     public function getPageCount()
101:     {
102:         return $this->getPages()->getPageCount();
103:     }
104: 
105:     /**
106:      * @param boolean $recalculate whether to recalculate the current page based on the page size and item count.
107:      * @return integer the zero-based index of the current page. Defaults to 0.
108:      * @see CPagination::getCurrentPage
109:      */
110:     public function getCurrentPage($recalculate=true)
111:     {
112:         return $this->getPages()->getCurrentPage($recalculate);
113:     }
114: 
115:     /**
116:      * @param integer $value the zero-based index of the current page.
117:      * @see CPagination::setCurrentPage
118:      */
119:     public function setCurrentPage($value)
120:     {
121:         $this->getPages()->setCurrentPage($value);
122:     }
123: 
124:     /**
125:      * Creates the URL suitable for pagination.
126:      * @param integer $page the page that the URL should point to.
127:      * @return string the created URL
128:      * @see CPagination::createPageUrl
129:      */
130:     protected function createPageUrl($page)
131:     {
132:         return $this->getPages()->createPageUrl($this->getController(),$page);
133:     }
134: }
135: 
API documentation generated by ApiGen 2.8.0