MediaWiki REL1_37
AlphabeticPager.php
Go to the documentation of this file.
1<?php
29abstract class AlphabeticPager extends IndexPager {
30
39 public function getNavigationBar() {
40 if ( !$this->isNavigationBarShown() ) {
41 return '';
42 }
43
44 if ( isset( $this->mNavigationBar ) ) {
46 }
47
48 $linkTexts = [
49 'prev' => $this->msg( 'prevn' )->numParams( $this->mLimit )->escaped(),
50 'next' => $this->msg( 'nextn' )->numParams( $this->mLimit )->escaped(),
51 'first' => $this->msg( 'page_first' )->escaped(),
52 'last' => $this->msg( 'page_last' )->escaped()
53 ];
54
55 $lang = $this->getLanguage();
56
57 $pagingLinks = $this->getPagingLinks( $linkTexts );
58 $limitLinks = $this->getLimitLinks();
59 $limits = $lang->pipeList( $limitLinks );
60
61 $this->mNavigationBar = $this->msg( 'parentheses' )->rawParams(
62 $lang->pipeList( [ $pagingLinks['first'],
63 $pagingLinks['last'] ] ) )->escaped() . " " .
64 $this->msg( 'viewprevnext' )->rawParams( $pagingLinks['prev'],
65 $pagingLinks['next'], $limits )->escaped();
66
67 if ( !is_array( $this->getIndexField() ) ) {
68 # Early return to avoid undue nesting
70 }
71
72 $extra = '';
73 $msgs = $this->getOrderTypeMessages();
74 foreach ( $msgs as $order => $msg ) {
75 if ( $extra !== '' ) {
76 $extra .= $this->msg( 'pipe-separator' )->escaped();
77 }
78
79 if ( $order == $this->mOrderType ) {
80 $extra .= $this->msg( $msg )->escaped();
81 } else {
82 $extra .= $this->makeLink(
83 $this->msg( $msg )->escaped(),
84 [ 'order' => $order ]
85 );
86 }
87 }
88
89 if ( $extra !== '' ) {
90 $extra = ' ' . $this->msg( 'parentheses' )->rawParams( $extra )->escaped();
91 $this->mNavigationBar .= $extra;
92 }
93
95 }
96
107 protected function getOrderTypeMessages() {
108 return null;
109 }
110}
IndexPager with an alphabetic list and a formatted navigation bar.
getOrderTypeMessages()
If this supports multiple order type messages, give the message key for enabling each one in getNavig...
getNavigationBar()
Shamelessly stolen bits from ReverseChronologicalPager, didn't want to do class magic as may be still...
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
IndexPager is an efficient pager which uses a (roughly unique) index in the data set to implement pag...
makeLink( $text, array $query=null, $type=null)
Make a self-link.
string $mNavigationBar
getPagingLinks( $linkTexts, $disabledTexts=[])
Get paging links.
isNavigationBarShown()
Returns whether to show the "navigation bar".
getIndexField()
Returns the name of the index field.
if(!isset( $args[0])) $lang