public function emailWinner($sweepstakeId, $userId)
 {
     $this->sweepstakeId = $sweepstakeId;
     $this->setCurrentState(self::$STATE__EMAIL_SENT);
     $sweepstakeData = Sweepstake_table::getSweepstakeById($this->sweepstakeId);
     $userFbData = FbUser_table::getUser($userId);
     mail($userFbData["email"], "You become winner in " . $sweepstakeData["title"], $sweepstakeData["winner_message"], "Content-type: text/html; charset=UTF-8");
 }
 public function getCurrentSweepstakeData()
 {
     return Sweepstake_table::getSweepstakeById($this->sweepstakeId);
 }
 public function remove($id)
 {
     $this->setCurrentState(self::$STATE__SHOW_LIST);
     Sweepstake_table::deleteSweepstake($id);
 }
 public function passive($seepstakeId)
 {
     $this->sweepstakeId = $seepstakeId;
     $this->setCurrentState(self::$STATE__PASSIVE);
     Sweepstake_table::updateSweepstake($this->sweepstakeId, array("active" => 0));
 }