r98532 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98531‎ | r98532 | r98533 >
Date:15:57, 30 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added detection of contestants to signup page and redirect to their submission stuff
Modified paths:
  • /trunk/extensions/Contest/specials/SpecialContestSignup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/specials/SpecialContestSignup.php
@@ -87,11 +87,26 @@
8888 $out->returnToMain();
8989 }
9090 else {
91 - // TODO: we might want to have a title field here
92 - $out->setPageTitle( $contest->getField( 'name' ) );
93 - $out->addWikiMsg( 'contest-signup-header', $contest->getField( 'name' ) );
 91+ // Check if the user is already a contestant in this contest.
 92+ // If he is, reirect to submission page, else show signup form.
 93+ $contestant = ContestContestant::s()->selectRow(
 94+ 'id',
 95+ array(
 96+ 'contest_id' => $contest->getId(),
 97+ 'user_id' => $this->getUser()->getId()
 98+ )
 99+ );
94100
95 - $this->showSignupForm( $contest );
 101+ if ( $contestant === false ) {
 102+ // TODO: we might want to have a title field here
 103+ $out->setPageTitle( $contest->getField( 'name' ) );
 104+ $out->addWikiMsg( 'contest-signup-header', $contest->getField( 'name' ) );
 105+
 106+ $this->showSignupForm( $contest );
 107+ }
 108+ else {
 109+ $out->redirect( SpecialPage::getTitleFor( 'ContestSubmission', $contestName )->getLocalURL() );
 110+ }
96111 }
97112 }
98113

Status & tagging log