/**
  * Handle form submission.
  *
  * @since 0.1
  *
  * @param array $data
  *
  * @return true|array
  */
 public function handleSubmission(array $data)
 {
     $user = $this->getUser();
     $oldEmail = $user->getEmail();
     if ($oldEmail !== $data['contestant-email']) {
         $user->setEmail($data['contestant-email']);
         $user->invalidateEmail();
         $user->sendConfirmationMail($oldEmail == '' ? 'set' : 'changed');
     }
     $user->setRealName($data['contestant-realname']);
     $user->saveSettings();
     $contestant = new ContestContestant(array('contest_id' => $data['contest-id'], 'user_id' => $user->getId(), 'challenge_id' => $data['contestant-challengeid'], 'full_name' => $data['contestant-realname'], 'user_name' => $user->getName(), 'email' => $data['contestant-email'], 'country' => $data['contestant-country'], 'volunteer' => $data['contestant-volunteer'], 'wmf' => $data['contestant-wmf']));
     return $contestant->writeToDB();
 }
 /**
  * (non-PHPdoc)
  * @see ContestDBObject::writeToDB()
  * @return bool
  */
 public function writeToDB()
 {
     $success = parent::writeToDB();
     if ($success) {
         $contestant = new ContestContestant(array('id' => $this->getField('contestant_id')));
         $contestant->updateVotes();
         $contestant->writeToDB();
     }
     return $success;
 }
 /**
  * Handle form submission.
  *
  * @since 0.1
  *
  * @param array $data
  *
  * @return true|array
  */
 public function handleSubmission(array $data)
 {
     $user = $this->getUser();
     $oldEmail = $user->getEmail();
     if ($oldEmail !== $data['contestant-email']) {
         $user->setEmail($data['contestant-email']);
         $user->invalidateEmail();
         $user->sendConfirmationMail($oldEmail == '' ? 'set' : 'changed');
     }
     $user->setRealName($data['contestant-realname']);
     $user->saveSettings();
     $contestant = new ContestContestant(array('id' => $data['contestant-id'], 'challenge_id' => $data['contestant-challengeid'], 'full_name' => $data['contestant-realname'], 'email' => $data['contestant-email'], 'country' => $data['contestant-country'], 'volunteer' => $data['contestant-volunteer'], 'wmf' => $data['contestant-wmf'], 'cv' => $data['contestant-cv'], 'submission' => trim($data['contestant-submission'])));
     $success = $contestant->writeToDB();
     if ($success) {
         if (trim($data['contestant-previous-submission']) === '' && trim($data['contestant-submission']) !== '') {
             $this->submissionState = 'added';
         } else {
             $this->submissionState = 'updated';
         }
     }
     return $success;
 }