Index: trunk/extensions/Contest/includes/ContestantPager.php |
— | — | @@ -13,16 +13,32 @@ |
14 | 14 | */ |
15 | 15 | class ContestantPager extends TablePager { |
16 | 16 | |
| 17 | + /** |
| 18 | + * Query conditions, full field names (ie inc prefix). |
| 19 | + * @var array |
| 20 | + */ |
17 | 21 | protected $conds; |
18 | 22 | |
19 | 23 | /** |
| 24 | + * Special page on which the pager is displayed. |
20 | 25 | * @var SpecialContestPage |
21 | 26 | */ |
22 | 27 | protected $page; |
23 | 28 | |
| 29 | + /** |
| 30 | + * Cache for challenge titles. |
| 31 | + * challenge id => challenge title |
| 32 | + * @var array |
| 33 | + */ |
24 | 34 | protected $challengeTitles = array(); |
25 | 35 | |
26 | | - public function __construct( $page, $conds ) { |
| 36 | + /** |
| 37 | + * Constructor. |
| 38 | + * |
| 39 | + * @param SpecialContestPage $page |
| 40 | + * @param array $conds |
| 41 | + */ |
| 42 | + public function __construct( SpecialContestPage $page, array $conds ) { |
27 | 43 | $this->page = $page; |
28 | 44 | $this->conds = $conds; |
29 | 45 | $this->mDefaultDirection = true; |
— | — | @@ -35,7 +51,16 @@ |
36 | 52 | $this->getOutput()->addModules( 'contest.contestant.pager' ); |
37 | 53 | } |
38 | 54 | |
39 | | - protected function queryChallengeTitles( $allConds ) { |
| 55 | + /** |
| 56 | + * Query all challenge names we might need, |
| 57 | + * based on the queries conditions, and set them |
| 58 | + * to the challengeTitles field. |
| 59 | + * |
| 60 | + * @since 0.1 |
| 61 | + * |
| 62 | + * @param array $allConds |
| 63 | + */ |
| 64 | + protected function queryChallengeTitles( array $allConds ) { |
40 | 65 | $conds = array(); |
41 | 66 | |
42 | 67 | if ( array_key_exists( 'contestant_contest_id', $allConds ) ) { |
— | — | @@ -51,6 +76,14 @@ |
52 | 77 | } |
53 | 78 | } |
54 | 79 | |
| 80 | + /** |
| 81 | + * Gets the title of a challenge given it's id. |
| 82 | + * |
| 83 | + * @since 0.1 |
| 84 | + * |
| 85 | + * @param integer $challengeId |
| 86 | + * @throws MWException |
| 87 | + */ |
55 | 88 | protected function getChallengeTitle( $challengeId ) { |
56 | 89 | if ( array_key_exists( $challengeId, $this->challengeTitles ) ) { |
57 | 90 | return $this->challengeTitles[$challengeId]; |