Index: trunk/extensions/Contest/specials/SpecialContest.php |
— | — | @@ -37,4 +37,12 @@ |
38 | 38 | |
39 | 39 | } |
40 | 40 | |
| 41 | + protected function showGeneralInfo( Contest $contest ) { |
| 42 | + |
| 43 | + } |
| 44 | + |
| 45 | + protected function showParticipants( Contest $contest ) { |
| 46 | + |
| 47 | + } |
| 48 | + |
41 | 49 | } |
\ No newline at end of file |
Index: trunk/extensions/Contest/specials/SpecialContests.php |
— | — | @@ -136,11 +136,11 @@ |
137 | 137 | foreach ( $contests as $contest ) { |
138 | 138 | $fields = array(); |
139 | 139 | |
140 | | - if ( $user->isAllowed( 'contestjudge' ) ) { |
| 140 | + if ( $user->isAllowed( 'contestparticipant' ) ) { |
141 | 141 | $name = Html::element( |
142 | 142 | 'a', |
143 | 143 | array( |
144 | | - 'href' => SpecialPage::getTitleFor( 'Contest', $contest->getField( 'name' ) )->getLocalURL() |
| 144 | + 'href' => SpecialPage::getTitleFor( 'ContestWelcome', $contest->getField( 'name' ) )->getLocalURL() |
145 | 145 | ), |
146 | 146 | $contest->getField( 'name' ) |
147 | 147 | ); |
Index: trunk/extensions/Contest/Contest.php |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | $wgAutoloadClasses['ApiDeleteContest'] = dirname( __FILE__ ) . '/api/ApiDeleteContest.php'; |
54 | 54 | |
55 | 55 | $wgAutoloadClasses['Contest'] = dirname( __FILE__ ) . '/includes/Contest.class.php'; |
| 56 | +$wgAutoloadClasses['ContestantPager'] = dirname( __FILE__ ) . '/includes/ContestantPager.php'; |
56 | 57 | $wgAutoloadClasses['ContestChallange'] = dirname( __FILE__ ) . '/includes/ContestChallange.php'; |
57 | 58 | $wgAutoloadClasses['ContestComment'] = dirname( __FILE__ ) . '/includes/ContestComment.php'; |
58 | 59 | $wgAutoloadClasses['ContestContestant'] = dirname( __FILE__ ) . '/includes/ContestContestant.php'; |
Index: trunk/extensions/Contest/includes/ContestantPager.php |
— | — | @@ -0,0 +1,88 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Contestant pager, for on Special:Contestants |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file ContestantPager.php |
| 10 | + * @ingroup Contest |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class ContestantPager extends TablePager { |
| 16 | + |
| 17 | + protected $conds; |
| 18 | + protected $page; |
| 19 | + |
| 20 | + public function __construct( $page, $conds ) { |
| 21 | + $this->page = $page; |
| 22 | + $this->conds = $conds; |
| 23 | + $this->mDefaultDirection = true; |
| 24 | + |
| 25 | + parent::__construct(); |
| 26 | + } |
| 27 | + |
| 28 | + public function getFieldNames() { |
| 29 | + static $headers = null; |
| 30 | + |
| 31 | + if ( is_null( $headers ) ) { |
| 32 | + $headers = array( |
| 33 | + 'contestant_id' => 'contest-contestant-id', |
| 34 | + 'contestant_volunteer' => 'contest-contestant-volunteer', |
| 35 | + 'contestant_wmf' => 'contest-contestant-wmf', |
| 36 | + ); |
| 37 | + |
| 38 | + $headers = array_map( 'wfMsg', $headers ); |
| 39 | + } |
| 40 | + |
| 41 | + return $headers; |
| 42 | + } |
| 43 | + |
| 44 | + public function formatValue( $name, $value ) { |
| 45 | + return $value; |
| 46 | + } |
| 47 | + |
| 48 | + function getQueryInfo() { |
| 49 | + $info = array( |
| 50 | + 'tables' => array( 'contest_contestants' ), |
| 51 | + 'fields' => array( |
| 52 | + 'contestant_id', |
| 53 | + 'contestant_volunteer', |
| 54 | + 'contestant_wmf', |
| 55 | + ), |
| 56 | + 'conds' => $this->conds, |
| 57 | + ); |
| 58 | + |
| 59 | + return $info; |
| 60 | + } |
| 61 | + |
| 62 | + public function getTableClass(){ |
| 63 | + return 'TablePager contest-contestants'; |
| 64 | + } |
| 65 | + |
| 66 | + function getIndexField() { |
| 67 | + return 'contestant_id'; |
| 68 | + } |
| 69 | + |
| 70 | + function getDefaultSort() { |
| 71 | + return 'contestant_id'; |
| 72 | + } |
| 73 | + |
| 74 | + function isFieldSortable( $name ) { |
| 75 | + return in_array( |
| 76 | + $name, |
| 77 | + array( |
| 78 | + 'contestant_id', |
| 79 | + 'contestant_volunteer', |
| 80 | + 'contestant_wmf' |
| 81 | + ) |
| 82 | + ); |
| 83 | + } |
| 84 | + |
| 85 | + function getTitle() { |
| 86 | + return $this->page->getTitle(); |
| 87 | + } |
| 88 | + |
| 89 | +} |
Property changes on: trunk/extensions/Contest/includes/ContestantPager.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 90 | + native |
Index: trunk/extensions/Contest/includes/Contest.class.php |
— | — | @@ -158,4 +158,18 @@ |
159 | 159 | ); |
160 | 160 | } |
161 | 161 | |
| 162 | + /** |
| 163 | + * Gets the contestants for this contest. |
| 164 | + * |
| 165 | + * @since 0.1 |
| 166 | + * |
| 167 | + * @return array of ContestContestant |
| 168 | + */ |
| 169 | + public function getContestants() { |
| 170 | + return ContestContestant::s()->select( |
| 171 | + null, |
| 172 | + array( 'contest_id' => $this->getId() ) |
| 173 | + ); |
| 174 | + } |
| 175 | + |
162 | 176 | } |
\ No newline at end of file |