/** 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.
*/
public $mResult;
- public function __construct( RequestContext $context = null ) {
+ public function __construct( IContextSource $context = null ) {
if ( $context ) {
$this->setContext( $context );
}
/**
* 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;
*
* @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 );
);
}
+ /**
+ * 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 '';
}
*
* @return String
*/
- function getEndBody() {
+ protected function getEndBody() {
return '';
}
*
* @return String
*/
- function getEmptyBody() {
+ protected function getEmptyBody() {
return '';
}
* $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() ) {
* @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 '';
var $mSort;
var $mCurrentRow;
- function __construct( RequestContext $context = null ) {
+ function __construct( IContextSource $context = null ) {
if ( $context ) {
$this->setContext( $context );
}
return "<tr><td colspan=\"$colspan\">$msgEmpty</td></tr>\n";
}
+ /**
+ * @param $row Array
+ * @return String HTML
+ */
function formatRow( $row ) {
$this->mCurrentRow = $row; # In case formatValue etc need to know
- $s = Xml::openElement( 'tr', $this->getRowAttrs($row) );
+ $s = Xml::openElement( 'tr', $this->getRowAttrs( $row ) );
$fieldNames = $this->getFieldNames();
foreach ( $fieldNames as $field => $name ) {
$value = isset( $row->$field ) ? $row->$field : null;
* Get attributes to be applied to the given row.
*
* @param $row Object: the database result row
- * @return Associative array
+ * @return Array of <attr> => <value>
*/
function getRowAttrs( $row ) {
$class = $this->getRowClass( $row );
* take this as an excuse to hardcode styles; use classes and
* CSS instead. Row context is available in $this->mCurrentRow
*
- * @param $field The column
- * @param $value The cell contents
- * @return Associative array
+ * @param $field String The column
+ * @param $value String The cell contents
+ * @return Array of attr => value
*/
function getCellAttrs( $field, $value ) {
return array( 'class' => 'TablePager_col_' . $field );
/**
* A navigation bar with images
+ * @return String HTML
*/
function getNavigationBar() {
global $wgStylePath;
* Resubmits all defined elements of the query string, except for a
* blacklist, passed in the $blacklist parameter.
*
+ * @param $blacklist Array parameters from the request query which should not be resubmitted
* @return String: HTML fragment
*/
function getHiddenFields( $blacklist = array() ) {
* An array mapping database field names to a textual description of the
* field name, for use in the table header. The description should be plain
* text, it will be HTML-escaped later.
+ *
+ * @return Array
*/
abstract function getFieldNames();
}