MediaWiki  master
IndexPager Class Reference

IndexPager is an efficient pager which uses a (roughly unique) index in the data set to implement paging, rather than a "LIMIT offset,limit" clause. More...

Inheritance diagram for IndexPager:
Collaboration diagram for IndexPager:

Public Member Functions

 __construct (IContextSource $context=null, LinkRenderer $linkRenderer=null)
 Stable to call. More...
 
 doQuery ()
 Do the query, using information from the object context. More...
 
 formatRow ( $row)
 Returns an HTML string representing the result row $row. More...
 
 getBody ()
 Get the formatted result list. More...
 
 getDatabase ()
 Get the Database object in use. More...
 
 getDefaultQuery ()
 Get an array of query parameters that should be put into self-links. More...
 
 getIndexField ()
 Returns the name of the index field. More...
 
 getLimit ()
 Get the current limit. More...
 
 getNumRows ()
 Get the number of rows in the result set. More...
 
 getPagingQueries ()
 Get a URL query array for the prev, next, first and last links. More...
 
 getQueryInfo ()
 Provides all parameters needed for the main paged query. More...
 
 getResult ()
 
 reallyDoQuery ( $offset, $limit, $order)
 Do a query with specified parameters, rather than using the object context. More...
 
 setIncludeOffset ( $include)
 Set whether a row matching exactly the offset should be also included in the result or not. More...
 
 setLimit ( $limit)
 Set the limit from an other source than the request. More...
 
 setOffset ( $offset)
 Set the offset from an other source than the request. More...
 
- Public Member Functions inherited from ContextSource
 canUseWikiPage ()
 Check whether a WikiPage object can be get with getWikiPage(). More...
 
 exportSession ()
 Export the resolved user IP, HTTP headers, user ID, and session ID. More...
 
 getConfig ()
 
 getContext ()
 Get the base IContextSource object. More...
 
 getLanguage ()
 
 getOutput ()
 
 getRequest ()
 
 getSkin ()
 
 getStats ()
 
 getTiming ()
 
 getTitle ()
 
 getUser ()
 Stable to override. More...
 
 getWikiPage ()
 Get the WikiPage object. More...
 
 msg ( $key,... $params)
 Get a Message object with context set Parameters are the same as wfMessage() More...
 
 setContext (IContextSource $context)
 
- Public Member Functions inherited from Pager
 getNavigationBar ()
 

Public Attributes

IDatabase $mDb
 
bool $mDefaultDirection
 $mDefaultDirection gives the direction to use when sorting results: DIR_ASCENDING or DIR_DESCENDING. More...
 
int $mDefaultLimit = 50
 The default entry limit choosen for clients. More...
 
bool $mIsBackwards
 
bool $mIsFirst
 True if the current result set is the first one. More...
 
bool $mIsLast
 
int $mLimit
 The maximum number of entries to show. More...
 
int[] $mLimitsShown = [ 20, 50, 100, 250, 500 ]
 List of default entry limit options to be presented to clients. More...
 
mixed $mOffset
 The starting point to enumerate entries. More...
 
stdClass bool null $mPastTheEndRow
 Extra row fetched at the end to see if the end was reached. More...
 
bool $mQueryDone = false
 Whether the listing query completed. More...
 
WebRequest $mRequest
 
IResultWrapper $mResult
 Result object for the query. More...
 
const DIR_ASCENDING = false
 Backwards-compatible constant for $mDefaultDirection field (do not change) More...
 
const DIR_DESCENDING = true
 Backwards-compatible constant for $mDefaultDirection field (do not change) More...
 
const QUERY_ASCENDING = true
 Backwards-compatible constant for reallyDoQuery() (do not change) More...
 
const QUERY_DESCENDING = false
 Backwards-compatible constant for reallyDoQuery() (do not change) More...
 

Protected Member Functions

 buildPrevNextNavigation (Title $title, $offset, $limit, array $query=[], $atend=false)
 Generate (prev x| next x) (20|50|100...) type links for paging. More...
 
 buildQueryInfo ( $offset, $limit, $order)
 Build variables to use by the database wrapper. More...
 
 doBatchLookups ()
 Called from getBody(), before getStartBody() is called and after doQuery() was called. More...
 
 extractResultInfo ( $isFirst, $limit, IResultWrapper $res)
 Extract some useful data from the result object for use by the navigation bar, put it into $this. More...
 
 getDefaultDirections ()
 Return the default sorting direction: DIR_ASCENDING or DIR_DESCENDING. More...
 
 getEmptyBody ()
 Hook into getBody(), for the bit between the start and the end when there are no rows. More...
 
 getEndBody ()
 Hook into getBody() for the end of the list. More...
 
 getExtraSortFields ()
 Returns the names of secondary columns to order by in addition to the column in getIndexField(). More...
 
 getLimitLinks ()
 
 getLinkRenderer ()
 
 getPagingLinks ( $linkTexts, $disabledTexts=[])
 Get paging links. More...
 
 getSqlComment ()
 Get some text to go in brackets in the "function name" part of the SQL comment. More...
 
 getStartBody ()
 Hook into getBody(), allows text to be inserted at the start. More...
 
 isNavigationBarShown ()
 Returns whether to show the "navigation bar" @stable to override. More...
 
 makeLink ( $text, array $query=null, $type=null)
 Make a self-link. More...
 
 preprocessResults ( $result)
 Pre-process results; useful for performing batch existence checks, etc. More...
 

Static Protected Member Functions

static oppositeOrder ( $order)
 

Protected Attributes

array $mDefaultQuery
 
string[] $mExtraSortFields
 An array of secondary columns to order by. More...
 
array $mFirstShown
 
bool $mIncludeOffset = false
 Whether to include the offset in the query. More...
 
string string[] $mIndexField
 The index to actually be used for ordering. More...
 
array $mLastShown
 
string $mNavigationBar
 
string null $mOrderType
 For pages that support multiple types of ordering, which one to use. More...
 
array $mPastTheEndIndex
 

Private Member Functions

 buildOffsetConds ( $offsets, $columns, $operator)
 Build the conditions for the offset, given that we may be paginating on a single column or multiple columns. More...
 
 buildOffsetInnerConds ( $offsets, $columns, $operator)
 Build an inner part of an offset condition, consisting of inequalities joined by AND, as described in buildOffsetConds. More...
 

Private Attributes

LinkRenderer $linkRenderer
 

Detailed Description

IndexPager is an efficient pager which uses a (roughly unique) index in the data set to implement paging, rather than a "LIMIT offset,limit" clause.

In MySQL, such a limit/offset clause requires counting through the specified number of offset rows to find the desired data, which can be expensive for large offsets.

ReverseChronologicalPager is a child class of the abstract IndexPager, and contains some formatting and display code which is specific to the use of timestamps as indexes. Here is a synopsis of its operation:

  • The query is specified by the offset, limit and direction (dir) parameters, in addition to any subclass-specific parameters.
  • The offset is the non-inclusive start of the DB query. A row with an index value equal to the offset will never be shown.
  • The query may either be done backwards, where the rows are returned by the database in the opposite order to which they are displayed to the user, or forwards. This is specified by the "dir" parameter, dir=prev means backwards, anything else means forwards. The offset value specifies the start of the database result set, which may be either the start or end of the displayed data set. This allows "previous" links to be implemented without knowledge of the index value at the start of the previous page.
  • An additional row beyond the user-specified limit is always requested. This allows us to tell whether we should display a "next" link in the case of forwards mode, or a "previous" link in the case of backwards mode. Determining whether to display the other link (the one for the page before the start of the database result set) can be done heuristically by examining the offset.
  • An empty offset indicates that the offset condition should be omitted from the query. This naturally produces either the first page or the last page depending on the dir parameter.

Subclassing the pager to implement concrete functionality should be fairly simple, please see the examples in HistoryAction.php and SpecialBlockList.php. You just need to override formatRow(), getQueryInfo() and getIndexField(). Don't forget to call the parent constructor if you override it.

Stable to extend

Definition at line 74 of file IndexPager.php.

Constructor & Destructor Documentation

◆ __construct()

IndexPager::__construct ( IContextSource  $context = null,
LinkRenderer  $linkRenderer = null 
)

Stable to call.

Parameters
IContextSource | null$context
LinkRenderer | null$linkRenderer

Reimplemented in TablePager.

Definition at line 175 of file IndexPager.php.

References ContextSource\$context, $linkRenderer, $mOrderType, DB_REPLICA, getDefaultDirections(), getExtraSortFields(), getIndexField(), ContextSource\getRequest(), ContextSource\getUser(), ContextSource\setContext(), and wfGetDB().

Member Function Documentation

◆ buildOffsetConds()

IndexPager::buildOffsetConds (   $offsets,
  $columns,
  $operator 
)
private

Build the conditions for the offset, given that we may be paginating on a single column or multiple columns.

Where we paginate on multiple columns, the sort order is defined by the order of the columns in $mIndexField.

Some examples, with up to three columns. Each condition consists of inner conditions, at least one of which must be true (joined by OR):

  • column X, with offset value 'x': WHERE X>'x'
  • columns X and Y, with offsets 'x' and 'y': WHERE X>'x' OR ( X='x' AND Y>'y' )
  • columns X, Y and Z, with offsets 'x', 'y' and 'z': WHERE X>'x' OR ( X='x' AND Y>'y' ) OR ( X='x' AND Y='y' AND Z>'z' )
  • and so on...

(The examples assume we want the next page and do not want to include the offset in the results; otherwise the operators will be slightly different, as handled in buildQueryInfo.)

Note that the above performs better than: WHERE (X,Y,Z)>('x','y','z').

Parameters
string[]$offsetsThe offset for each index field
string[]$columnsThe name of each index field
string$operatorOperator for the final part of each inner condition. This will be '>' if the query order is ascending, or '<' if the query order is descending. If the offset should be included, it will also have '=' appended.
Returns
string The conditions for getting results from the offset

Definition at line 535 of file IndexPager.php.

References buildOffsetInnerConds(), and LIST_OR.

Referenced by buildQueryInfo().

◆ buildOffsetInnerConds()

IndexPager::buildOffsetInnerConds (   $offsets,
  $columns,
  $operator 
)
private

Build an inner part of an offset condition, consisting of inequalities joined by AND, as described in buildOffsetConds.

Parameters
string[]$offsets
string[]$columns
string$operator
Returns
string The inner condition; to be concatenated in buildOffsetConds

Definition at line 557 of file IndexPager.php.

References LIST_AND.

Referenced by buildOffsetConds().

◆ buildPrevNextNavigation()

IndexPager::buildPrevNextNavigation ( Title  $title,
  $offset,
  $limit,
array  $query = [],
  $atend = false 
)
protected

Generate (prev x| next x) (20|50|100...) type links for paging.

Parameters
Title$title
int$offset
int$limit
array$queryOptional URL query parameter string
bool$atendOptional param for specified if this is the last page
Returns
string

Definition at line 964 of file IndexPager.php.

References $title.

◆ buildQueryInfo()

IndexPager::buildQueryInfo (   $offset,
  $limit,
  $order 
)
protected

Build variables to use by the database wrapper.

Note
For b/c, query direction is true for ascending and false for descending

Stable to override

Parameters
int | string$offsetIndex offset, inclusive
int$limitExact query limit
bool$orderIndexPager::QUERY_ASCENDING or IndexPager::QUERY_DESCENDING
Returns
array

Reimplemented in ActiveUsersPager, and RangeChronologicalPager.

Definition at line 464 of file IndexPager.php.

References buildOffsetConds(), getQueryInfo(), and getSqlComment().

Referenced by ImageListPager\reallyDoQuery(), and reallyDoQuery().

◆ doBatchLookups()

IndexPager::doBatchLookups ( )
protected

Called from getBody(), before getStartBody() is called and after doQuery() was called.

This will be called only if there are rows in the result set.

@stable to override

Returns
void

Reimplemented in ContribsPager, ImageListPager, UsersPager, ActiveUsersPager, NewFilesPager, and HistoryPager.

Definition at line 667 of file IndexPager.php.

Referenced by getBody().

◆ doQuery()

IndexPager::doQuery ( )

Do the query, using information from the object context.

This function has been kept minimal to make it overridable if necessary, to allow for result sets formed from multiple DB queries.

Stable to override

Reimplemented in LogPager, and ImageHistoryPseudoPager.

Definition at line 255 of file IndexPager.php.

References $mIncludeOffset, DIR_ASCENDING, extractResultInfo(), oppositeOrder(), preprocessResults(), and reallyDoQuery().

Referenced by getBody(), getNumRows(), getPagingQueries(), and isNavigationBarShown().

◆ extractResultInfo()

IndexPager::extractResultInfo (   $isFirst,
  $limit,
IResultWrapper  $res 
)
protected

Extract some useful data from the result object for use by the navigation bar, put it into $this.

Stable to override

Parameters
bool$isFirstFalse if there are rows before those fetched (i.e. if a "previous" link would make sense)
int$limitExact query limit
IResultWrapper$res

Definition at line 367 of file IndexPager.php.

References $res.

Referenced by doQuery().

◆ formatRow()

IndexPager::formatRow (   $row)
abstract

Returns an HTML string representing the result row $row.

Rows will be concatenated and returned by getBody()

Parameters
array | stdClass$rowDatabase row
Returns
string

Reimplemented in ContribsPager, LogPager, AllMessagesTablePager, DeletedContribsPager, ActiveUsersPager, UsersPager, TablePager, NewFilesPager, NewPagesPager, HistoryPager, ImageHistoryPseudoPager, ProtectedTitlesPager, MergeHistoryPager, and CategoryPager.

Referenced by getBody().

◆ getBody()

IndexPager::getBody ( )

Get the formatted result list.

Calls getStartBody(), formatRow() and getEndBody(), concatenates the results and returns them.

Stable to override

Returns
string

Implements Pager.

Reimplemented in ImageHistoryPseudoPager, TablePager, and CategoryPager.

Definition at line 586 of file IndexPager.php.

References $s, doBatchLookups(), doQuery(), formatRow(), getEmptyBody(), getEndBody(), and getStartBody().

◆ getDatabase()

IndexPager::getDatabase ( )

Get the Database object in use.

Returns
IDatabase

Reimplemented in DeletedContribsPager.

Definition at line 244 of file IndexPager.php.

References $mDb.

Referenced by ActiveUsersPager\doBatchLookups(), ActiveUsersPager\getQueryInfo(), BlockListPager\getQueryInfo(), and BlockListPager\getTotalAutoblocks().

◆ getDefaultDirections()

IndexPager::getDefaultDirections ( )
protected

Return the default sorting direction: DIR_ASCENDING or DIR_DESCENDING.

You can also have an associative array of ordertype => dir, if multiple order types are supported. In this case getIndexField() must return an array, and the keys of that must exactly match the keys of this.

For backward compatibility, this method's return value will be ignored if $this->mDefaultDirection is already set when the constructor is called, for instance if it's statically initialized. In that case the value of that variable (which must be a boolean) will be used.

Note that despite its name, this does not return the value of the $this->mDefaultDirection member variable. That's the default for this particular instantiation, which is a single value. This is the set of all defaults for the class.

@stable to override

Returns
bool

Definition at line 950 of file IndexPager.php.

References DIR_ASCENDING.

Referenced by __construct().

◆ getDefaultQuery()

IndexPager::getDefaultQuery ( )

Get an array of query parameters that should be put into self-links.

By default, all parameters passed in the URL are used, except for a short blacklist.

@stable to override

Returns
array Associative array

Reimplemented in HistoryPager, ImageListPager, UsersPager, ContribsPager, LogPager, DeletedContribsPager, and CategoryPager.

Definition at line 712 of file IndexPager.php.

References $mDefaultQuery, and ContextSource\getRequest().

Referenced by makeLink().

◆ getEmptyBody()

IndexPager::getEmptyBody ( )
protected

Hook into getBody(), for the bit between the start and the end when there are no rows.

@stable to override

Returns
string

Reimplemented in TablePager, and HistoryPager.

Definition at line 699 of file IndexPager.php.

Referenced by getBody().

◆ getEndBody()

IndexPager::getEndBody ( )
protected

Hook into getBody() for the end of the list.

@stable to override

Returns
string

Reimplemented in ContribsPager, HistoryPager, AllMessagesTablePager, NewPagesPager, DeletedContribsPager, TablePager, and NewFilesPager.

Definition at line 687 of file IndexPager.php.

Referenced by getBody().

◆ getExtraSortFields()

IndexPager::getExtraSortFields ( )
protected

Returns the names of secondary columns to order by in addition to the column in getIndexField().

These fields will not be used in the pager offset or in any links for users.

If getIndexField() returns an array of 'querykey' => 'indexfield' pairs then this must return a corresponding array of 'querykey' => [ fields... ] pairs in order for a request with &order=querykey to use [ fields... ] to sort.

If getIndexField() returns a string with the field to sort by, this must either: 1 - return an associative array like above, but only the elements for the current field will be used. 2 - return a non-associative array, for secondary keys to use always.

This is useful for pagers that GROUP BY a unique column (say page_id) and ORDER BY another (say page_len). Using GROUP BY and ORDER BY both on page_len,page_id avoids temp tables (given a page_len index). This would also work if page_id was non-unique but we had a page_len,page_id index.

@stable to override

Returns
string[]|array[]

Reimplemented in ContribsPager.

Definition at line 925 of file IndexPager.php.

Referenced by __construct().

◆ getIndexField()

IndexPager::getIndexField ( )
abstract

Returns the name of the index field.

If the pager supports multiple orders, it may return an array of 'querykey' => 'indexfield' pairs, so that a request with &order=querykey will use indexfield to sort. In this case, the first returned key is the default.

Needless to say, it's really not a good idea to use a non-unique index for this! That won't page right.

The pager may paginate on multiple fields in combination. If paginating on multiple fields, they should be unique in combination (e.g. when paginating on user and timestamp, rows may have the same user, rows may have the same timestamp, but rows should all have a different combination of user and timestamp).

Examples:

  • Always paginate on the user field: 'user'
  • Paginate on either the user or the timestamp field (default to user): [ 'name' => 'user', 'time' => 'timestamp', ]
  • Always paginate on the combination of user and timestamp: [ [ 'user', 'timestamp' ] ]
  • Paginate on the user then timestamp, or the timestamp then user: [ 'nametime' => [ 'user', 'timestamp' ], 'timename' => [ 'timestamp', 'user' ], ]
Returns
string|string[]|array[]

Reimplemented in BlockListPager, ContribsPager, ImageListPager, LogPager, ProtectedPagesPager, TablePager, NewPagesPager, DeletedContribsPager, NewFilesPager, HistoryPager, UsersPager, ProtectedTitlesPager, MergeHistoryPager, ImageHistoryPseudoPager, ActiveUsersPager, and CategoryPager.

Referenced by __construct(), and AlphabeticPager\getNavigationBar().

◆ getLimit()

IndexPager::getLimit ( )

Get the current limit.

Returns
int

Definition at line 341 of file IndexPager.php.

References $mLimit.

◆ getLimitLinks()

IndexPager::getLimitLinks ( )
protected

◆ getLinkRenderer()

◆ getNumRows()

IndexPager::getNumRows ( )

◆ getPagingLinks()

IndexPager::getPagingLinks (   $linkTexts,
  $disabledTexts = [] 
)
protected

Get paging links.

If a link is disabled, the item from $disabledTexts will be used. If there is no such item, the unlinked text from $linkTexts will be used. Both $linkTexts and $disabledTexts are arrays of HTML.

Parameters
array$linkTexts
array$disabledTexts
Returns
array

Definition at line 804 of file IndexPager.php.

References $type, getPagingQueries(), and makeLink().

Referenced by AlphabeticPager\getNavigationBar(), and ReverseChronologicalPager\getNavigationBar().

◆ getPagingQueries()

IndexPager::getPagingQueries ( )

Get a URL query array for the prev, next, first and last links.

@stable to override

Returns
array

Reimplemented in ImageListPager.

Definition at line 745 of file IndexPager.php.

References $mLimit, and doQuery().

Referenced by TablePager\getNavigationBar(), and getPagingLinks().

◆ getQueryInfo()

IndexPager::getQueryInfo ( )
abstract

Provides all parameters needed for the main paged query.

It returns an associative array with the following elements: tables => Table(s) for passing to Database::select() fields => Field(s) for passing to Database::select(), may be * conds => WHERE conditions options => option array join_conds => JOIN conditions

Returns
array

Reimplemented in BlockListPager, AllMessagesTablePager, LogPager, ContribsPager, ProtectedPagesPager, ImageListPager, UsersPager, ProtectedTitlesPager, HistoryPager, MergeHistoryPager, ImageHistoryPseudoPager, DeletedContribsPager, NewFilesPager, NewPagesPager, and CategoryPager.

Referenced by buildQueryInfo().

◆ getResult()

IndexPager::getResult ( )
Returns
IResultWrapper The result wrapper.

Definition at line 303 of file IndexPager.php.

References $mResult.

◆ getSqlComment()

IndexPager::getSqlComment ( )
protected

Get some text to go in brackets in the "function name" part of the SQL comment.

Stable to override

Returns
string

Reimplemented in ContribsPager, and HistoryPager.

Definition at line 429 of file IndexPager.php.

Referenced by ActiveUsersPager\buildQueryInfo(), buildQueryInfo(), and ActiveUsersPager\getQueryInfo().

◆ getStartBody()

IndexPager::getStartBody ( )
protected

Hook into getBody(), allows text to be inserted at the start.

This will be called even if there are no rows in the result set.

Returns
string

Reimplemented in ContribsPager, LogPager, AllMessagesTablePager, HistoryPager, NewPagesPager, DeletedContribsPager, NewFilesPager, TablePager, ProtectedTitlesPager, and MergeHistoryPager.

Definition at line 676 of file IndexPager.php.

Referenced by getBody().

◆ isNavigationBarShown()

IndexPager::isNavigationBarShown ( )
protected

Returns whether to show the "navigation bar" @stable to override.

Returns
bool

Definition at line 786 of file IndexPager.php.

References $mIsLast, and doQuery().

Referenced by AlphabeticPager\getNavigationBar(), ReverseChronologicalPager\getNavigationBar(), and TablePager\getNavigationBar().

◆ makeLink()

IndexPager::makeLink (   $text,
array  $query = null,
  $type = null 
)
protected

Make a self-link.

@stable to override

Parameters
string$textText displayed on the link
array | null$queryAssociative array of parameter to be in the query string
string | null$typeLink type used to create additional attributes, like "rel", "class" or "title". Valid values (non-exhaustive list): 'first', 'last', 'prev', 'next', 'asc', 'desc'.
Returns
string HTML fragment

Definition at line 632 of file IndexPager.php.

References $type, getDefaultQuery(), getLinkRenderer(), ContextSource\getTitle(), and ContextSource\msg().

Referenced by getLimitLinks(), AlphabeticPager\getNavigationBar(), getPagingLinks(), and TablePager\getStartBody().

◆ oppositeOrder()

static IndexPager::oppositeOrder (   $order)
staticfinalprotected
Parameters
bool$orderOne of the IndexPager::QUERY_* class constants
Returns
bool The opposite query order as an IndexPager::QUERY_ constant

Definition at line 294 of file IndexPager.php.

References QUERY_ASCENDING, and QUERY_DESCENDING.

Referenced by doQuery().

◆ preprocessResults()

IndexPager::preprocessResults (   $result)
protected

Pre-process results; useful for performing batch existence checks, etc.

Stable to override

Parameters
IResultWrapper$result

Reimplemented in BlockListPager, and ProtectedPagesPager.

Definition at line 575 of file IndexPager.php.

Referenced by doQuery().

◆ reallyDoQuery()

IndexPager::reallyDoQuery (   $offset,
  $limit,
  $order 
)

Do a query with specified parameters, rather than using the object context.

Note
For b/c, query direction is true for ascending and false for descending

Stable to override

Parameters
string$offsetIndex offset, inclusive
int$limitExact query limit
bool$orderIndexPager::QUERY_ASCENDING or IndexPager::QUERY_DESCENDING
Returns
IResultWrapper

Reimplemented in ImageListPager, ContribsPager, AllMessagesTablePager, and DeletedContribsPager.

Definition at line 445 of file IndexPager.php.

References buildQueryInfo().

Referenced by doQuery().

◆ setIncludeOffset()

IndexPager::setIncludeOffset (   $include)

Set whether a row matching exactly the offset should be also included in the result or not.

By default this is not the case, but when the offset is user-supplied this might be wanted.

Parameters
bool$include

Definition at line 352 of file IndexPager.php.

Referenced by CategoryPager\__construct().

◆ setLimit()

IndexPager::setLimit (   $limit)

Set the limit from an other source than the request.

Verifies limit is between 1 and 5000

Stable to override

Parameters
int | string$limit

Definition at line 325 of file IndexPager.php.

Referenced by NewFilesPager\__construct().

◆ setOffset()

IndexPager::setOffset (   $offset)

Set the offset from an other source than the request.

Parameters
int | string$offset

Definition at line 312 of file IndexPager.php.

Referenced by CategoryPager\__construct().

Member Data Documentation

◆ $linkRenderer

◆ $mDb

IDatabase IndexPager::$mDb

Definition at line 100 of file IndexPager.php.

Referenced by getDatabase(), and LogPager\limitTitle().

◆ $mDefaultDirection

bool IndexPager::$mDefaultDirection

$mDefaultDirection gives the direction to use when sorting results: DIR_ASCENDING or DIR_DESCENDING.

If $mIsBackwards is set, we start from the opposite end, but we still sort the page itself according to $mDefaultDirection. For example, if $mDefaultDirection is DIR_ASCENDING but we're going backwards, we'll display the last page of results, but the last result will be at the bottom, not the top.

Like $mIndexField, $mDefaultDirection will be a single value even if the class supports multiple default directions for different order types.

Definition at line 133 of file IndexPager.php.

Referenced by UsersPager\getPageHeader().

◆ $mDefaultLimit

int IndexPager::$mDefaultLimit = 50

The default entry limit choosen for clients.

Definition at line 92 of file IndexPager.php.

◆ $mDefaultQuery

array IndexPager::$mDefaultQuery
protected

◆ $mExtraSortFields

string [] IndexPager::$mExtraSortFields
protected

An array of secondary columns to order by.

These fields are not part of the offset. This is a column list for one ordering, even if multiple orderings are supported.

Definition at line 116 of file IndexPager.php.

◆ $mFirstShown

array IndexPager::$mFirstShown
protected

Definition at line 145 of file IndexPager.php.

◆ $mIncludeOffset

bool IndexPager::$mIncludeOffset = false
protected

Whether to include the offset in the query.

Definition at line 157 of file IndexPager.php.

Referenced by doQuery().

◆ $mIndexField

string string [] IndexPager::$mIndexField
protected

The index to actually be used for ordering.

This can be a single column, an array of single columns, or an array of arrays of columns. See getIndexField for more details.

Definition at line 110 of file IndexPager.php.

Referenced by ImageListPager\reallyDoQuery().

◆ $mIsBackwards

bool IndexPager::$mIsBackwards

Definition at line 135 of file IndexPager.php.

◆ $mIsFirst

bool IndexPager::$mIsFirst

True if the current result set is the first one.

Definition at line 138 of file IndexPager.php.

◆ $mIsLast

bool IndexPager::$mIsLast

Definition at line 140 of file IndexPager.php.

Referenced by isNavigationBarShown().

◆ $mLastShown

array IndexPager::$mLastShown
protected

Definition at line 143 of file IndexPager.php.

◆ $mLimit

int IndexPager::$mLimit

The maximum number of entries to show.

Definition at line 96 of file IndexPager.php.

Referenced by getLimit(), TablePager\getLimitSelectList(), UsersPager\getPageHeader(), getPagingQueries(), and TablePager\getStartBody().

◆ $mLimitsShown

int [] IndexPager::$mLimitsShown = [ 20, 50, 100, 250, 500 ]

List of default entry limit options to be presented to clients.

Definition at line 90 of file IndexPager.php.

◆ $mNavigationBar

string IndexPager::$mNavigationBar
protected

◆ $mOffset

mixed IndexPager::$mOffset

The starting point to enumerate entries.

Definition at line 94 of file IndexPager.php.

Referenced by ReverseChronologicalPager\getDateCond(), RangeChronologicalPager\getDateCond(), and getLimitLinks().

◆ $mOrderType

string null IndexPager::$mOrderType
protected

For pages that support multiple types of ordering, which one to use.

Definition at line 120 of file IndexPager.php.

Referenced by __construct().

◆ $mPastTheEndIndex

array IndexPager::$mPastTheEndIndex
protected

Definition at line 147 of file IndexPager.php.

◆ $mPastTheEndRow

stdClass bool null IndexPager::$mPastTheEndRow

Extra row fetched at the end to see if the end was reached.

Definition at line 102 of file IndexPager.php.

Referenced by HistoryPager\getEndBody().

◆ $mQueryDone

bool IndexPager::$mQueryDone = false

Whether the listing query completed.

Definition at line 98 of file IndexPager.php.

◆ $mRequest

WebRequest IndexPager::$mRequest

Definition at line 88 of file IndexPager.php.

◆ $mResult

IResultWrapper IndexPager::$mResult

Result object for the query.

Warning: seek before use.

Definition at line 164 of file IndexPager.php.

Referenced by getResult().

◆ DIR_ASCENDING

const IndexPager::DIR_ASCENDING = false

Backwards-compatible constant for $mDefaultDirection field (do not change)

Definition at line 78 of file IndexPager.php.

Referenced by TablePager\__construct(), ImageListPager\__construct(), UsersPager\__construct(), doQuery(), and getDefaultDirections().

◆ DIR_DESCENDING

const IndexPager::DIR_DESCENDING = true

Backwards-compatible constant for $mDefaultDirection field (do not change)

Definition at line 80 of file IndexPager.php.

Referenced by TablePager\__construct(), ImageListPager\__construct(), AllMessagesTablePager\__construct(), UsersPager\__construct(), BlockListPager\__construct(), and TablePager\getStartBody().

◆ QUERY_ASCENDING

const IndexPager::QUERY_ASCENDING = true

Backwards-compatible constant for reallyDoQuery() (do not change)

Definition at line 83 of file IndexPager.php.

Referenced by oppositeOrder(), and AllMessagesTablePager\reallyDoQuery().

◆ QUERY_DESCENDING

const IndexPager::QUERY_DESCENDING = false

Backwards-compatible constant for reallyDoQuery() (do not change)

Definition at line 85 of file IndexPager.php.

Referenced by oppositeOrder().


The documentation for this class was generated from the following file: