$winner->doRemove("Deleted challenge winner successfully."); break; case 'claim': $team = Session::currentTeam(); $challenge = Challenge::getChallengeByCode($code); if (!$team) { add_notification('You cannot claim a challenge if you have no team.'); } else { if (!$challenge) { add_notification('No challenge with this code found. If you think you received this message in error, bring your code to a coordinator in person.'); } else { if ($challenge->getWinners()) { add_notification('Someone else has already claimed the code you entered.'); } else { $winner = new ChallengeWinner(array('team' => $team->getID(), 'challenge' => $challenge->getID())); $winner->doAdd("Claimed code successfully."); } } } } // VIEW $page = new UIPage(); function challenge_claim_form() { return <<<EOT <form method="POST" action="challenges.php"> Enter Claim Code: <input type="text" name="code" /> <input type="submit" name="claim" value="Claim!" /> </form> EOT; }