49 $this->mSort = $this->
getRequest()->getText(
'sort' );
50 if ( !array_key_exists( $this->mSort, $this->
getFieldNames() )
57 } elseif ( $this->
getRequest()->getBool(
'desc' ) ) {
81 return parent::getBody();
94 $body = parent::getBody();
113 $body = parent::getBody();
116 $pout->
setText( $navigation . $body . $navigation );
132 foreach ( $fields as $field => $name ) {
133 if ( strval( $name ) ==
'' ) {
140 if ( $this->mSort == $field ) {
145 $class =
"$sortClass mw-datatable-is-sorted mw-datatable-is-descending";
150 $class =
"$sortClass mw-datatable-is-sorted mw-datatable-is-ascending";
152 $query[
'desc'] =
'1';
156 $link = $this->
makeLink( htmlspecialchars( $name ), $query, $linkType );
165 'class' =>
" $tableClass" ]
178 return "</tbody></table>\n";
186 $msgEmpty = $this->
msg(
'table_pager_empty' )->text();
188 Html::element(
'td', [
'colspan' => $colspan ], $msgEmpty ) );
197 $this->mCurrentRow = $row;
201 foreach ( $fieldNames as $field => $name ) {
202 $value = $row->$field ??
null;
203 $formatted = strval( $this->
formatValue( $field, $value ) );
205 if ( $formatted ==
'' ) {
206 $formatted =
"\u{00A0}";
239 if ( $class ===
'' ) {
266 return [
'class' =>
'TablePager_col_' . $field ];
284 return 'mw-datatable';
292 return 'TablePager_nav';
300 return 'TablePager_sort';
316 $types = [
'first',
'prev',
'next',
'last' ];
324 foreach ( $types as
$type ) {
325 $buttons[] = new \OOUI\ButtonWidget( [
331 'classes' => [
'TablePager-button-' .
$type ],
332 'flags' => [
'progressive' ],
334 'label' => $this->
msg(
'table_pager_' . $type )->text(),
335 'href' => $queries[
$type ] ?
336 $title->getLinkURL( $queries[
$type ] + $this->getDefaultQuery() ) :
338 'icon' =>
$type ===
'prev' ?
'previous' :
$type,
339 'disabled' => $queries[
$type ] ===
false
342 return new \OOUI\ButtonGroupWidget( [
356 return [
'mediawiki.pager.tablePager',
'oojs-ui.styles.icons-movement' ];
366 $select =
new XmlSelect(
'limit',
false, $this->mLimit );
368 foreach ( $attribs as $name => $value ) {
369 $select->setAttribute( $name, $value );
371 return $select->getHTML();
382 # Add the current limit from the query string
383 # to avoid that the limit is lost after clicking Go next time
384 if ( !in_array( $this->mLimit, $this->mLimitsShown ) ) {
386 sort( $this->mLimitsShown );
389 foreach ( $this->mLimitsShown as $key => $value ) {
390 # The pair is either $index => $limit, in which case the $value
391 # will be numeric, or $limit => $text, in which case the $value
393 if ( is_int( $value ) ) {
400 $ret[$text] = $limit;
414 $noResubmit = (array)$noResubmit;
415 $query = $this->
getRequest()->getQueryValues();
416 foreach ( $noResubmit as $name ) {
417 unset( $query[$name] );
420 foreach ( $query as $name => $value ) {
448 # Make the select with some explanatory text
449 $msgSubmit = $this->
msg(
'table_pager_limit_submit' )->escaped();
451 return $this->
msg(
'table_pager_limit' )
453 "\n<input type=\"submit\" value=\"$msgSubmit\"/>\n" .