Fix regression in even sizing of diff columns; forgot to restore a couple bits I...
[mediawiki.git] / includes / SpecialCategories.php
blobfd3a51ebfd29ead9c13a57c49d027703bba81087
1 <?php
2 /**
4 * @addtogroup SpecialPage
5 */
7 function wfSpecialCategories() {
8 global $wgOut;
10 $cap = new CategoryPager();
11 $wgOut->addHTML(
12 wfMsgWikiHtml( 'categoriespagetext' ) .
13 $cap->getNavigationBar()
14 . '<ul>' . $cap->getBody() . '</ul>' .
15 $cap->getNavigationBar()
19 /**
20 * @addtogroup SpecialPage
21 * @addtogroup Pager
23 class CategoryPager extends AlphabeticPager {
24 function getQueryInfo() {
25 return array(
26 'tables' => array('categorylinks'),
27 'fields' => array('cl_to','count(*) AS count'),
28 'options' => array('GROUP BY' => 'cl_to')
32 function getIndexField() {
33 return "cl_to";
36 /* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
37 function getBody() {
38 if (!$this->mQueryDone) {
39 $this->doQuery();
41 $batch = new LinkBatch;
43 $this->mResult->rewind();
45 while ( $row = $this->mResult->fetchObject() ) {
46 $batch->addObj( Title::makeTitleSafe( NS_CATEGORY, $row->cl_to ) );
48 $batch->execute();
49 $this->mResult->rewind();
50 return parent::getBody();
53 function formatRow($result) {
54 global $wgLang;
55 $title = Title::makeTitle( NS_CATEGORY, $result->cl_to );
56 $titleText = $this->getSkin()->makeLinkObj( $title, htmlspecialchars( $title->getText() ) );
57 $count = wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
58 $wgLang->formatNum( $result->count ) );
59 return Xml::tags('li', null, "$titleText ($count)" ) . "\n";