MediaWiki  REL1_24
AlphabeticPager.php
Go to the documentation of this file.
00001 <?php
00028 abstract class AlphabeticPager extends IndexPager {
00029 
00036     function getNavigationBar() {
00037         if ( !$this->isNavigationBarShown() ) {
00038             return '';
00039         }
00040 
00041         if ( isset( $this->mNavigationBar ) ) {
00042             return $this->mNavigationBar;
00043         }
00044 
00045         $linkTexts = array(
00046             'prev' => $this->msg( 'prevn' )->numParams( $this->mLimit )->escaped(),
00047             'next' => $this->msg( 'nextn' )->numParams( $this->mLimit )->escaped(),
00048             'first' => $this->msg( 'page_first' )->escaped(),
00049             'last' => $this->msg( 'page_last' )->escaped()
00050         );
00051 
00052         $lang = $this->getLanguage();
00053 
00054         $pagingLinks = $this->getPagingLinks( $linkTexts );
00055         $limitLinks = $this->getLimitLinks();
00056         $limits = $lang->pipeList( $limitLinks );
00057 
00058         $this->mNavigationBar = $this->msg( 'parentheses' )->rawParams(
00059             $lang->pipeList( array( $pagingLinks['first'],
00060             $pagingLinks['last'] ) ) )->escaped() . " " .
00061             $this->msg( 'viewprevnext' )->rawParams( $pagingLinks['prev'],
00062                 $pagingLinks['next'], $limits )->escaped();
00063 
00064         if ( !is_array( $this->getIndexField() ) ) {
00065             # Early return to avoid undue nesting
00066             return $this->mNavigationBar;
00067         }
00068 
00069         $extra = '';
00070         $first = true;
00071         $msgs = $this->getOrderTypeMessages();
00072         foreach ( array_keys( $msgs ) as $order ) {
00073             if ( $first ) {
00074                 $first = false;
00075             } else {
00076                 $extra .= $this->msg( 'pipe-separator' )->escaped();
00077             }
00078 
00079             if ( $order == $this->mOrderType ) {
00080                 $extra .= $this->msg( $msgs[$order] )->escaped();
00081             } else {
00082                 $extra .= $this->makeLink(
00083                     $this->msg( $msgs[$order] )->escaped(),
00084                     array( 'order' => $order )
00085                 );
00086             }
00087         }
00088 
00089         if ( $extra !== '' ) {
00090             $extra = ' ' . $this->msg( 'parentheses' )->rawParams( $extra )->escaped();
00091             $this->mNavigationBar .= $extra;
00092         }
00093 
00094         return $this->mNavigationBar;
00095     }
00096 
00105     protected function getOrderTypeMessages() {
00106         return null;
00107     }
00108 }