Merge "Replace sorting classes with better naming convention"
[lhc/web/wiklou.git] / includes / pager / TablePager.php
index b6d5b94..71b1ad7 100644 (file)
  * @ingroup Pager
  */
 abstract class TablePager extends IndexPager {
+       /** @var string */
        protected $mSort;
 
+       /** @var stdClass */
        protected $mCurrentRow;
 
        public function __construct( IContextSource $context = null ) {
@@ -110,7 +112,7 @@ abstract class TablePager extends IndexPager {
         * @protected
         * @return string
         */
-       function getStartBody() {
+       protected function getStartBody() {
                $sortClass = $this->getSortHeaderClass();
 
                $s = '';
@@ -119,7 +121,7 @@ abstract class TablePager extends IndexPager {
                // Make table header
                foreach ( $fields as $field => $name ) {
                        if ( strval( $name ) == '' ) {
-                               $s .= Html::rawElement( 'th', [], ' ' ) . "\n";
+                               $s .= Html::rawElement( 'th', [], "\u{00A0}" ) . "\n";
                        } elseif ( $this->isFieldSortable( $field ) ) {
                                $query = [ 'sort' => $field, 'limit' => $this->mLimit ];
                                $linkType = null;
@@ -130,12 +132,12 @@ abstract class TablePager extends IndexPager {
                                        // We don't actually know in which direction other fields will be sorted by default…
                                        if ( $this->mDefaultDirection == IndexPager::DIR_DESCENDING ) {
                                                $linkType = 'asc';
-                                               $class = "$sortClass TablePager_sort-descending";
+                                               $class = "$sortClass mw-datatable-is-sorted mw-datatable-is-descending";
                                                $query['asc'] = '1';
                                                $query['desc'] = '';
                                        } else {
                                                $linkType = 'desc';
-                                               $class = "$sortClass TablePager_sort-ascending";
+                                               $class = "$sortClass mw-datatable-is-sorted mw-datatable-is-ascending";
                                                $query['asc'] = '';
                                                $query['desc'] = '1';
                                        }
@@ -162,7 +164,7 @@ abstract class TablePager extends IndexPager {
         * @protected
         * @return string
         */
-       function getEndBody() {
+       protected function getEndBody() {
                return "</tbody></table>\n";
        }
 
@@ -192,7 +194,7 @@ abstract class TablePager extends IndexPager {
                        $formatted = strval( $this->formatValue( $field, $value ) );
 
                        if ( $formatted == '' ) {
-                               $formatted = '&#160;';
+                               $formatted = "\u{00A0}";
                        }
 
                        $s .= Html::rawElement( 'td', $this->getCellAttrs( $field, $value ), $formatted ) . "\n";
@@ -298,7 +300,6 @@ abstract class TablePager extends IndexPager {
                $types = [ 'first', 'prev', 'next', 'last' ];
 
                $queries = $this->getPagingQueries();
-               $links = [];
 
                $buttons = [];
 
@@ -311,6 +312,9 @@ abstract class TablePager extends IndexPager {
                                // * table_pager_prev
                                // * table_pager_next
                                // * table_pager_last
+                               'classes' => [ 'TablePager-button-' . $type ],
+                               'flags' => [ 'progressive' ],
+                               'framed' => false,
                                'label' => $this->msg( 'table_pager_' . $type )->text(),
                                'href' => $queries[ $type ] ?
                                        $title->getLinkURL( $queries[ $type ] + $this->getDefaultQuery() ) :