public function doUpcommingReservations() { $gameTypeId = $this->getParam('game'); $date_from = DatetimeManager::format(strtotime('now'), DatetimeManager::DB_FULL); $date_to = DatetimeManager::format(strtotime('+ 1 month'), DatetimeManager::DB_FULL); $reservations = $this->reservations->fetchWithinByGame($date_from, $date_to, $gameTypeId); $subTemplate = ['reservations' => $reservations, 'urlgen' => $this->urlGen]; $this->template['response'] = $this->twig->render('ajax/upcommingReservations.twig', $subTemplate); }
/** * @param PDO $pdo * @return UserExtended */ public function getCurrentUser() { if (!isset($_SESSION['user'])) { return new UserExtended(); } $orion_login = $_SESSION['user']; $dbUser = UserExtended::fetch($this->pdo, $orion_login); if (!$dbUser) { return new UserExtended(); } $time = DatetimeManager::format(time(), DatetimeManager::DB_FULL); User::updateActivity($this->pdo, $orion_login, $time); return $dbUser; }
public function doPridat() { $event = Tables\Event::fromPOST(); $event->author_user_id = $this->user->user_id; $dateTime = DatetimeManager::reformat(['time_from' => strtotime($event->time_from), 'time_to' => strtotime($event->time_to)], DatetimeManager::DB_TIME_ONLY); $dateTime['date'] = DatetimeManager::reformat($event->event_date, DatetimeManager::DB_DATE_ONLY); $date_from = $dateTime['date'] . ' ' . $dateTime['time_from']; $date_to = $dateTime['date'] . ' ' . $dateTime['time_to']; $resrvations = $this->reservations->fetchWithin($date_from, $date_to); $total = count($resrvations); if ($total > 0) { $this->message->warning(sprintf('V den %s není možné vytvořit událost, vytvoření blokuje %d %s.', date(DatetimeManager::HUMAN_DATE_ONLY, strtotime($event->event_date)), $total, $total >= 5 ? 'rezervací' : 'rezervace')); $this->redirectPars('rezervace', 'vypis'); } $id = Tables\Event::insert($this->pdo, $event); if ($id) { $this->message->success("Událost {$event->event_title} byla úspěšně vytvořena."); $this->redirectPars('udalost', 'zobrazit', ['id' => $id]); } $this->message->warning("Při vytváření události nastaly potíže."); $this->redirectPars("rezervace", "vypis"); }
private function reservationCreatedSendMail($reservation_id) { $reservation = $this->reservaions->fetchById($reservation_id); if (!$reservation) { $this->message->warning("Při pokusu o odeslání upozornění hráčům odebírajícím hru " . $reservation->game_name . " nastala chyba."); return; } $gameType = $this->gameTypes->fetchById($reservation->game_type_id); $users = Views\Subscription::fetchUsersByGame($this->pdo, $reservation->game_type_id); $dateTime = DatetimeManager::reformat($reservation->reservation_date, DatetimeManager::HUMAN_DATE_ONLY); $dateTime .= ' ' . DatetimeManager::reformat($reservation->time_from, DatetimeManager::HUMAN_TIME_ONLY); $pars = ['gameName' => $gameType->getFullName(), 'reservationDate' => $dateTime, 'reservationUrl' => $this->urlGen->url(['controller' => 'rezervace', 'action' => 'detail', 'id' => $reservation_id])]; MailBuilder::openReservationCreated($users, $pars); }
public function time($time) { $iTime = strtotime($time); return DatetimeManager::format($iTime, DatetimeManager::HUMAN_TIME_ONLY); }