r99841 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99840‎ | r99841 | r99842 >
Date:02:32, 15 October 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
docs++
Modified paths:
  • /trunk/extensions/Contest/includes/ContestDBObject.php (modified) (history)
  • /trunk/extensions/Contest/includes/ContestUtils.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestPage.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestSignup.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestWelcome.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestant.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialEditContest.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialMyContests.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/specials/SpecialMyContests.php
@@ -52,6 +52,14 @@
5353 }
5454 }
5555
 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+ */
5664 protected function displayContestsOverview() {
5765 $contestants = ContestContestant::s()->select(
5866 array( 'id', 'contest_id', 'challenge_id' ),
@@ -115,6 +123,14 @@
116124 }
117125 }
118126
 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+ */
119135 protected function displayRunningContests( array /* of ContestContestant */ $contestants, array /* Contest */ $contests ) {
120136 $out = $this->getOutput();
121137
@@ -162,6 +178,14 @@
163179 $out->addHTML( '</table>' );
164180 }
165181
 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+ */
166190 protected function displayPassedContests( array /* of ContestContestant */ $contestants, array /* Contest */ $contests ) {
167191 $out = $this->getOutput();
168192
Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php
@@ -113,6 +113,13 @@
114114 $this->addContestJS( $contest );
115115 }
116116
 117+ /**
 118+ * Output the needed JS data.
 119+ *
 120+ * @since 0.1
 121+ *
 122+ * @param Contest $contest
 123+ */
117124 protected function addContestJS( Contest $contest ) {
118125 $challenges = array();
119126
@@ -132,6 +139,13 @@
133140 );
134141 }
135142
 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+ */
136150 protected function showNoJSFallback( Contest $contest ) {
137151 $out = $this->getOutput();
138152
Index: trunk/extensions/Contest/specials/SpecialContestPage.php
@@ -109,7 +109,7 @@
110110 *
111111 * @return array
112112 */
113 - protected static function getNavigationLinks( $contestName, $user, $exclude = false ) {
 113+ protected static function getNavigationLinks( $contestName, User $user, $exclude = false ) {
114114 $pages = array();
115115
116116 $pages['contest-nav-contests'] = array( 'Contests' );
@@ -149,7 +149,17 @@
150150 return $links;
151151 }
152152
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 ) {
154164 $links = self::getNavigationLinks( $contestName, $user, $exclude );
155165 return Html::rawElement( 'p', array(), $lang->pipeList( $links ) );
156166 }
@@ -158,6 +168,8 @@
159169 * Display navigation links.
160170 *
161171 * @since 0.1
 172+ *
 173+ * @param string|null $subPage
162174 */
163175 protected function displayNavigation( $subPage = null ) {
164176 if ( is_null( $subPage ) ) {
Index: trunk/extensions/Contest/specials/SpecialContestant.php
@@ -97,6 +97,14 @@
9898 return $success;
9999 }
100100
 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+ */
101109 protected function showPage( ContestContestant $contestant ) {
102110 global $wgScript;
103111 $out = $this->getOutput();
Index: trunk/extensions/Contest/specials/SpecialContestSignup.php
@@ -292,7 +292,7 @@
293293
294294 /**
295295 * HTMLForm field validation-callback for name field.
296 - *
 296+ * 1
297297 * @since 0.1
298298 *
299299 * @param $value String
Index: trunk/extensions/Contest/specials/SpecialEditContest.php
@@ -291,6 +291,17 @@
292292 }
293293 }
294294
 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+ */
295306 protected function removeDeletedChallenges( $idString ) {
296307 if ( $idString == '' ) {
297308 return true;
@@ -299,6 +310,14 @@
300311 return ContestChallenge::s()->delete( array( 'id' => explode( '|', $idString ) ) );
301312 }
302313
 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+ */
303322 protected function getSubmittedChallenges() {
304323 $challenges = array();
305324
Index: trunk/extensions/Contest/includes/ContestDBObject.php
@@ -214,6 +214,13 @@
215215 return $data;
216216 }
217217
 218+ /**
 219+ * Load the default values, via getDefaults.
 220+ *
 221+ * @since 0.1
 222+ *
 223+ * @param boolean $override
 224+ */
218225 public function loadDefaults( $override = true ) {
219226 $this->setFields( $this->getDefaults(), $override );
220227 }
@@ -648,6 +655,18 @@
649656 );
650657 }
651658
 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+ */
652671 public function update( array $values, array $conditions = array() ) {
653672 $dbw = wfGetDB( DB_MASTER );
654673
Index: trunk/extensions/Contest/includes/ContestUtils.php
@@ -67,4 +67,5 @@
6868
6969 return $text;
7070 }
 71+
7172 }

Status & tagging log