예제 #1
0
 private function sendLoserEmail($lottery, \tailgate\Resource\Game $game)
 {
     $variables = $game->getStringVars();
     $tpl = new \Template();
     $tpl->setModuleTemplate('tailgate', 'Admin/Lottery/Loser.html');
     $tpl->addVariables($variables);
     $content = $tpl->get();
     $this->sendEmail('Tailgate unsuccessful', $lottery['student_id'], $content);
 }
예제 #2
0
 public static function getGameStatus(\tailgate\Resource\Game $game)
 {
     $color = null;
     $status = null;
     $gamevars = $game->getStringVars();
     $gameinfo = '<p>' . $gamevars['university'] . '<br />' . $gamevars['mascot'] . '<br />' . $gamevars['kickoff_format'] . '</p>';
     $now = time();
     $start = $game->getSignupStart();
     $end = $game->getSignupEnd();
     $pickup = $game->getPickupDeadline();
     $kickoff = $game->getKickoff();
     if ($start > $now) {
         $status = 'Signup starts on ' . strftime(TAILGATE_TIME_FORMAT, $start) . ', ' . strftime(TAILGATE_DATE_FORMAT, $start);
         $color = 'info';
     } elseif ($end > $now) {
         $status = 'Signup available until ' . strftime(TAILGATE_TIME_FORMAT, $end) . ', ' . strftime(TAILGATE_DATE_FORMAT, $end);
         $color = 'success';
     } elseif ($pickup > $now) {
         if ($game->getLotteryRun()) {
             $status = 'Lottery complete. Winners may pick up tickets until ' . strftime(TAILGATE_TIME_FORMAT, $pickup) . ', ' . strftime(TAILGATE_DATE_FORMAT, $pickup);
             $color = 'danger';
         } else {
             $status = 'Lottery to be run soon! Check back later to see if you won.';
             $color = 'warning';
         }
     } elseif ($kickoff > $now) {
         $status = 'Lottery process complete. Pickup deadline has passed. Unclaimed spaces offered on first come, first serve basis.';
         $color = 'info';
     } else {
         $gameinfo = null;
         $status = 'No game currently scheduled';
         $color = 'success';
     }
     $gameinfo .= "<div style='white-space:normal' class='alert alert-{$color}'>{$status}</div>";
     return $gameinfo;
 }
예제 #3
0
 private function changeDate()
 {
     $factory = new Factory();
     $game_id = filter_input(INPUT_POST, 'game_id', FILTER_SANITIZE_NUMBER_INT);
     $kickoff = filter_input(INPUT_POST, 'kickoff', FILTER_SANITIZE_STRING);
     $signup_start = filter_input(INPUT_POST, 'signup_start', FILTER_SANITIZE_STRING);
     $signup_end = filter_input(INPUT_POST, 'signup_end', FILTER_SANITIZE_STRING);
     $pickup_deadline = filter_input(INPUT_POST, 'pickup_deadline', FILTER_SANITIZE_STRING);
     $game = new Resource();
     $game->setId($game_id);
     $factory->load($game);
     if (!empty($kickoff)) {
         $game->setKickoff(strtotime($kickoff));
     } elseif (!empty($signup_start)) {
         $game->setSignupStart(strtotime($signup_start));
     } elseif (!empty($signup_end)) {
         $game->setSignupEnd(strtotime($signup_end));
     } elseif (!empty($pickup_deadline)) {
         $game->setPickupDeadline(strtotime($pickup_deadline));
     } else {
         throw new \Exception('Date not sent');
     }
     $factory->save($game);
     $garray = $game->getStringVars();
     $garray = $factory->addVisitorInformation($garray);
     $view = new \View\JsonView($garray);
     return $view;
 }