Esempio n. 1
0
     $challenge = Challenge::getChallenge($challenge_id);
     foreach ($challenge->getWinners() as $winner) {
         $winner->doRemove();
     }
     $challenge->doRemove("Deleted challenge successfully.");
     break;
 case 'add':
     $winner = new ChallengeWinner(array('team' => $team_id, 'challenge' => $challenge_id));
     $winner->doAdd("Added challenge winner successfully.");
     break;
 case 'remove':
     $winner = ChallengeWinner::getChallengeWinner($winner_id);
     $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.");
             }
         }
     }
Esempio n. 2
0
 private function isDBRecordEditable()
 {
     return Session::currentTeam() && Session::currentTeam()->getID() == $this->getTeamID() || Session::defaultPosition() >= POSITION_ADMIN;
 }