MediaWiki  1.27.2
AlphabeticPager.php
Go to the documentation of this file.
1 <?php
28 abstract class AlphabeticPager extends IndexPager {
29 
36  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 }
getLanguage()
Get the Language object.
getIndexField()
This function should be overridden to return the name of the index fi- eld.
if(!isset($args[0])) $lang
IndexPager with an alphabetic list and a formatted navigation bar.
IndexPager is an efficient pager which uses a (roughly unique) index in the data set to implement pag...
Definition: IndexPager.php:66
msg()
Get a Message object with context set Parameters are the same as wfMessage()
isNavigationBarShown()
Returns whether to show the "navigation bar".
Definition: IndexPager.php:603
makeLink($text, array $query=null, $type=null)
Make a self-link.
Definition: IndexPager.php:461
getPagingLinks($linkTexts, $disabledTexts=[])
Get paging links.
Definition: IndexPager.php:621
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
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...