$this->mResult = $this->reallyDoQuery( $this->mOffset, $queryLimit, $descending );
$this->extractResultInfo( $this->mOffset, $queryLimit, $this->mResult );
$this->mQueryDone = true;
+
+ $this->preprocessResults( $this->mResult );
+ $this->mResult->rewind(); // Paranoia
wfProfileOut( $fname );
}
* @param boolean $descending Query direction, false for ascending, true for descending
* @return ResultWrapper
*/
- function reallyDoQuery( $offset, $limit, $ascending ) {
+ function reallyDoQuery( $offset, $limit, $descending ) {
$fname = __METHOD__ . ' (' . get_class( $this ) . ')';
$info = $this->getQueryInfo();
$tables = $info['tables'];
$fields = $info['fields'];
$conds = isset( $info['conds'] ) ? $info['conds'] : array();
$options = isset( $info['options'] ) ? $info['options'] : array();
- if ( $ascending ) {
+ if ( $descending ) {
$options['ORDER BY'] = $this->mIndexField;
$operator = '>';
} else {
return new ResultWrapper( $this->mDb, $res );
}
+ /**
+ * Pre-process results; useful for performing batch existence checks, etc.
+ *
+ * @param ResultWrapper $result Result wrapper
+ */
+ protected function preprocessResults( $result ) {}
+
/**
* Get the formatted result list. Calls getStartBody(), formatRow() and
* getEndBody(), concatenates the results and returns them.
*/
function getNavigationBar() {
global $wgLang;
-
+
$linkTexts = array(
- 'prev' => wfMsgHtml( "prevn", $this->mLimit ),
- 'next' => wfMsgHtml( 'nextn', $this->mLimit ),
- 'first' => wfMsgHtml('page_first'), /* Introduced the message */
+ 'prev' => wfMsgHtml( 'prevn', $wgLang->formatNum( $this->mLimit ) ),
+ 'next' => wfMsgHtml( 'nextn', $wgLang->formatNum($this->mLimit ) ),
+ 'first' => wfMsgHtml( 'page_first' ), /* Introduced the message */
'last' => wfMsgHtml( 'page_last' ) /* Introduced the message */
);
-
+
$pagingLinks = $this->getPagingLinks( $linkTexts );
$limitLinks = $this->getLimitLinks();
$limits = implode( ' | ', $limitLinks );
-
+
$this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " . wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
return $this->mNavigationBar;
-
+
}
}
if ( isset( $this->mNavigationBar ) ) {
return $this->mNavigationBar;
}
+ $nicenumber = $wgLang->formatNum( $this->mLimit );
$linkTexts = array(
- 'prev' => wfMsgHtml( "prevn", $this->mLimit ),
- 'next' => wfMsgHtml( 'nextn', $this->mLimit ),
- 'first' => wfMsgHtml('histlast'),
+ 'prev' => wfMsgExt( 'pager-newer-n', array( 'parsemag' ), $nicenumber ),
+ 'next' => wfMsgExt( 'pager-older-n', array( 'parsemag' ), $nicenumber ),
+ 'first' => wfMsgHtml( 'histlast' ),
'last' => wfMsgHtml( 'histfirst' )
);
$pagingLinks = $this->getPagingLinks( $linkTexts );
$limitLinks = $this->getLimitLinks();
$limits = implode( ' | ', $limitLinks );
-
+
$this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " .
wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
return $this->mNavigationBar;
*/
abstract function getFieldNames();
}
-?>