clarify comment
[lhc/web/wiklou.git] / includes / Pager.php
1 <?php
2
3 /**
4 * Basic pager interface.
5 * @addtogroup Pager
6 */
7 interface Pager {
8 function getNavigationBar();
9 function getBody();
10 }
11
12 /**
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.
18 *
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:
22 *
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.
41 *
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.
45 *
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.
51 *
52 * @addtogroup Pager
53 */
54 abstract class IndexPager implements Pager {
55 public $mRequest;
56 public $mLimitsShown = array( 20, 50, 100, 250, 500 );
57 public $mDefaultLimit = 50;
58 public $mOffset, $mLimit;
59 public $mQueryDone = false;
60 public $mDb;
61 public $mPastTheEndRow;
62
63 protected $mIndexField;
64
65 /**
66 * Default query direction. false for ascending, true for descending
67 */
68 public $mDefaultDirection = false;
69
70 /**
71 * Result object for the query. Warning: seek before use.
72 */
73 public $mResult;
74
75 function __construct() {
76 global $wgRequest, $wgUser;
77 $this->mRequest = $wgRequest;
78
79 # NB: the offset is quoted, not validated. It is treated as an
80 # arbitrary string to support the widest variety of index types. Be
81 # careful outputting it into HTML!
82 $this->mOffset = $this->mRequest->getText( 'offset' );
83
84 # Use consistent behavior for the limit options
85 $this->mDefaultLimit = intval( $wgUser->getOption( 'rclimit' ) );
86 list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset();
87
88 $this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' );
89 $this->mIndexField = $this->getIndexField();
90 $this->mDb = wfGetDB( DB_SLAVE );
91 }
92
93 /**
94 * Do the query, using information from the object context. This function
95 * has been kept minimal to make it overridable if necessary, to allow for
96 * result sets formed from multiple DB queries.
97 */
98 function doQuery() {
99 # Use the child class name for profiling
100 $fname = __METHOD__ . ' (' . get_class( $this ) . ')';
101 wfProfileIn( $fname );
102
103 $descending = ( $this->mIsBackwards == $this->mDefaultDirection );
104 # Plus an extra row so that we can tell the "next" link should be shown
105 $queryLimit = $this->mLimit + 1;
106
107 $this->mResult = $this->reallyDoQuery( $this->mOffset, $queryLimit, $descending );
108 $this->extractResultInfo( $this->mOffset, $queryLimit, $this->mResult );
109 $this->mQueryDone = true;
110
111 wfProfileOut( $fname );
112 }
113
114 /**
115 * Extract some useful data from the result object for use by
116 * the navigation bar, put it into $this
117 */
118 function extractResultInfo( $offset, $limit, ResultWrapper $res ) {
119 $numRows = $res->numRows();
120 if ( $numRows ) {
121 $row = $res->fetchRow();
122 $firstIndex = $row[$this->mIndexField];
123
124 # Discard the extra result row if there is one
125 if ( $numRows > $this->mLimit && $numRows > 1 ) {
126 $res->seek( $numRows - 1 );
127 $this->mPastTheEndRow = $res->fetchObject();
128 $indexField = $this->mIndexField;
129 $this->mPastTheEndIndex = $this->mPastTheEndRow->$indexField;
130 $res->seek( $numRows - 2 );
131 $row = $res->fetchRow();
132 $lastIndex = $row[$this->mIndexField];
133 } else {
134 $this->mPastTheEndRow = null;
135 # Setting indexes to an empty string means that they will be
136 # omitted if they would otherwise appear in URLs. It just so
137 # happens that this is the right thing to do in the standard
138 # UI, in all the relevant cases.
139 $this->mPastTheEndIndex = '';
140 $res->seek( $numRows - 1 );
141 $row = $res->fetchRow();
142 $lastIndex = $row[$this->mIndexField];
143 }
144 } else {
145 $firstIndex = '';
146 $lastIndex = '';
147 $this->mPastTheEndRow = null;
148 $this->mPastTheEndIndex = '';
149 }
150
151 if ( $this->mIsBackwards ) {
152 $this->mIsFirst = ( $numRows < $limit );
153 $this->mIsLast = ( $offset == '' );
154 $this->mLastShown = $firstIndex;
155 $this->mFirstShown = $lastIndex;
156 } else {
157 $this->mIsFirst = ( $offset == '' );
158 $this->mIsLast = ( $numRows < $limit );
159 $this->mLastShown = $lastIndex;
160 $this->mFirstShown = $firstIndex;
161 }
162 }
163
164 /**
165 * Do a query with specified parameters, rather than using the object
166 * context
167 *
168 * @param string $offset Index offset, inclusive
169 * @param integer $limit Exact query limit
170 * @param boolean $descending Query direction, false for ascending, true for descending
171 * @return ResultWrapper
172 */
173 function reallyDoQuery( $offset, $limit, $descending ) {
174 $fname = __METHOD__ . ' (' . get_class( $this ) . ')';
175 $info = $this->getQueryInfo();
176 $tables = $info['tables'];
177 $fields = $info['fields'];
178 $conds = isset( $info['conds'] ) ? $info['conds'] : array();
179 $options = isset( $info['options'] ) ? $info['options'] : array();
180 if ( $descending ) {
181 $options['ORDER BY'] = $this->mIndexField;
182 $operator = '>';
183 } else {
184 $options['ORDER BY'] = $this->mIndexField . ' DESC';
185 $operator = '<';
186 }
187 if ( $offset != '' ) {
188 $conds[] = $this->mIndexField . $operator . $this->mDb->addQuotes( $offset );
189 }
190 $options['LIMIT'] = intval( $limit );
191 $res = $this->mDb->select( $tables, $fields, $conds, $fname, $options );
192 return new ResultWrapper( $this->mDb, $res );
193 }
194
195 /**
196 * Get the formatted result list. Calls getStartBody(), formatRow() and
197 * getEndBody(), concatenates the results and returns them.
198 */
199 function getBody() {
200 if ( !$this->mQueryDone ) {
201 $this->doQuery();
202 }
203 # Don't use any extra rows returned by the query
204 $numRows = min( $this->mResult->numRows(), $this->mLimit );
205
206 $s = $this->getStartBody();
207 if ( $numRows ) {
208 if ( $this->mIsBackwards ) {
209 for ( $i = $numRows - 1; $i >= 0; $i-- ) {
210 $this->mResult->seek( $i );
211 $row = $this->mResult->fetchObject();
212 $s .= $this->formatRow( $row );
213 }
214 } else {
215 $this->mResult->seek( 0 );
216 for ( $i = 0; $i < $numRows; $i++ ) {
217 $row = $this->mResult->fetchObject();
218 $s .= $this->formatRow( $row );
219 }
220 }
221 } else {
222 $s .= $this->getEmptyBody();
223 }
224 $s .= $this->getEndBody();
225 return $s;
226 }
227
228 /**
229 * Make a self-link
230 */
231 function makeLink($text, $query = NULL) {
232 if ( $query === null ) {
233 return $text;
234 } else {
235 return $this->getSkin()->makeKnownLinkObj( $this->getTitle(), $text,
236 wfArrayToCGI( $query, $this->getDefaultQuery() ) );
237 }
238 }
239
240 /**
241 * Hook into getBody(), allows text to be inserted at the start. This
242 * will be called even if there are no rows in the result set.
243 */
244 function getStartBody() {
245 return '';
246 }
247
248 /**
249 * Hook into getBody() for the end of the list
250 */
251 function getEndBody() {
252 return '';
253 }
254
255 /**
256 * Hook into getBody(), for the bit between the start and the
257 * end when there are no rows
258 */
259 function getEmptyBody() {
260 return '';
261 }
262
263 /**
264 * Title used for self-links. Override this if you want to be able to
265 * use a title other than $wgTitle
266 */
267 function getTitle() {
268 return $GLOBALS['wgTitle'];
269 }
270
271 /**
272 * Get the current skin. This can be overridden if necessary.
273 */
274 function getSkin() {
275 if ( !isset( $this->mSkin ) ) {
276 global $wgUser;
277 $this->mSkin = $wgUser->getSkin();
278 }
279 return $this->mSkin;
280 }
281
282 /**
283 * Get an array of query parameters that should be put into self-links.
284 * By default, all parameters passed in the URL are used, except for a
285 * short blacklist.
286 */
287 function getDefaultQuery() {
288 if ( !isset( $this->mDefaultQuery ) ) {
289 $this->mDefaultQuery = $_GET;
290 unset( $this->mDefaultQuery['title'] );
291 unset( $this->mDefaultQuery['dir'] );
292 unset( $this->mDefaultQuery['offset'] );
293 unset( $this->mDefaultQuery['limit'] );
294 }
295 return $this->mDefaultQuery;
296 }
297
298 /**
299 * Get the number of rows in the result set
300 */
301 function getNumRows() {
302 if ( !$this->mQueryDone ) {
303 $this->doQuery();
304 }
305 return $this->mResult->numRows();
306 }
307
308 /**
309 * Get a query array for the prev, next, first and last links.
310 */
311 function getPagingQueries() {
312 if ( !$this->mQueryDone ) {
313 $this->doQuery();
314 }
315
316 # Don't announce the limit everywhere if it's the default
317 $urlLimit = $this->mLimit == $this->mDefaultLimit ? '' : $this->mLimit;
318
319 if ( $this->mIsFirst ) {
320 $prev = false;
321 $first = false;
322 } else {
323 $prev = array( 'dir' => 'prev', 'offset' => $this->mFirstShown, 'limit' => $urlLimit );
324 $first = array( 'limit' => $urlLimit );
325 }
326 if ( $this->mIsLast ) {
327 $next = false;
328 $last = false;
329 } else {
330 $next = array( 'offset' => $this->mLastShown, 'limit' => $urlLimit );
331 $last = array( 'dir' => 'prev', 'limit' => $urlLimit );
332 }
333 return array( 'prev' => $prev, 'next' => $next, 'first' => $first, 'last' => $last );
334 }
335
336 /**
337 * Get paging links. If a link is disabled, the item from $disabledTexts
338 * will be used. If there is no such item, the unlinked text from
339 * $linkTexts will be used. Both $linkTexts and $disabledTexts are arrays
340 * of HTML.
341 */
342 function getPagingLinks( $linkTexts, $disabledTexts = array() ) {
343 $queries = $this->getPagingQueries();
344 $links = array();
345 foreach ( $queries as $type => $query ) {
346 if ( $query !== false ) {
347 $links[$type] = $this->makeLink( $linkTexts[$type], $queries[$type] );
348 } elseif ( isset( $disabledTexts[$type] ) ) {
349 $links[$type] = $disabledTexts[$type];
350 } else {
351 $links[$type] = $linkTexts[$type];
352 }
353 }
354 return $links;
355 }
356
357 function getLimitLinks() {
358 global $wgLang;
359 $links = array();
360 if ( $this->mIsBackwards ) {
361 $offset = $this->mPastTheEndIndex;
362 } else {
363 $offset = $this->mOffset;
364 }
365 foreach ( $this->mLimitsShown as $limit ) {
366 $links[] = $this->makeLink( $wgLang->formatNum( $limit ),
367 array( 'offset' => $offset, 'limit' => $limit ) );
368 }
369 return $links;
370 }
371
372 /**
373 * Abstract formatting function. This should return an HTML string
374 * representing the result row $row. Rows will be concatenated and
375 * returned by getBody()
376 */
377 abstract function formatRow( $row );
378
379 /**
380 * This function should be overridden to provide all parameters
381 * needed for the main paged query. It returns an associative
382 * array with the following elements:
383 * tables => Table(s) for passing to Database::select()
384 * fields => Field(s) for passing to Database::select(), may be *
385 * conds => WHERE conditions
386 * options => option array
387 */
388 abstract function getQueryInfo();
389
390 /**
391 * This function should be overridden to return the name of the
392 * index field.
393 */
394 abstract function getIndexField();
395 }
396
397
398 /**
399 * IndexPager with an alphabetic list and a formatted navigation bar
400 * @addtogroup Pager
401 */
402 abstract class AlphabeticPager extends IndexPager {
403 public $mDefaultDirection = false;
404
405 function __construct() {
406 parent::__construct();
407 }
408
409 /**
410 * Shamelessly stolen bits from ReverseChronologicalPager, d
411 * didn't want to do class magic as may be still revamped
412 */
413 function getNavigationBar() {
414 global $wgLang;
415
416 $linkTexts = array(
417 'prev' => wfMsgHtml( "prevn", $this->mLimit ),
418 'next' => wfMsgHtml( 'nextn', $this->mLimit ),
419 'first' => wfMsgHtml('page_first'), /* Introduced the message */
420 'last' => wfMsgHtml( 'page_last' ) /* Introduced the message */
421 );
422
423 $pagingLinks = $this->getPagingLinks( $linkTexts );
424 $limitLinks = $this->getLimitLinks();
425 $limits = implode( ' | ', $limitLinks );
426
427 $this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " . wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
428 return $this->mNavigationBar;
429
430 }
431 }
432
433 /**
434 * IndexPager with a formatted navigation bar
435 * @addtogroup Pager
436 */
437 abstract class ReverseChronologicalPager extends IndexPager {
438 public $mDefaultDirection = true;
439
440 function __construct() {
441 parent::__construct();
442 }
443
444 function getNavigationBar() {
445 global $wgLang;
446
447 if ( isset( $this->mNavigationBar ) ) {
448 return $this->mNavigationBar;
449 }
450 $linkTexts = array(
451 'prev' => wfMsgHtml( "prevn", $this->mLimit ),
452 'next' => wfMsgHtml( 'nextn', $this->mLimit ),
453 'first' => wfMsgHtml('histlast'),
454 'last' => wfMsgHtml( 'histfirst' )
455 );
456
457 $pagingLinks = $this->getPagingLinks( $linkTexts );
458 $limitLinks = $this->getLimitLinks();
459 $limits = implode( ' | ', $limitLinks );
460
461 $this->mNavigationBar = "({$pagingLinks['first']} | {$pagingLinks['last']}) " .
462 wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
463 return $this->mNavigationBar;
464 }
465 }
466
467 /**
468 * Table-based display with a user-selectable sort order
469 * @addtogroup Pager
470 */
471 abstract class TablePager extends IndexPager {
472 var $mSort;
473 var $mCurrentRow;
474
475 function __construct() {
476 global $wgRequest;
477 $this->mSort = $wgRequest->getText( 'sort' );
478 if ( !array_key_exists( $this->mSort, $this->getFieldNames() ) ) {
479 $this->mSort = $this->getDefaultSort();
480 }
481 if ( $wgRequest->getBool( 'asc' ) ) {
482 $this->mDefaultDirection = false;
483 } elseif ( $wgRequest->getBool( 'desc' ) ) {
484 $this->mDefaultDirection = true;
485 } /* Else leave it at whatever the class default is */
486
487 parent::__construct();
488 }
489
490 function getStartBody() {
491 global $wgStylePath;
492 $tableClass = htmlspecialchars( $this->getTableClass() );
493 $sortClass = htmlspecialchars( $this->getSortHeaderClass() );
494
495 $s = "<table border='1' class=\"$tableClass\"><thead><tr>\n";
496 $fields = $this->getFieldNames();
497
498 # Make table header
499 foreach ( $fields as $field => $name ) {
500 if ( strval( $name ) == '' ) {
501 $s .= "<th>&nbsp;</th>\n";
502 } elseif ( $this->isFieldSortable( $field ) ) {
503 $query = array( 'sort' => $field, 'limit' => $this->mLimit );
504 if ( $field == $this->mSort ) {
505 # This is the sorted column
506 # Prepare a link that goes in the other sort order
507 if ( $this->mDefaultDirection ) {
508 # Descending
509 $image = 'Arr_u.png';
510 $query['asc'] = '1';
511 $query['desc'] = '';
512 $alt = htmlspecialchars( wfMsg( 'descending_abbrev' ) );
513 } else {
514 # Ascending
515 $image = 'Arr_d.png';
516 $query['asc'] = '';
517 $query['desc'] = '1';
518 $alt = htmlspecialchars( wfMsg( 'ascending_abbrev' ) );
519 }
520 $image = htmlspecialchars( "$wgStylePath/common/images/$image" );
521 $link = $this->makeLink(
522 "<img width=\"12\" height=\"12\" alt=\"$alt\" src=\"$image\" />" .
523 htmlspecialchars( $name ), $query );
524 $s .= "<th class=\"$sortClass\">$link</th>\n";
525 } else {
526 $s .= '<th>' . $this->makeLink( htmlspecialchars( $name ), $query ) . "</th>\n";
527 }
528 } else {
529 $s .= '<th>' . htmlspecialchars( $name ) . "</th>\n";
530 }
531 }
532 $s .= "</tr></thead><tbody>\n";
533 return $s;
534 }
535
536 function getEndBody() {
537 return "</tbody></table>\n";
538 }
539
540 function getEmptyBody() {
541 $colspan = count( $this->getFieldNames() );
542 $msgEmpty = wfMsgHtml( 'table_pager_empty' );
543 return "<tr><td colspan=\"$colspan\">$msgEmpty</td></tr>\n";
544 }
545
546 function formatRow( $row ) {
547 $s = "<tr>\n";
548 $fieldNames = $this->getFieldNames();
549 $this->mCurrentRow = $row; # In case formatValue needs to know
550 foreach ( $fieldNames as $field => $name ) {
551 $value = isset( $row->$field ) ? $row->$field : null;
552 $formatted = strval( $this->formatValue( $field, $value ) );
553 if ( $formatted == '' ) {
554 $formatted = '&nbsp;';
555 }
556 $class = 'TablePager_col_' . htmlspecialchars( $field );
557 $s .= "<td class=\"$class\">$formatted</td>\n";
558 }
559 $s .= "</tr>\n";
560 return $s;
561 }
562
563 function getIndexField() {
564 return $this->mSort;
565 }
566
567 function getTableClass() {
568 return 'TablePager';
569 }
570
571 function getNavClass() {
572 return 'TablePager_nav';
573 }
574
575 function getSortHeaderClass() {
576 return 'TablePager_sort';
577 }
578
579 /**
580 * A navigation bar with images
581 */
582 function getNavigationBar() {
583 global $wgStylePath, $wgContLang;
584 $path = "$wgStylePath/common/images";
585 $labels = array(
586 'first' => 'table_pager_first',
587 'prev' => 'table_pager_prev',
588 'next' => 'table_pager_next',
589 'last' => 'table_pager_last',
590 );
591 $images = array(
592 'first' => $wgContLang->isRTL() ? 'arrow_last_25.png' : 'arrow_first_25.png',
593 'prev' => $wgContLang->isRTL() ? 'arrow_right_25.png' : 'arrow_left_25.png',
594 'next' => $wgContLang->isRTL() ? 'arrow_left_25.png' : 'arrow_right_25.png',
595 'last' => $wgContLang->isRTL() ? 'arrow_first_25.png' : 'arrow_last_25.png',
596 );
597 $disabledImages = array(
598 'first' => $wgContLang->isRTL() ? 'arrow_disabled_last_25.png' : 'arrow_disabled_first_25.png',
599 'prev' => $wgContLang->isRTL() ? 'arrow_disabled_right_25.png' : 'arrow_disabled_left_25.png',
600 'next' => $wgContLang->isRTL() ? 'arrow_disabled_left_25.png' : 'arrow_disabled_right_25.png',
601 'last' => $wgContLang->isRTL() ? 'arrow_disabled_first_25.png' : 'arrow_disabled_last_25.png',
602 );
603
604 $linkTexts = array();
605 $disabledTexts = array();
606 foreach ( $labels as $type => $label ) {
607 $msgLabel = wfMsgHtml( $label );
608 $linkTexts[$type] = "<img src=\"$path/{$images[$type]}\" alt=\"$msgLabel\"/><br/>$msgLabel";
609 $disabledTexts[$type] = "<img src=\"$path/{$disabledImages[$type]}\" alt=\"$msgLabel\"/><br/>$msgLabel";
610 }
611 $links = $this->getPagingLinks( $linkTexts, $disabledTexts );
612
613 $navClass = htmlspecialchars( $this->getNavClass() );
614 $s = "<table class=\"$navClass\" align=\"center\" cellpadding=\"3\"><tr>\n";
615 $cellAttrs = 'valign="top" align="center" width="' . 100 / count( $links ) . '%"';
616 foreach ( $labels as $type => $label ) {
617 $s .= "<td $cellAttrs>{$links[$type]}</td>\n";
618 }
619 $s .= "</tr></table>\n";
620 return $s;
621 }
622
623 /**
624 * Get a <select> element which has options for each of the allowed limits
625 */
626 function getLimitSelect() {
627 global $wgLang;
628 $s = "<select name=\"limit\">";
629 foreach ( $this->mLimitsShown as $limit ) {
630 $selected = $limit == $this->mLimit ? 'selected="selected"' : '';
631 $formattedLimit = $wgLang->formatNum( $limit );
632 $s .= "<option value=\"$limit\" $selected>$formattedLimit</option>\n";
633 }
634 $s .= "</select>";
635 return $s;
636 }
637
638 /**
639 * Get <input type="hidden"> elements for use in a method="get" form.
640 * Resubmits all defined elements of the $_GET array, except for a
641 * blacklist, passed in the $blacklist parameter.
642 */
643 function getHiddenFields( $blacklist = array() ) {
644 $blacklist = (array)$blacklist;
645 $query = $_GET;
646 foreach ( $blacklist as $name ) {
647 unset( $query[$name] );
648 }
649 $s = '';
650 foreach ( $query as $name => $value ) {
651 $encName = htmlspecialchars( $name );
652 $encValue = htmlspecialchars( $value );
653 $s .= "<input type=\"hidden\" name=\"$encName\" value=\"$encValue\"/>\n";
654 }
655 return $s;
656 }
657
658 /**
659 * Get a form containing a limit selection dropdown
660 */
661 function getLimitForm() {
662 # Make the select with some explanatory text
663 $url = $this->getTitle()->escapeLocalURL();
664 $msgSubmit = wfMsgHtml( 'table_pager_limit_submit' );
665 return
666 "<form method=\"get\" action=\"$url\">" .
667 wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) .
668 "\n<input type=\"submit\" value=\"$msgSubmit\"/>\n" .
669 $this->getHiddenFields( 'limit' ) .
670 "</form>\n";
671 }
672
673 /**
674 * Return true if the named field should be sortable by the UI, false
675 * otherwise
676 *
677 * @param string $field
678 */
679 abstract function isFieldSortable( $field );
680
681 /**
682 * Format a table cell. The return value should be HTML, but use an empty
683 * string not &nbsp; for empty cells. Do not include the <td> and </td>.
684 *
685 * The current result row is available as $this->mCurrentRow, in case you
686 * need more context.
687 *
688 * @param string $name The database field name
689 * @param string $value The value retrieved from the database
690 */
691 abstract function formatValue( $name, $value );
692
693 /**
694 * The database field name used as a default sort order
695 */
696 abstract function getDefaultSort();
697
698 /**
699 * An array mapping database field names to a textual description of the
700 * field name, for use in the table header. The description should be plain
701 * text, it will be HTML-escaped later.
702 */
703 abstract function getFieldNames();
704 }
705