X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FPager.php;h=57eb926a0ac45652dba8c37dd3a3ca93d9189fa8;hb=238003d9e1298e3f9e8789a51384ee43236e7193;hp=c9388e0b8ae705105510a6db7e40757cc8d6b419;hpb=00b6d465f1d8a9923e68d98297a4e915c101ff79;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Pager.php b/includes/Pager.php index c9388e0b8a..57eb926a0a 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -95,6 +95,9 @@ abstract class IndexPager extends ContextSource implements Pager { /** True if the current result set is the first one */ public $mIsFirst; + public $mIsLast; + + protected $mLastShown, $mFirstShown, $mPastTheEndIndex, $mDefaultQuery, $mNavigationBar; /** * Result object for the query. Warning: seek before use. @@ -103,7 +106,7 @@ abstract class IndexPager extends ContextSource implements Pager { */ public $mResult; - public function __construct( RequestContext $context = null ) { + public function __construct( IContextSource $context = null ) { if ( $context ) { $this->setContext( $context ); } @@ -190,12 +193,16 @@ abstract class IndexPager extends ContextSource implements Pager { /** * Set the offset from an other source than the request + * + * @param $offset Int|String */ function setOffset( $offset ) { $this->mOffset = $offset; } /** * Set the limit from an other source than the request + * + * @param $limit Int|String */ function setLimit( $limit ) { $this->mLimit = $limit; @@ -318,10 +325,16 @@ abstract class IndexPager extends ContextSource implements Pager { * * @return String */ - function getBody() { + public function getBody() { if ( !$this->mQueryDone ) { $this->doQuery(); } + + if ( $this->mResult->numRows() ) { + # Do any special query batches before display + $this->doBatchLookups(); + } + # Don't use any extra rows returned by the query $numRows = min( $this->mResult->numRows(), $this->mLimit ); @@ -377,13 +390,22 @@ abstract class IndexPager extends ContextSource implements Pager { ); } + /** + * 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. + * + * @return void + */ + protected function doBatchLookups() {} + /** * 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. * * @return String */ - function getStartBody() { + protected function getStartBody() { return ''; } @@ -392,7 +414,7 @@ abstract class IndexPager extends ContextSource implements Pager { * * @return String */ - function getEndBody() { + protected function getEndBody() { return ''; } @@ -402,7 +424,7 @@ abstract class IndexPager extends ContextSource implements Pager { * * @return String */ - function getEmptyBody() { + protected function getEmptyBody() { return ''; } @@ -497,6 +519,8 @@ abstract class IndexPager extends ContextSource implements Pager { * $linkTexts will be used. Both $linkTexts and $disabledTexts are arrays * of HTML. * + * @param $linkTexts Array + * @param $disabledTexts Array * @return Array */ function getPagingLinks( $linkTexts, $disabledTexts = array() ) { @@ -619,9 +643,12 @@ abstract class IndexPager extends ContextSource implements Pager { * @ingroup Pager */ abstract class AlphabeticPager extends IndexPager { + /** * Shamelessly stolen bits from ReverseChronologicalPager, * didn't want to do class magic as may be still revamped + * + * @return String HTML */ function getNavigationBar() { if ( !$this->isNavigationBarShown() ) return ''; @@ -810,7 +837,7 @@ abstract class TablePager extends IndexPager { var $mSort; var $mCurrentRow; - function __construct( RequestContext $context = null ) { + function __construct( IContextSource $context = null ) { if ( $context ) { $this->setContext( $context ); } @@ -884,9 +911,13 @@ abstract class TablePager extends IndexPager { return "