MediaWiki
REL1_34
AlphabeticPager.php
Go to the documentation of this file.
1
<?php
28
abstract
class
AlphabeticPager
extends
IndexPager
{
29
36
public
function
getNavigationBar
() {
37
if
( !$this->
isNavigationBarShown
() ) {
38
return
''
;
39
}
40
41
if
( isset( $this->mNavigationBar ) ) {
42
return
$this->mNavigationBar
;
43
}
44
45
$linkTexts = [
46
'prev'
=> $this->
msg
(
'prevn'
)->numParams( $this->mLimit )->escaped(),
47
'next'
=> $this->
msg
(
'nextn'
)->numParams( $this->mLimit )->escaped(),
48
'first'
=> $this->
msg
(
'page_first'
)->escaped(),
49
'last'
=> $this->
msg
(
'page_last'
)->escaped()
50
];
51
52
$lang
= $this->
getLanguage
();
53
54
$pagingLinks = $this->
getPagingLinks
( $linkTexts );
55
$limitLinks = $this->
getLimitLinks
();
56
$limits =
$lang
->pipeList( $limitLinks );
57
58
$this->mNavigationBar = $this->
msg
(
'parentheses'
)->rawParams(
59
$lang
->pipeList( [ $pagingLinks[
'first'
],
60
$pagingLinks[
'last'
] ] ) )->escaped() .
" "
.
61
$this->
msg
(
'viewprevnext'
)->rawParams( $pagingLinks[
'prev'
],
62
$pagingLinks[
'next'
], $limits )->escaped();
63
64
if
( !is_array( $this->
getIndexField
() ) ) {
65
# Early return to avoid undue nesting
66
return
$this->mNavigationBar
;
67
}
68
69
$extra =
''
;
70
$first =
true
;
71
$msgs = $this->
getOrderTypeMessages
();
72
foreach
( array_keys( $msgs ) as $order ) {
73
if
( $first ) {
74
$first =
false
;
75
}
else
{
76
$extra .= $this->
msg
(
'pipe-separator'
)->escaped();
77
}
78
79
if
( $order == $this->mOrderType ) {
80
$extra .= $this->
msg
( $msgs[$order] )->escaped();
81
}
else
{
82
$extra .= $this->
makeLink
(
83
$this->
msg
( $msgs[$order] )->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
94
return
$this->mNavigationBar
;
95
}
96
105
protected
function
getOrderTypeMessages
() {
106
return
null
;
107
}
108
}
AlphabeticPager
IndexPager with an alphabetic list and a formatted navigation bar.
Definition
AlphabeticPager.php:28
AlphabeticPager\getOrderTypeMessages
getOrderTypeMessages()
If this supports multiple order type messages, give the message key for enabling each one in getNavig...
Definition
AlphabeticPager.php:105
AlphabeticPager\getNavigationBar
getNavigationBar()
Shamelessly stolen bits from ReverseChronologicalPager, didn't want to do class magic as may be still...
Definition
AlphabeticPager.php:36
ContextSource\msg
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Definition
ContextSource.php:168
ContextSource\getLanguage
getLanguage()
Definition
ContextSource.php:128
IndexPager
IndexPager is an efficient pager which uses a (roughly unique) index in the data set to implement pag...
Definition
IndexPager.php:72
IndexPager\makeLink
makeLink( $text, array $query=null, $type=null)
Make a self-link.
Definition
IndexPager.php:516
IndexPager\$mNavigationBar
string $mNavigationBar
Definition
IndexPager.php:146
IndexPager\getPagingLinks
getPagingLinks( $linkTexts, $disabledTexts=[])
Get paging links.
Definition
IndexPager.php:676
IndexPager\isNavigationBarShown
isNavigationBarShown()
Returns whether to show the "navigation bar".
Definition
IndexPager.php:658
IndexPager\getIndexField
getIndexField()
This function should be overridden to return the name of the index fi- eld.
IndexPager\getLimitLinks
getLimitLinks()
Definition
IndexPager.php:697
$lang
if(!isset( $args[0])) $lang
Definition
testCompression.php:33
includes
pager
AlphabeticPager.php
Generated on Fri Apr 5 2024 23:10:18 for MediaWiki by
1.9.8