Yet more doc tweaks:
[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']}) " . wfMsgHtml("viewprevnext", $pagingLinks['prev'], $pagingLinks['next'], $limits);
457 return $this->mNavigationBar;
458 }
459 }
460
461 /**
462 * Table-based display with a user-selectable sort order
463 * @addtogroup Pager
464 */
465 abstract class TablePager extends IndexPager {
466 var $mSort;
467 var $mCurrentRow;
468
469 function __construct() {
470 global $wgRequest;
471 $this->mSort = $wgRequest->getText( 'sort' );
472 if ( !array_key_exists( $this->mSort, $this->getFieldNames() ) ) {
473 $this->mSort = $this->getDefaultSort();
474 }
475 if ( $wgRequest->getBool( 'asc' ) ) {
476 $this->mDefaultDirection = false;
477 } elseif ( $wgRequest->getBool( 'desc' ) ) {
478 $this->mDefaultDirection = true;
479 } /* Else leave it at whatever the class default is */
480
481 parent::__construct();
482 }
483
484 function getStartBody() {
485 global $wgStylePath;
486 $tableClass = htmlspecialchars( $this->getTableClass() );
487 $sortClass = htmlspecialchars( $this->getSortHeaderClass() );
488
489 $s = "<table border='1' class=\"$tableClass\"><thead><tr>\n";
490 $fields = $this->getFieldNames();
491
492 # Make table header
493 foreach ( $fields as $field => $name ) {
494 if ( strval( $name ) == '' ) {
495 $s .= "<th>&nbsp;</th>\n";
496 } elseif ( $this->isFieldSortable( $field ) ) {
497 $query = array( 'sort' => $field, 'limit' => $this->mLimit );
498 if ( $field == $this->mSort ) {
499 # This is the sorted column
500 # Prepare a link that goes in the other sort order
501 if ( $this->mDefaultDirection ) {
502 # Descending
503 $image = 'Arr_u.png';
504 $query['asc'] = '1';
505 $query['desc'] = '';
506 $alt = htmlspecialchars( wfMsg( 'descending_abbrev' ) );
507 } else {
508 # Ascending
509 $image = 'Arr_d.png';
510 $query['asc'] = '';
511 $query['desc'] = '1';
512 $alt = htmlspecialchars( wfMsg( 'ascending_abbrev' ) );
513 }
514 $image = htmlspecialchars( "$wgStylePath/common/images/$image" );
515 $link = $this->makeLink(
516 "<img width=\"12\" height=\"12\" alt=\"$alt\" src=\"$image\" />" .
517 htmlspecialchars( $name ), $query );
518 $s .= "<th class=\"$sortClass\">$link</th>\n";
519 } else {
520 $s .= '<th>' . $this->makeLink( htmlspecialchars( $name ), $query ) . "</th>\n";
521 }
522 } else {
523 $s .= '<th>' . htmlspecialchars( $name ) . "</th>\n";
524 }
525 }
526 $s .= "</tr></thead><tbody>\n";
527 return $s;
528 }
529
530 function getEndBody() {
531 return "</tbody></table>\n";
532 }
533
534 function getEmptyBody() {
535 $colspan = count( $this->getFieldNames() );
536 $msgEmpty = wfMsgHtml( 'table_pager_empty' );
537 return "<tr><td colspan=\"$colspan\">$msgEmpty</td></tr>\n";
538 }
539
540 function formatRow( $row ) {
541 $s = "<tr>\n";
542 $fieldNames = $this->getFieldNames();
543 $this->mCurrentRow = $row; # In case formatValue needs to know
544 foreach ( $fieldNames as $field => $name ) {
545 $value = isset( $row->$field ) ? $row->$field : null;
546 $formatted = strval( $this->formatValue( $field, $value ) );
547 if ( $formatted == '' ) {
548 $formatted = '&nbsp;';
549 }
550 $class = 'TablePager_col_' . htmlspecialchars( $field );
551 $s .= "<td class=\"$class\">$formatted</td>\n";
552 }
553 $s .= "</tr>\n";
554 return $s;
555 }
556
557 function getIndexField() {
558 return $this->mSort;
559 }
560
561 function getTableClass() {
562 return 'TablePager';
563 }
564
565 function getNavClass() {
566 return 'TablePager_nav';
567 }
568
569 function getSortHeaderClass() {
570 return 'TablePager_sort';
571 }
572
573 /**
574 * A navigation bar with images
575 */
576 function getNavigationBar() {
577 global $wgStylePath, $wgContLang;
578 $path = "$wgStylePath/common/images";
579 $labels = array(
580 'first' => 'table_pager_first',
581 'prev' => 'table_pager_prev',
582 'next' => 'table_pager_next',
583 'last' => 'table_pager_last',
584 );
585 $images = array(
586 'first' => $wgContLang->isRTL() ? 'arrow_last_25.png' : 'arrow_first_25.png',
587 'prev' => $wgContLang->isRTL() ? 'arrow_right_25.png' : 'arrow_left_25.png',
588 'next' => $wgContLang->isRTL() ? 'arrow_left_25.png' : 'arrow_right_25.png',
589 'last' => $wgContLang->isRTL() ? 'arrow_first_25.png' : 'arrow_last_25.png',
590 );
591 $disabledImages = array(
592 'first' => $wgContLang->isRTL() ? 'arrow_disabled_last_25.png' : 'arrow_disabled_first_25.png',
593 'prev' => $wgContLang->isRTL() ? 'arrow_disabled_right_25.png' : 'arrow_disabled_left_25.png',
594 'next' => $wgContLang->isRTL() ? 'arrow_disabled_left_25.png' : 'arrow_disabled_right_25.png',
595 'last' => $wgContLang->isRTL() ? 'arrow_disabled_first_25.png' : 'arrow_disabled_last_25.png',
596 );
597
598 $linkTexts = array();
599 $disabledTexts = array();
600 foreach ( $labels as $type => $label ) {
601 $msgLabel = wfMsgHtml( $label );
602 $linkTexts[$type] = "<img src=\"$path/{$images[$type]}\" alt=\"$msgLabel\"/><br/>$msgLabel";
603 $disabledTexts[$type] = "<img src=\"$path/{$disabledImages[$type]}\" alt=\"$msgLabel\"/><br/>$msgLabel";
604 }
605 $links = $this->getPagingLinks( $linkTexts, $disabledTexts );
606
607 $navClass = htmlspecialchars( $this->getNavClass() );
608 $s = "<table class=\"$navClass\" align=\"center\" cellpadding=\"3\"><tr>\n";
609 $cellAttrs = 'valign="top" align="center" width="' . 100 / count( $links ) . '%"';
610 foreach ( $labels as $type => $label ) {
611 $s .= "<td $cellAttrs>{$links[$type]}</td>\n";
612 }
613 $s .= "</tr></table>\n";
614 return $s;
615 }
616
617 /**
618 * Get a <select> element which has options for each of the allowed limits
619 */
620 function getLimitSelect() {
621 global $wgLang;
622 $s = "<select name=\"limit\">";
623 foreach ( $this->mLimitsShown as $limit ) {
624 $selected = $limit == $this->mLimit ? 'selected="selected"' : '';
625 $formattedLimit = $wgLang->formatNum( $limit );
626 $s .= "<option value=\"$limit\" $selected>$formattedLimit</option>\n";
627 }
628 $s .= "</select>";
629 return $s;
630 }
631
632 /**
633 * Get <input type="hidden"> elements for use in a method="get" form.
634 * Resubmits all defined elements of the $_GET array, except for a
635 * blacklist, passed in the $blacklist parameter.
636 */
637 function getHiddenFields( $blacklist = array() ) {
638 $blacklist = (array)$blacklist;
639 $query = $_GET;
640 foreach ( $blacklist as $name ) {
641 unset( $query[$name] );
642 }
643 $s = '';
644 foreach ( $query as $name => $value ) {
645 $encName = htmlspecialchars( $name );
646 $encValue = htmlspecialchars( $value );
647 $s .= "<input type=\"hidden\" name=\"$encName\" value=\"$encValue\"/>\n";
648 }
649 return $s;
650 }
651
652 /**
653 * Get a form containing a limit selection dropdown
654 */
655 function getLimitForm() {
656 # Make the select with some explanatory text
657 $url = $this->getTitle()->escapeLocalURL();
658 $msgSubmit = wfMsgHtml( 'table_pager_limit_submit' );
659 return
660 "<form method=\"get\" action=\"$url\">" .
661 wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) .
662 "\n<input type=\"submit\" value=\"$msgSubmit\"/>\n" .
663 $this->getHiddenFields( 'limit' ) .
664 "</form>\n";
665 }
666
667 /**
668 * Return true if the named field should be sortable by the UI, false otherwise
669 * @param string $field
670 */
671 abstract function isFieldSortable( $field );
672
673 /**
674 * Format a table cell. The return value should be HTML, but use an empty string
675 * not &nbsp; for empty cells. Do not include the <td> and </td>.
676 *
677 * @param string $name The database field name
678 * @param string $value The value retrieved from the database
679 *
680 * The current result row is available as $this->mCurrentRow, in case you need
681 * more context.
682 */
683 abstract function formatValue( $name, $value );
684
685 /**
686 * The database field name used as a default sort order
687 */
688 abstract function getDefaultSort();
689
690 /**
691 * An array mapping database field names to a textual description of the field
692 * name, for use in the table header. The description should be plain text, it
693 * will be HTML-escaped later.
694 */
695 abstract function getFieldNames();
696 }
697 ?>