Index: trunk/extensions/Contest/specials/SpecialMyContests.php |
— | — | @@ -52,6 +52,14 @@ |
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
| 56 | + /** |
| 57 | + * On regular page view, ie no submission and no sub-page, |
| 58 | + * display a list of all contests the user is participating in, |
| 59 | + * or in case there is only one, redirect them to the submissiom |
| 60 | + * UI of it. |
| 61 | + * |
| 62 | + * @since 0.1 |
| 63 | + */ |
56 | 64 | protected function displayContestsOverview() { |
57 | 65 | $contestants = ContestContestant::s()->select( |
58 | 66 | array( 'id', 'contest_id', 'challenge_id' ), |
— | — | @@ -115,6 +123,14 @@ |
116 | 124 | } |
117 | 125 | } |
118 | 126 | |
| 127 | + /** |
| 128 | + * Display a table with the running (active) contests for this user. |
| 129 | + * |
| 130 | + * @since 0.1 |
| 131 | + * |
| 132 | + * @param array $contestants |
| 133 | + * @param array $contests |
| 134 | + */ |
119 | 135 | protected function displayRunningContests( array /* of ContestContestant */ $contestants, array /* Contest */ $contests ) { |
120 | 136 | $out = $this->getOutput(); |
121 | 137 | |
— | — | @@ -162,6 +178,14 @@ |
163 | 179 | $out->addHTML( '</table>' ); |
164 | 180 | } |
165 | 181 | |
| 182 | + /** |
| 183 | + * Display a table with the passed (finished) contests for this user. |
| 184 | + * |
| 185 | + * @since 0.1 |
| 186 | + * |
| 187 | + * @param array $contestants |
| 188 | + * @param array $contests |
| 189 | + */ |
166 | 190 | protected function displayPassedContests( array /* of ContestContestant */ $contestants, array /* Contest */ $contests ) { |
167 | 191 | $out = $this->getOutput(); |
168 | 192 | |
Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php |
— | — | @@ -113,6 +113,13 @@ |
114 | 114 | $this->addContestJS( $contest ); |
115 | 115 | } |
116 | 116 | |
| 117 | + /** |
| 118 | + * Output the needed JS data. |
| 119 | + * |
| 120 | + * @since 0.1 |
| 121 | + * |
| 122 | + * @param Contest $contest |
| 123 | + */ |
117 | 124 | protected function addContestJS( Contest $contest ) { |
118 | 125 | $challenges = array(); |
119 | 126 | |
— | — | @@ -132,6 +139,13 @@ |
133 | 140 | ); |
134 | 141 | } |
135 | 142 | |
| 143 | + /** |
| 144 | + * Output fallback code for people that have JS disabled or have a crappy browser. |
| 145 | + * |
| 146 | + * @since 0.1 |
| 147 | + * |
| 148 | + * @param Contest $contest |
| 149 | + */ |
136 | 150 | protected function showNoJSFallback( Contest $contest ) { |
137 | 151 | $out = $this->getOutput(); |
138 | 152 | |
Index: trunk/extensions/Contest/specials/SpecialContestPage.php |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | * |
111 | 111 | * @return array |
112 | 112 | */ |
113 | | - protected static function getNavigationLinks( $contestName, $user, $exclude = false ) { |
| 113 | + protected static function getNavigationLinks( $contestName, User $user, $exclude = false ) { |
114 | 114 | $pages = array(); |
115 | 115 | |
116 | 116 | $pages['contest-nav-contests'] = array( 'Contests' ); |
— | — | @@ -149,7 +149,17 @@ |
150 | 150 | return $links; |
151 | 151 | } |
152 | 152 | |
153 | | - public static function getNavigation( $contestName, $user, $lang, $exclude = false ) { |
| 153 | + /** |
| 154 | + * Get the navigation links for the specified contest in a pipe-separated list. |
| 155 | + * |
| 156 | + * @since 0.1 |
| 157 | + * |
| 158 | + * @param string $contestName |
| 159 | + * @param User $user |
| 160 | + * @param Language $lang |
| 161 | + * @param boolean $exclude |
| 162 | + */ |
| 163 | + public static function getNavigation( $contestName, User $user, Language $lang, $exclude = false ) { |
154 | 164 | $links = self::getNavigationLinks( $contestName, $user, $exclude ); |
155 | 165 | return Html::rawElement( 'p', array(), $lang->pipeList( $links ) ); |
156 | 166 | } |
— | — | @@ -158,6 +168,8 @@ |
159 | 169 | * Display navigation links. |
160 | 170 | * |
161 | 171 | * @since 0.1 |
| 172 | + * |
| 173 | + * @param string|null $subPage |
162 | 174 | */ |
163 | 175 | protected function displayNavigation( $subPage = null ) { |
164 | 176 | if ( is_null( $subPage ) ) { |
Index: trunk/extensions/Contest/specials/SpecialContestant.php |
— | — | @@ -97,6 +97,14 @@ |
98 | 98 | return $success; |
99 | 99 | } |
100 | 100 | |
| 101 | + /** |
| 102 | + * Show the actual page, conisting of the navigation, the summary and |
| 103 | + * the rating and voting controls. |
| 104 | + * |
| 105 | + * @since 0.1 |
| 106 | + * |
| 107 | + * @param ContestContestant $contestant |
| 108 | + */ |
101 | 109 | protected function showPage( ContestContestant $contestant ) { |
102 | 110 | global $wgScript; |
103 | 111 | $out = $this->getOutput(); |
Index: trunk/extensions/Contest/specials/SpecialContestSignup.php |
— | — | @@ -292,7 +292,7 @@ |
293 | 293 | |
294 | 294 | /** |
295 | 295 | * HTMLForm field validation-callback for name field. |
296 | | - * |
| 296 | + * 1 |
297 | 297 | * @since 0.1 |
298 | 298 | * |
299 | 299 | * @param $value String |
Index: trunk/extensions/Contest/specials/SpecialEditContest.php |
— | — | @@ -291,6 +291,17 @@ |
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
| 295 | + /** |
| 296 | + * The UI keeps track of 'removed' challenges by storing them into a |
| 297 | + * hidden HTML input, pipe-separated. On submission, this method |
| 298 | + * takes this string and actually deletes them. |
| 299 | + * |
| 300 | + * @since 0.1 |
| 301 | + * |
| 302 | + * @param string $idString |
| 303 | + * |
| 304 | + * @return boolean Success indicator |
| 305 | + */ |
295 | 306 | protected function removeDeletedChallenges( $idString ) { |
296 | 307 | if ( $idString == '' ) { |
297 | 308 | return true; |
— | — | @@ -299,6 +310,14 @@ |
300 | 311 | return ContestChallenge::s()->delete( array( 'id' => explode( '|', $idString ) ) ); |
301 | 312 | } |
302 | 313 | |
| 314 | + /** |
| 315 | + * Finds the submitted challanges and returns them as a list of |
| 316 | + * ContestChallenge objects. |
| 317 | + * |
| 318 | + * @since 0.1 |
| 319 | + * |
| 320 | + * @return array of ContestChallenge |
| 321 | + */ |
303 | 322 | protected function getSubmittedChallenges() { |
304 | 323 | $challenges = array(); |
305 | 324 | |
Index: trunk/extensions/Contest/includes/ContestDBObject.php |
— | — | @@ -214,6 +214,13 @@ |
215 | 215 | return $data; |
216 | 216 | } |
217 | 217 | |
| 218 | + /** |
| 219 | + * Load the default values, via getDefaults. |
| 220 | + * |
| 221 | + * @since 0.1 |
| 222 | + * |
| 223 | + * @param boolean $override |
| 224 | + */ |
218 | 225 | public function loadDefaults( $override = true ) { |
219 | 226 | $this->setFields( $this->getDefaults(), $override ); |
220 | 227 | } |
— | — | @@ -648,6 +655,18 @@ |
649 | 656 | ); |
650 | 657 | } |
651 | 658 | |
| 659 | + /** |
| 660 | + * Update the records matching the provided conditions by |
| 661 | + * setting the fields that are keys in the $values patam to |
| 662 | + * their corresponding values. |
| 663 | + * |
| 664 | + * @since 0.1 |
| 665 | + * |
| 666 | + * @param array $values |
| 667 | + * @param array $conditions |
| 668 | + * |
| 669 | + * @return boolean Success indicator |
| 670 | + */ |
652 | 671 | public function update( array $values, array $conditions = array() ) { |
653 | 672 | $dbw = wfGetDB( DB_MASTER ); |
654 | 673 | |
Index: trunk/extensions/Contest/includes/ContestUtils.php |
— | — | @@ -67,4 +67,5 @@ |
68 | 68 | |
69 | 69 | return $text; |
70 | 70 | } |
| 71 | + |
71 | 72 | } |