MediaWiki  REL1_24
TablePager Class Reference

Table-based display with a user-selectable sort order. More...

Inheritance diagram for TablePager:
Collaboration diagram for TablePager:

List of all members.

Public Member Functions

 __construct (IContextSource $context=null)
 formatRow ($row)
 formatValue ($name, $value)
 Format a table cell.
 getBody ()
 Get the formatted result list.
 getBodyOutput ()
 Get the formatted result list.
 getCellAttrs ($field, $value)
 Get any extra attributes to be applied to the given cell.
 getDefaultSort ()
 The database field name used as a default sort order.
 getEmptyBody ()
 getEndBody ()
 getFieldNames ()
 An array mapping database field names to a textual description of the field name, for use in the table header.
 getFullOutput ()
 Get the formatted result list, with navigation bars.
 getHiddenFields ($blacklist=array())
 Get <input type="hidden"> elements for use in a method="get" form.
 getIndexField ()
 getLimitDropdown ()
 Gets a limit selection dropdown.
 getLimitForm ()
 Get a form containing a limit selection dropdown.
 getLimitSelect ($attribs=array())
 Get a "<select>" element which has options for each of the allowed limits.
 getLimitSelectList ()
 Get a list of items to show in a "<select>" element of limits.
 getModuleStyles ()
 ResourceLoader modules that must be loaded to provide correct styling for this pager.
 getNavClass ()
 getNavigationBar ()
 A navigation bar with images.
 getRowAttrs ($row)
 Get attributes to be applied to the given row.
 getRowClass ($row)
 Get a class name to be applied to the given row.
 getSortHeaderClass ()
 getStartBody ()
 getTableClass ()
 isFieldSortable ($field)
 Return true if the named field should be sortable by the UI, false otherwise.

Protected Attributes

 $mCurrentRow
 $mSort

Detailed Description

Table-based display with a user-selectable sort order.

Definition at line 28 of file TablePager.php.


Constructor & Destructor Documentation


Member Function Documentation

Access:
protected
Parameters:
stdClass$row
Returns:
string HTML

Reimplemented from IndexPager.

Reimplemented in AllMessagesTablePager.

Definition at line 185 of file TablePager.php.

References $name, $s, $value, as, Html\closeElement(), formatValue(), getCellAttrs(), getFieldNames(), getRowAttrs(), Html\openElement(), and Html\rawElement().

TablePager::formatValue ( name,
value 
) [abstract]

Format a table cell.

The return value should be HTML, but use an empty string not &#160; for empty cells. Do not include the

and .

The current result row is available as $this->mCurrentRow, in case you need more context.

Access:
protected
Parameters:
string$nameThe database field name
string$valueThe value retrieved from the database

Reimplemented in ImageListPager, ProtectedPagesPager, AllMessagesTablePager, and BlockListPager.

Referenced by formatRow().

TablePager::getBody ( ) [final]

Get the formatted result list.

Calls getStartBody(), formatRow() and getEndBody(), concatenates the results and returns them.

Also adds the required styles to our OutputPage object (this means that if context wasn't passed to constructor or otherwise set up, you will get a pager with missing styles).

This method has been made 'final' in 1.24. There's no reason to override it, and if there exist any subclasses that do, the style loading hack is probably broken in them. Let's fail fast rather than mysteriously render things wrong.

Deprecated:
since 1.24, use getBodyOutput() or getFullOutput() instead
Returns:
string

Reimplemented from IndexPager.

Definition at line 67 of file TablePager.php.

References getModuleStyles(), and ContextSource\getOutput().

Referenced by getBodyOutput(), and getFullOutput().

Get the formatted result list.

Calls getBody() and getModuleStyles() and builds a ParserOutput object. (This is a bit hacky but works well.)

Since:
1.24
Returns:
ParserOutput

Definition at line 81 of file TablePager.php.

References getBody(), getModuleStyles(), and ParserOutput\setText().

TablePager::getCellAttrs ( field,
value 
)

Get any extra attributes to be applied to the given cell.

Don't take this as an excuse to hardcode styles; use classes and CSS instead. Row context is available in $this->mCurrentRow

Access:
protected
Parameters:
string$fieldThe column
string$valueThe cell contents
Returns:
array Array of attr => value

Reimplemented in AllMessagesTablePager.

Definition at line 247 of file TablePager.php.

References array().

Referenced by formatRow().

The database field name used as a default sort order.

Access:
protected
Returns:
string

Reimplemented in ProtectedPagesPager, AllMessagesTablePager, BlockListPager, and ImageListPager.

Referenced by __construct().

Access:
protected
Returns:
string

Reimplemented from IndexPager.

Definition at line 173 of file TablePager.php.

References array(), Html\element(), getFieldNames(), ContextSource\msg(), and Html\rawElement().

Access:
protected
Returns:
string

Reimplemented from IndexPager.

Definition at line 165 of file TablePager.php.

TablePager::getFieldNames ( ) [abstract]

An array mapping database field names to a textual description of the field name, for use in the table header.

The description should be plain text, it will be HTML-escaped later.

Returns:
array

Reimplemented in AllMessagesTablePager, ProtectedPagesPager, BlockListPager, and ImageListPager.

Referenced by __construct(), formatRow(), getEmptyBody(), and getStartBody().

Get the formatted result list, with navigation bars.

Calls getBody(), getNavigationBar() and getModuleStyles() and builds a ParserOutput object. (This is a bit hacky but works well.)

Since:
1.24
Returns:
ParserOutput

Definition at line 99 of file TablePager.php.

References getBody(), getModuleStyles(), getNavigationBar(), and ParserOutput\setText().

TablePager::getHiddenFields ( blacklist = array())

Get <input type="hidden"> elements for use in a method="get" form.

Resubmits all defined elements of the query string, except for a blacklist, passed in the $blacklist parameter.

Parameters:
array$blacklistParameters from the request query which should not be resubmitted
Returns:
string HTML fragment

Definition at line 386 of file TablePager.php.

References $name, $query, $s, $value, array(), as, ContextSource\getRequest(), and Html\hidden().

Referenced by getLimitDropdown().

Access:
protected
Returns:
string

Reimplemented from IndexPager.

Reimplemented in ProtectedPagesPager, and BlockListPager.

Definition at line 255 of file TablePager.php.

Gets a limit selection dropdown.

Returns:
string

Definition at line 420 of file TablePager.php.

References array(), getHiddenFields(), getLimitSelect(), and ContextSource\msg().

Referenced by getLimitForm().

Get a form containing a limit selection dropdown.

Returns:
string HTML fragment

Definition at line 404 of file TablePager.php.

References array(), getLimitDropdown(), Html\rawElement(), and wfScript().

TablePager::getLimitSelect ( attribs = array())

Get a "<select>" element which has options for each of the allowed limits.

Parameters:
string$attribsExtra attributes to set
Returns:
string HTML fragment

Definition at line 338 of file TablePager.php.

References $attribs, $name, $value, as, and getLimitSelectList().

Referenced by getLimitDropdown().

Get a list of items to show in a "<select>" element of limits.

This can be passed directly to XmlSelect::addOptions().

Since:
1.22
Returns:
array

Definition at line 354 of file TablePager.php.

References $key, $limit, $ret, $value, array(), as, and ContextSource\getLanguage().

Referenced by getLimitSelect().

ResourceLoader modules that must be loaded to provide correct styling for this pager.

Since:
1.24
Returns:
string[]

Definition at line 328 of file TablePager.php.

References array().

Referenced by getBody(), getBodyOutput(), and getFullOutput().

Access:
protected
Returns:
string

Reimplemented in ImageListPager.

Definition at line 271 of file TablePager.php.

Referenced by getNavigationBar().

A navigation bar with images.

Returns:
string HTML

Implements Pager.

Definition at line 287 of file TablePager.php.

References $s, $type, array(), as, Html\closeElement(), getNavClass(), IndexPager\getPagingLinks(), IndexPager\isNavigationBarShown(), ContextSource\msg(), Html\openElement(), and Html\rawElement().

Referenced by getFullOutput().

Get attributes to be applied to the given row.

Access:
protected
Parameters:
object$rowThe database result row
Returns:
array Array of attribute => value

Definition at line 226 of file TablePager.php.

References array(), and getRowClass().

Referenced by formatRow().

Get a class name to be applied to the given row.

Access:
protected
Parameters:
object$rowThe database result row
Returns:
string

Definition at line 214 of file TablePager.php.

Referenced by getRowAttrs().

Access:
protected
Returns:
string

Reimplemented in ImageListPager.

Definition at line 279 of file TablePager.php.

Referenced by getStartBody().

Access:
protected
Returns:
string

Reimplemented in ImageListPager, ProtectedPagesPager, and BlockListPager.

Definition at line 263 of file TablePager.php.

Referenced by getStartBody().

TablePager::isFieldSortable ( field) [abstract]

Return true if the named field should be sortable by the UI, false otherwise.

Parameters:
string$field

Reimplemented in ProtectedPagesPager, AllMessagesTablePager, BlockListPager, and ImageListPager.

Referenced by __construct(), and getStartBody().


Member Data Documentation

TablePager::$mCurrentRow [protected]

Definition at line 31 of file TablePager.php.

TablePager::$mSort [protected]

Definition at line 29 of file TablePager.php.


The documentation for this class was generated from the following file: