4 * Basic pager interface.
8 function getNavigationBar();
13 * IndexPager is an efficient pager which uses a (roughly unique) index in the
14 * data set to implement paging, rather than a "LIMIT offset,limit" clause.
15 * In MySQL, such a limit/offset clause requires counting through the
16 * specified number of offset rows to find the desired data, which can be
17 * expensive for large offsets.
19 * ReverseChronologicalPager is a child class of the abstract IndexPager, and
20 * contains some formatting and display code which is specific to the use of
21 * timestamps as indexes. Here is a synopsis of its operation:
23 * * The query is specified by the offset, limit and direction (dir)
24 * parameters, in addition to any subclass-specific parameters.
25 * * The offset is the non-inclusive start of the DB query. A row with an
26 * index value equal to the offset will never be shown.
27 * * The query may either be done backwards, where the rows are returned by
28 * the database in the opposite order to which they are displayed to the
29 * user, or forwards. This is specified by the "dir" parameter, dir=prev
30 * means backwards, anything else means forwards. The offset value
31 * specifies the start of the database result set, which may be either
32 * the start or end of the displayed data set. This allows "previous"
33 * links to be implemented without knowledge of the index value at the
34 * start of the previous page.
35 * * An additional row beyond the user-specified limit is always requested.
36 * This allows us to tell whether we should display a "next" link in the
37 * case of forwards mode, or a "previous" link in the case of backwards
38 * mode. Determining whether to display the other link (the one for the
39 * page before the start of the database result set) can be done
40 * heuristically by examining the offset.
42 * * An empty offset indicates that the offset condition should be omitted
43 * from the query. This naturally produces either the first page or the
44 * last page depending on the dir parameter.
46 * Subclassing the pager to implement concrete functionality should be fairly
47 * simple, please see the examples in PageHistory.php and
48 * SpecialIpblocklist.php. You just need to override formatRow(),
49 * getQueryInfo() and getIndexField(). Don't forget to call the parent
50 * constructor if you override it.
54 abstract class IndexPager
implements Pager
{
56 public $mLimitsShown = array( 20, 50, 100, 250, 500 );
57 public $mDefaultLimit = 50;
58 public $mOffset, $mLimit;
59 public $mQueryDone = false;
61 public $mPastTheEndRow;
64 * The index to actually be used for ordering. This is a single string e-
65 * ven if multiple orderings are supported.
67 protected $mIndexField;
68 /** For pages that support multiple types of ordering, which one to use. */
69 protected $mOrderType;
71 * $mDefaultDirection gives the direction to use when sorting results:
72 * false for ascending, true for descending. If $mIsBackwards is set, we
73 * start from the opposite end, but we still sort the page itself according
74 * to $mDefaultDirection. E.g., if $mDefaultDirection is false but we're
75 * going backwards, we'll display the last page of results, but the last
76 * result will be at the bottom, not the top.
78 * Like $mIndexField, $mDefaultDirection will be a single value even if the
79 * class supports multiple default directions for different order types.
81 public $mDefaultDirection;
85 * Result object for the query. Warning: seek before use.
89 public function __construct() {
90 global $wgRequest, $wgUser;
91 $this->mRequest
= $wgRequest;
93 # NB: the offset is quoted, not validated. It is treated as an
94 # arbitrary string to support the widest variety of index types. Be
95 # careful outputting it into HTML!
96 $this->mOffset
= $this->mRequest
->getText( 'offset' );
98 # Use consistent behavior for the limit options
99 $this->mDefaultLimit
= intval( $wgUser->getOption( 'rclimit' ) );
100 list( $this->mLimit
, /* $offset */ ) = $this->mRequest
->getLimitOffset();
102 $this->mIsBackwards
= ( $this->mRequest
->getVal( 'dir' ) == 'prev' );
103 $this->mDb
= wfGetDB( DB_SLAVE
);
105 $index = $this->getIndexField();
106 $order = $this->mRequest
->getVal( 'order' );
107 if( is_array( $index ) && isset( $index[$order] ) ) {
108 $this->mOrderType
= $order;
109 $this->mIndexField
= $index[$order];
110 } elseif( is_array( $index ) ) {
111 # First element is the default
113 list( $this->mOrderType
, $this->mIndexField
) = each( $index );
115 # $index is not an array
116 $this->mOrderType
= null;
117 $this->mIndexField
= $index;
120 if( !isset( $this->mDefaultDirection
) ) {
121 $dir = $this->getDefaultDirections();
122 $this->mDefaultDirection
= is_array( $dir )
123 ?
$dir[$this->mOrderType
]
129 * Do the query, using information from the object context. This function
130 * has been kept minimal to make it overridable if necessary, to allow for
131 * result sets formed from multiple DB queries.
134 # Use the child class name for profiling
135 $fname = __METHOD__
. ' (' . get_class( $this ) . ')';
136 wfProfileIn( $fname );
138 $descending = ( $this->mIsBackwards
== $this->mDefaultDirection
);
139 # Plus an extra row so that we can tell the "next" link should be shown
140 $queryLimit = $this->mLimit +
1;
142 $this->mResult
= $this->reallyDoQuery( $this->mOffset
, $queryLimit, $descending );
143 $this->extractResultInfo( $this->mOffset
, $queryLimit, $this->mResult
);
144 $this->mQueryDone
= true;
146 $this->preprocessResults( $this->mResult
);
147 $this->mResult
->rewind(); // Paranoia
149 wfProfileOut( $fname );
153 * Extract some useful data from the result object for use by
154 * the navigation bar, put it into $this
156 function extractResultInfo( $offset, $limit, ResultWrapper
$res ) {
157 $numRows = $res->numRows();
159 $row = $res->fetchRow();
160 $firstIndex = $row[$this->mIndexField
];
162 # Discard the extra result row if there is one
163 if ( $numRows > $this->mLimit
&& $numRows > 1 ) {
164 $res->seek( $numRows - 1 );
165 $this->mPastTheEndRow
= $res->fetchObject();
166 $indexField = $this->mIndexField
;
167 $this->mPastTheEndIndex
= $this->mPastTheEndRow
->$indexField;
168 $res->seek( $numRows - 2 );
169 $row = $res->fetchRow();
170 $lastIndex = $row[$this->mIndexField
];
172 $this->mPastTheEndRow
= null;
173 # Setting indexes to an empty string means that they will be
174 # omitted if they would otherwise appear in URLs. It just so
175 # happens that this is the right thing to do in the standard
176 # UI, in all the relevant cases.
177 $this->mPastTheEndIndex
= '';
178 $res->seek( $numRows - 1 );
179 $row = $res->fetchRow();
180 $lastIndex = $row[$this->mIndexField
];
185 $this->mPastTheEndRow
= null;
186 $this->mPastTheEndIndex
= '';
189 if ( $this->mIsBackwards
) {
190 $this->mIsFirst
= ( $numRows < $limit );
191 $this->mIsLast
= ( $offset == '' );
192 $this->mLastShown
= $firstIndex;
193 $this->mFirstShown
= $lastIndex;
195 $this->mIsFirst
= ( $offset == '' );
196 $this->mIsLast
= ( $numRows < $limit );
197 $this->mLastShown
= $lastIndex;
198 $this->mFirstShown
= $firstIndex;
203 * Do a query with specified parameters, rather than using the object
206 * @param string $offset Index offset, inclusive
207 * @param integer $limit Exact query limit
208 * @param boolean $descending Query direction, false for ascending, true for descending
209 * @return ResultWrapper
211 function reallyDoQuery( $offset, $limit, $descending ) {
212 $fname = __METHOD__
. ' (' . get_class( $this ) . ')';
213 $info = $this->getQueryInfo();
214 $tables = $info['tables'];
215 $fields = $info['fields'];
216 $conds = isset( $info['conds'] ) ?
$info['conds'] : array();
217 $options = isset( $info['options'] ) ?
$info['options'] : array();
219 $options['ORDER BY'] = $this->mIndexField
;
222 $options['ORDER BY'] = $this->mIndexField
. ' DESC';
225 if ( $offset != '' ) {
226 $conds[] = $this->mIndexField
. $operator . $this->mDb
->addQuotes( $offset );
228 $options['LIMIT'] = intval( $limit );
229 $res = $this->mDb
->select( $tables, $fields, $conds, $fname, $options );
230 return new ResultWrapper( $this->mDb
, $res );
234 * Pre-process results; useful for performing batch existence checks, etc.
236 * @param ResultWrapper $result Result wrapper
238 protected function preprocessResults( $result ) {}
241 * Get the formatted result list. Calls getStartBody(), formatRow() and
242 * getEndBody(), concatenates the results and returns them.
245 if ( !$this->mQueryDone
) {
248 # Don't use any extra rows returned by the query
249 $numRows = min( $this->mResult
->numRows(), $this->mLimit
);
251 $s = $this->getStartBody();
253 if ( $this->mIsBackwards
) {
254 for ( $i = $numRows - 1; $i >= 0; $i-- ) {
255 $this->mResult
->seek( $i );
256 $row = $this->mResult
->fetchObject();
257 $s .= $this->formatRow( $row );
260 $this->mResult
->seek( 0 );
261 for ( $i = 0; $i < $numRows; $i++
) {
262 $row = $this->mResult
->fetchObject();
263 $s .= $this->formatRow( $row );
267 $s .= $this->getEmptyBody();
269 $s .= $this->getEndBody();
276 function makeLink($text, $query = null, $type=null) {
277 if ( $query === null ) {
280 if( $type == 'prev' ||
$type == 'next' ) {
281 $attrs = "rel=\"$type\"";
282 } elseif( $type == 'first' ) {
283 $attrs = "rel=\"start\"";
285 # HTML 4 has no rel="end" . . .
288 return $this->getSkin()->makeKnownLinkObj( $this->getTitle(), $text,
289 wfArrayToCGI( $query, $this->getDefaultQuery() ), '', '',
294 * Hook into getBody(), allows text to be inserted at the start. This
295 * will be called even if there are no rows in the result set.
297 function getStartBody() {
302 * Hook into getBody() for the end of the list
304 function getEndBody() {
309 * Hook into getBody(), for the bit between the start and the
310 * end when there are no rows
312 function getEmptyBody() {
317 * Title used for self-links. Override this if you want to be able to
318 * use a title other than $wgTitle
320 function getTitle() {
321 return $GLOBALS['wgTitle'];
325 * Get the current skin. This can be overridden if necessary.
328 if ( !isset( $this->mSkin
) ) {
330 $this->mSkin
= $wgUser->getSkin();
336 * Get an array of query parameters that should be put into self-links.
337 * By default, all parameters passed in the URL are used, except for a
340 function getDefaultQuery() {
341 if ( !isset( $this->mDefaultQuery
) ) {
342 $this->mDefaultQuery
= $_GET;
343 unset( $this->mDefaultQuery
['title'] );
344 unset( $this->mDefaultQuery
['dir'] );
345 unset( $this->mDefaultQuery
['offset'] );
346 unset( $this->mDefaultQuery
['limit'] );
347 unset( $this->mDefaultQuery
['order'] );
349 return $this->mDefaultQuery
;
353 * Get the number of rows in the result set
355 function getNumRows() {
356 if ( !$this->mQueryDone
) {
359 return $this->mResult
->numRows();
363 * Get a URL query array for the prev, next, first and last links.
365 function getPagingQueries() {
366 if ( !$this->mQueryDone
) {
370 # Don't announce the limit everywhere if it's the default
371 $urlLimit = $this->mLimit
== $this->mDefaultLimit ?
'' : $this->mLimit
;
373 if ( $this->mIsFirst
) {
377 $prev = array( 'dir' => 'prev', 'offset' => $this->mFirstShown
, 'limit' => $urlLimit );
378 $first = array( 'limit' => $urlLimit );
380 if ( $this->mIsLast
) {
384 $next = array( 'offset' => $this->mLastShown
, 'limit' => $urlLimit );
385 $last = array( 'dir' => 'prev', 'limit' => $urlLimit );
387 return array( 'prev' => $prev, 'next' => $next, 'first' => $first, 'last' => $last );
391 * Get paging links. If a link is disabled, the item from $disabledTexts
392 * will be used. If there is no such item, the unlinked text from
393 * $linkTexts will be used. Both $linkTexts and $disabledTexts are arrays
396 function getPagingLinks( $linkTexts, $disabledTexts = array() ) {
397 $queries = $this->getPagingQueries();
399 foreach ( $queries as $type => $query ) {
400 if ( $query !== false ) {
401 $links[$type] = $this->makeLink( $linkTexts[$type], $queries[$type], $type );
402 } elseif ( isset( $disabledTexts[$type] ) ) {
403 $links[$type] = $disabledTexts[$type];
405 $links[$type] = $linkTexts[$type];
411 function getLimitLinks() {
414 if ( $this->mIsBackwards
) {
415 $offset = $this->mPastTheEndIndex
;
417 $offset = $this->mOffset
;
419 foreach ( $this->mLimitsShown
as $limit ) {
420 $links[] = $this->makeLink( $wgLang->formatNum( $limit ),
421 array( 'offset' => $offset, 'limit' => $limit ) );
427 * Abstract formatting function. This should return an HTML string
428 * representing the result row $row. Rows will be concatenated and
429 * returned by getBody()
431 abstract function formatRow( $row );
434 * This function should be overridden to provide all parameters
435 * needed for the main paged query. It returns an associative
436 * array with the following elements:
437 * tables => Table(s) for passing to Database::select()
438 * fields => Field(s) for passing to Database::select(), may be *
439 * conds => WHERE conditions
440 * options => option array
442 abstract function getQueryInfo();
445 * This function should be overridden to return the name of the index fi-
446 * eld. If the pager supports multiple orders, it may return an array of
447 * 'querykey' => 'indexfield' pairs, so that a request with &count=querykey
448 * will use indexfield to sort. In this case, the first returned key is
451 * Needless to say, it's really not a good idea to use a non-unique index
452 * for this! That won't page right.
454 abstract function getIndexField();
457 * Return the default sorting direction: false for ascending, true for de-
458 * scending. You can also have an associative array of ordertype => dir,
459 * if multiple order types are supported. In this case getIndexField()
460 * must return an array, and the keys of that must exactly match the keys
463 * For backward compatibility, this method's return value will be ignored
464 * if $this->mDefaultDirection is already set when the constructor is
465 * called, for instance if it's statically initialized. In that case the
466 * value of that variable (which must be a boolean) will be used.
468 * Note that despite its name, this does not return the value of the
469 * $this->mDefaultDirection member variable. That's the default for this
470 * particular instantiation, which is a single value. This is the set of
471 * all defaults for the class.
473 protected function getDefaultDirections() { return false; }
478 * IndexPager with an alphabetic list and a formatted navigation bar
481 abstract class AlphabeticPager
extends IndexPager
{
482 function __construct() {
483 parent
::__construct();
487 * Shamelessly stolen bits from ReverseChronologicalPager,
488 * didn't want to do class magic as may be still revamped
490 function getNavigationBar() {
493 if( isset( $this->mNavigationBar
) ) {
494 return $this->mNavigationBar
;
498 'prev' => wfMsgHtml( 'prevn', $wgLang->formatNum( $this->mLimit
) ),
499 'next' => wfMsgHtml( 'nextn', $wgLang->formatNum($this->mLimit
) ),
500 'first' => wfMsgHtml( 'page_first' ),
501 'last' => wfMsgHtml( 'page_last' )
504 $pagingLinks = $this->getPagingLinks( $linkTexts );
505 $limitLinks = $this->getLimitLinks();
506 $limits = implode( ' | ', $limitLinks );
508 $this->mNavigationBar
=
509 "({$pagingLinks['first']} | {$pagingLinks['last']}) " .
510 wfMsgHtml( 'viewprevnext', $pagingLinks['prev'],
511 $pagingLinks['next'], $limits );
513 if( !is_array( $this->getIndexField() ) ) {
514 # Early return to avoid undue nesting
515 return $this->mNavigationBar
;
520 $msgs = $this->getOrderTypeMessages();
521 foreach( array_keys( $msgs ) as $order ) {
528 if( $order == $this->mOrderType
) {
529 $extra .= wfMsgHTML( $msgs[$order] );
531 $extra .= $this->makeLink(
532 wfMsgHTML( $msgs[$order] ),
533 array( 'order' => $order )
538 if( $extra !== '' ) {
539 $this->mNavigationBar
.= " ($extra)";
542 return $this->mNavigationBar
;
546 * If this supports multiple order type messages, give the message key for
547 * enabling each one in getNavigationBar. The return type is an associa-
548 * tive array whose keys must exactly match the keys of the array returned
549 * by getIndexField(), and whose values are message keys.
552 protected function getOrderTypeMessages() {
558 * IndexPager with a formatted navigation bar
561 abstract class ReverseChronologicalPager
extends IndexPager
{
562 public $mDefaultDirection = true;
564 function __construct() {
565 parent
::__construct();
568 function getNavigationBar() {
571 if ( isset( $this->mNavigationBar
) ) {
572 return $this->mNavigationBar
;
574 $nicenumber = $wgLang->formatNum( $this->mLimit
);
576 'prev' => wfMsgExt( 'pager-newer-n', array( 'parsemag' ), $nicenumber ),
577 'next' => wfMsgExt( 'pager-older-n', array( 'parsemag' ), $nicenumber ),
578 'first' => wfMsgHtml( 'histlast' ),
579 'last' => wfMsgHtml( 'histfirst' )
582 $pagingLinks = $this->getPagingLinks( $linkTexts );
583 $limitLinks = $this->getLimitLinks();
584 $limits = implode( ' | ', $limitLinks );
586 $this->mNavigationBar
= "({$pagingLinks['first']} | {$pagingLinks['last']}) " .
587 wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
588 return $this->mNavigationBar
;
593 * Table-based display with a user-selectable sort order
596 abstract class TablePager
extends IndexPager
{
600 function __construct() {
602 $this->mSort
= $wgRequest->getText( 'sort' );
603 if ( !array_key_exists( $this->mSort
, $this->getFieldNames() ) ) {
604 $this->mSort
= $this->getDefaultSort();
606 if ( $wgRequest->getBool( 'asc' ) ) {
607 $this->mDefaultDirection
= false;
608 } elseif ( $wgRequest->getBool( 'desc' ) ) {
609 $this->mDefaultDirection
= true;
610 } /* Else leave it at whatever the class default is */
612 parent
::__construct();
615 function getStartBody() {
617 $tableClass = htmlspecialchars( $this->getTableClass() );
618 $sortClass = htmlspecialchars( $this->getSortHeaderClass() );
620 $s = "<table border='1' class=\"$tableClass\"><thead><tr>\n";
621 $fields = $this->getFieldNames();
624 foreach ( $fields as $field => $name ) {
625 if ( strval( $name ) == '' ) {
626 $s .= "<th> </th>\n";
627 } elseif ( $this->isFieldSortable( $field ) ) {
628 $query = array( 'sort' => $field, 'limit' => $this->mLimit
);
629 if ( $field == $this->mSort
) {
630 # This is the sorted column
631 # Prepare a link that goes in the other sort order
632 if ( $this->mDefaultDirection
) {
634 $image = 'Arr_u.png';
637 $alt = htmlspecialchars( wfMsg( 'descending_abbrev' ) );
640 $image = 'Arr_d.png';
642 $query['desc'] = '1';
643 $alt = htmlspecialchars( wfMsg( 'ascending_abbrev' ) );
645 $image = htmlspecialchars( "$wgStylePath/common/images/$image" );
646 $link = $this->makeLink(
647 "<img width=\"12\" height=\"12\" alt=\"$alt\" src=\"$image\" />" .
648 htmlspecialchars( $name ), $query );
649 $s .= "<th class=\"$sortClass\">$link</th>\n";
651 $s .= '<th>' . $this->makeLink( htmlspecialchars( $name ), $query ) . "</th>\n";
654 $s .= '<th>' . htmlspecialchars( $name ) . "</th>\n";
657 $s .= "</tr></thead><tbody>\n";
661 function getEndBody() {
662 return "</tbody></table>\n";
665 function getEmptyBody() {
666 $colspan = count( $this->getFieldNames() );
667 $msgEmpty = wfMsgHtml( 'table_pager_empty' );
668 return "<tr><td colspan=\"$colspan\">$msgEmpty</td></tr>\n";
671 function formatRow( $row ) {
673 $fieldNames = $this->getFieldNames();
674 $this->mCurrentRow
= $row; # In case formatValue needs to know
675 foreach ( $fieldNames as $field => $name ) {
676 $value = isset( $row->$field ) ?
$row->$field : null;
677 $formatted = strval( $this->formatValue( $field, $value ) );
678 if ( $formatted == '' ) {
679 $formatted = ' ';
681 $class = 'TablePager_col_' . htmlspecialchars( $field );
682 $s .= "<td class=\"$class\">$formatted</td>\n";
688 function getIndexField() {
692 function getTableClass() {
696 function getNavClass() {
697 return 'TablePager_nav';
700 function getSortHeaderClass() {
701 return 'TablePager_sort';
705 * A navigation bar with images
707 function getNavigationBar() {
708 global $wgStylePath, $wgContLang;
709 $path = "$wgStylePath/common/images";
711 'first' => 'table_pager_first',
712 'prev' => 'table_pager_prev',
713 'next' => 'table_pager_next',
714 'last' => 'table_pager_last',
717 'first' => $wgContLang->isRTL() ?
'arrow_last_25.png' : 'arrow_first_25.png',
718 'prev' => $wgContLang->isRTL() ?
'arrow_right_25.png' : 'arrow_left_25.png',
719 'next' => $wgContLang->isRTL() ?
'arrow_left_25.png' : 'arrow_right_25.png',
720 'last' => $wgContLang->isRTL() ?
'arrow_first_25.png' : 'arrow_last_25.png',
722 $disabledImages = array(
723 'first' => $wgContLang->isRTL() ?
'arrow_disabled_last_25.png' : 'arrow_disabled_first_25.png',
724 'prev' => $wgContLang->isRTL() ?
'arrow_disabled_right_25.png' : 'arrow_disabled_left_25.png',
725 'next' => $wgContLang->isRTL() ?
'arrow_disabled_left_25.png' : 'arrow_disabled_right_25.png',
726 'last' => $wgContLang->isRTL() ?
'arrow_disabled_first_25.png' : 'arrow_disabled_last_25.png',
729 $linkTexts = array();
730 $disabledTexts = array();
731 foreach ( $labels as $type => $label ) {
732 $msgLabel = wfMsgHtml( $label );
733 $linkTexts[$type] = "<img src=\"$path/{$images[$type]}\" alt=\"$msgLabel\"/><br/>$msgLabel";
734 $disabledTexts[$type] = "<img src=\"$path/{$disabledImages[$type]}\" alt=\"$msgLabel\"/><br/>$msgLabel";
736 $links = $this->getPagingLinks( $linkTexts, $disabledTexts );
738 $navClass = htmlspecialchars( $this->getNavClass() );
739 $s = "<table class=\"$navClass\" align=\"center\" cellpadding=\"3\"><tr>\n";
740 $cellAttrs = 'valign="top" align="center" width="' . 100 / count( $links ) . '%"';
741 foreach ( $labels as $type => $label ) {
742 $s .= "<td $cellAttrs>{$links[$type]}</td>\n";
744 $s .= "</tr></table>\n";
749 * Get a <select> element which has options for each of the allowed limits
751 function getLimitSelect() {
753 $s = "<select name=\"limit\">";
754 foreach ( $this->mLimitsShown
as $limit ) {
755 $selected = $limit == $this->mLimit ?
'selected="selected"' : '';
756 $formattedLimit = $wgLang->formatNum( $limit );
757 $s .= "<option value=\"$limit\" $selected>$formattedLimit</option>\n";
764 * Get <input type="hidden"> elements for use in a method="get" form.
765 * Resubmits all defined elements of the $_GET array, except for a
766 * blacklist, passed in the $blacklist parameter.
768 function getHiddenFields( $blacklist = array() ) {
769 $blacklist = (array)$blacklist;
771 foreach ( $blacklist as $name ) {
772 unset( $query[$name] );
775 foreach ( $query as $name => $value ) {
776 $encName = htmlspecialchars( $name );
777 $encValue = htmlspecialchars( $value );
778 $s .= "<input type=\"hidden\" name=\"$encName\" value=\"$encValue\"/>\n";
784 * Get a form containing a limit selection dropdown
786 function getLimitForm() {
787 # Make the select with some explanatory text
788 $url = $this->getTitle()->escapeLocalURL();
789 $msgSubmit = wfMsgHtml( 'table_pager_limit_submit' );
791 "<form method=\"get\" action=\"$url\">" .
792 wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) .
793 "\n<input type=\"submit\" value=\"$msgSubmit\"/>\n" .
794 $this->getHiddenFields( 'limit' ) .
799 * Return true if the named field should be sortable by the UI, false
802 * @param string $field
804 abstract function isFieldSortable( $field );
807 * Format a table cell. The return value should be HTML, but use an empty
808 * string not for empty cells. Do not include the <td> and </td>.
810 * The current result row is available as $this->mCurrentRow, in case you
813 * @param string $name The database field name
814 * @param string $value The value retrieved from the database
816 abstract function formatValue( $name, $value );
819 * The database field name used as a default sort order
821 abstract function getDefaultSort();
824 * An array mapping database field names to a textual description of the
825 * field name, for use in the table header. The description should be plain
826 * text, it will be HTML-escaped later.
828 abstract function getFieldNames();