42 $this->mSort = $this->
getRequest()->getText(
'sort' );
43 if ( !array_key_exists( $this->mSort, $this->
getFieldNames() )
50 } elseif ( $this->
getRequest()->getBool(
'desc' ) ) {
74 return parent::getBody();
87 $body = parent::getBody();
106 $body = parent::getBody();
109 $pout->
setText( $navigation . $body . $navigation );
125 foreach ( $fields as $field => $name ) {
126 if ( strval( $name ) ==
'' ) {
127 $s .= Html::rawElement(
'th', [],
"\u{00A0}" ) .
"\n";
133 if ( $this->mSort == $field ) {
138 $class =
"$sortClass mw-datatable-is-sorted mw-datatable-is-descending";
143 $class =
"$sortClass mw-datatable-is-sorted mw-datatable-is-ascending";
145 $query[
'desc'] =
'1';
149 $link = $this->
makeLink( htmlspecialchars( $name ), $query, $linkType );
150 $s .= Html::rawElement(
'th', [
'class' => $class ], $link ) .
"\n";
152 $s .= Html::element(
'th', [], $name ) .
"\n";
157 $ret = Html::openElement(
'table', [
158 'class' =>
" $tableClass" ]
160 $ret .= Html::rawElement(
'thead', [], Html::rawElement(
'tr', [],
"\n" .
$s .
"\n" ) );
161 $ret .= Html::openElement(
'tbody' ) .
"\n";
171 return "</tbody></table>\n";
180 $msgEmpty = $this->
msg(
'table_pager_empty' )->text();
181 return Html::rawElement(
'tr', [],
182 Html::element(
'td', [
'colspan' => $colspan ], $msgEmpty ) );
191 $this->mCurrentRow = $row;
192 $s = Html::openElement(
'tr', $this->
getRowAttrs( $row ) ) .
"\n";
195 foreach ( $fieldNames as $field => $name ) {
196 $value = $row->$field ??
null;
197 $formatted = strval( $this->
formatValue( $field, $value ) );
199 if ( $formatted ==
'' ) {
200 $formatted =
"\u{00A0}";
203 $s .= Html::rawElement(
'td', $this->
getCellAttrs( $field, $value ), $formatted ) .
"\n";
206 $s .= Html::closeElement(
'tr' ) .
"\n";
233 if ( $class ===
'' ) {
260 return [
'class' =>
'TablePager_col_' . $field ];
276 return 'mw-datatable';
283 return 'TablePager_nav';
290 return 'TablePager_sort';
304 $types = [
'first',
'prev',
'next',
'last' ];
312 foreach ( $types as
$type ) {
313 $buttons[] = new \OOUI\ButtonWidget( [
319 'classes' => [
'TablePager-button-' .
$type ],
320 'flags' => [
'progressive' ],
322 'label' => $this->
msg(
'table_pager_' . $type )->text(),
326 'icon' =>
$type ===
'prev' ?
'previous' :
$type,
330 return new \OOUI\ButtonGroupWidget( [
342 return [
'mediawiki.pager.tablePager',
'oojs-ui.styles.icons-movement' ];
352 $select =
new XmlSelect(
'limit',
false, $this->mLimit );
354 foreach ( $attribs as $name => $value ) {
355 $select->setAttribute( $name, $value );
357 return $select->getHTML();
368 # Add the current limit from the query string
369 # to avoid that the limit is lost after clicking Go next time
370 if ( !in_array( $this->mLimit, $this->mLimitsShown ) ) {
372 sort( $this->mLimitsShown );
375 foreach ( $this->mLimitsShown as $key => $value ) {
376 # The pair is either $index => $limit, in which case the $value
377 # will be numeric, or $limit => $text, in which case the $value
379 if ( is_int( $value ) ) {
386 $ret[$text] = $limit;
400 $blacklist = (array)$blacklist;
401 $query = $this->
getRequest()->getQueryValues();
402 foreach ( $blacklist as $name ) {
403 unset( $query[$name] );
406 foreach ( $query as $name => $value ) {
407 $s .= Html::hidden( $name, $value ) .
"\n";
418 return Html::rawElement(
434 # Make the select with some explanatory text
435 $msgSubmit = $this->
msg(
'table_pager_limit_submit' )->escaped();
437 return $this->
msg(
'table_pager_limit' )
439 "\n<input type=\"submit\" value=\"$msgSubmit\"/>\n" .