unused local var
[lhc/web/wiklou.git] / includes / SpecialCategories.php
1 <?php
2 /**
3 *
4 * @addtogroup SpecialPage
5 */
6
7 function wfSpecialCategories() {
8 global $wgOut;
9
10 $cap = new CategoryPager();
11 $wgOut->addHTML(
12 wfMsgWikiHtml( 'categoriespagetext' ) .
13 $cap->getNavigationBar()
14 . '<ul>' . $cap->getBody() . '</ul>' .
15 $cap->getNavigationBar()
16 );
17 }
18
19 class CategoryPager extends AlphabeticPager {
20 function getQueryInfo() {
21 return array(
22 'tables' => array('categorylinks'),
23 'fields' => array('cl_to','count(*) count'),
24 'options' => array('GROUP BY' => 'cl_to')
25 );
26 }
27
28 function getIndexField() {
29 return "cl_to";
30 }
31
32 /* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
33 function getBody() {
34 if (!$this->mQueryDone) {
35 $this->doQuery();
36 }
37 $batch = new LinkBatch;
38
39 $this->mResult->rewind();
40
41 while ( $row = $this->mResult->fetchObject() ) {
42 $batch->addObj( Title::makeTitleSafe( NS_CATEGORY, $row->cl_to ) );
43 }
44 $batch->execute();
45 $this->mResult->rewind();
46 return parent::getBody();
47 }
48
49 function formatRow($result) {
50 global $wgLang;
51 $title = Title::makeTitle( NS_CATEGORY, $result->cl_to );
52 return (
53 '<li>' .
54 $this->getSkin()->makeLinkObj( $title, $title->getText() )
55 . ' ' .
56 wfMsgExt( 'nmembers', array( 'parsemag', 'escape'),
57 $wgLang->formatNum( $result->count ) )
58 . "</li>\n" );
59 }
60 }
61
62 ?>