public function renderUser($sekce) { if ($this->getUser()->isLoggedIn()) { $this->template->future = false; switch ($sekce) { case 'rezervace': $this->template->section = 'booking'; $this->template->history = $this->dataModel->getBookingHistory($this->getUser()->getId()); $this->template->future = $this->dataModel->getBookingList($this->getUser()->getId()); break; default: $this->template->section = 'user'; $data = $this->getUser()->getIdentity()->getData(); $subscriptionInfo = $this->dataModel->getExpirationDate($this->getUser()->getId()); Debugger::barDump($subscriptionInfo); $data['has_subscription_info'] = false; if ($subscriptionInfo) { $subscriptionEnd = new \DateTime((string) $subscriptionInfo->DO_KDY); $data['entries_name'] = (string) $subscriptionInfo->NAZEV; $data['entries_available'] = (int) $subscriptionInfo->ZDARMA; $data['entries_left'] = (int) $subscriptionInfo->ZBYVA; $data['subscription_expire'] = $subscriptionEnd->format('d.m.Y'); $data['has_subscription_info'] = true; } $this->template->user = $data; } } else { $this->flashMessage('Pro vstup do uživatelské sekce se musíte přihlásit.', self::FLASH_ERROR); $this->redirect('Homepage:default'); } }