4 * @addtogroup SpecialPage
7 function wfSpecialCategories() {
10 $cap = new CategoryPager();
12 wfMsgExt( 'categoriespagetext', array( 'parse' ) ) .
13 $cap->getNavigationBar()
14 . '<ul>' . $cap->getBody() . '</ul>' .
15 $cap->getNavigationBar()
20 * @addtogroup SpecialPage
23 class CategoryPager
extends AlphabeticPager
{
24 function getQueryInfo() {
27 'tables' => array( 'category' ),
28 'fields' => array( 'cat_title','cat_pages' ),
29 'conds' => array( 'cat_pages > 0' )
33 function getIndexField() {
34 return array( 'abc' => 'cat_title', 'count' => 'cat_pages' );
37 protected function getOrderTypeMessages() {
38 return array( 'abc' => 'special-categories-sort-abc',
39 'count' => 'special-categories-sort-count' );
42 protected function getDefaultDirection() {
43 return array( 'abc' => false, 'count' => true );
46 /* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
47 public function getBody() {
48 if (!$this->mQueryDone
) {
51 $batch = new LinkBatch
;
53 $this->mResult
->rewind();
55 while ( $row = $this->mResult
->fetchObject() ) {
56 $batch->addObj( Title
::makeTitleSafe( NS_CATEGORY
, $row->cat_title
) );
59 $this->mResult
->rewind();
60 return parent
::getBody();
63 function formatRow($result) {
65 $title = Title
::makeTitle( NS_CATEGORY
, $result->cat_title
);
66 $titleText = $this->getSkin()->makeLinkObj( $title, htmlspecialchars( $title->getText() ) );
67 $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
68 $wgLang->formatNum( $result->cat_pages
) );
69 return Xml
::tags('li', null, "$titleText ($count)" ) . "\n";