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