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 * TODO: Allow sorting by count. We need to have a unique index to do this
23 * @addtogroup SpecialPage
26 class CategoryPager
extends AlphabeticPager
{
27 function getQueryInfo() {
30 'tables' => array( 'category' ),
31 'fields' => array( 'cat_title','cat_pages' ),
32 'conds' => array( 'cat_pages > 0' )
36 function getIndexField() {
37 # return array( 'abc' => 'cat_title', 'count' => 'cat_pages' );
41 # protected function getOrderTypeMessages() {
42 # return array( 'abc' => 'special-categories-sort-abc',
43 # 'count' => 'special-categories-sort-count' );
46 protected function getDefaultDirections() {
47 # return array( 'abc' => false, 'count' => true );
51 /* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
52 public function getBody() {
53 if (!$this->mQueryDone
) {
56 $batch = new LinkBatch
;
58 $this->mResult
->rewind();
60 while ( $row = $this->mResult
->fetchObject() ) {
61 $batch->addObj( Title
::makeTitleSafe( NS_CATEGORY
, $row->cat_title
) );
64 $this->mResult
->rewind();
65 return parent
::getBody();
68 function formatRow($result) {
70 $title = Title
::makeTitle( NS_CATEGORY
, $result->cat_title
);
71 $titleText = $this->getSkin()->makeLinkObj( $title, htmlspecialchars( $title->getText() ) );
72 $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape' ),
73 $wgLang->formatNum( $result->cat_pages
) );
74 return Xml
::tags('li', null, "$titleText ($count)" ) . "\n";