public function renderBooking($event = null, $id = null, $placeId = null, $type = null, $time = null) { if ($event) { if ($this->getUser()->isLoggedIn()) { switch ($event) { case 'bookLesson': $result = $this->dataModel->bookLesson($this->getUser()->getId(), (int) $id, (int) $placeId); if ($result->RESULT == 1) { $this->flashMessage('Lekce rezervována', self::FLASH_SUCCESS); } else { $this->flashMessage('Rezervace selhala. ' . $result->HLASENI, self::FLASH_ERROR); } break; case 'cancelBooking': $result = $this->dataModel->cancelBooking($this->getUser()->getId(), (int) $id, (int) $placeId); if ($result->RESULT == 1) { $this->flashMessage('Rezervace zrušena', self::FLASH_SUCCESS); } else { $this->flashMessage('Rezervaci nebylo možné zrušit. ' . $result->HLASENI, self::FLASH_ERROR); } break; } } else { $this->flashMessage('Pro rezervování lekce se musíte přihlásit.', self::FLASH_ERROR); } if (isset($_GET['fromUser'])) { $this->redirect('Homepage:user#booked', array('sekce' => 'rezervace')); } else { $end = ''; if (isset($type) && isset($time)) { $end = '|' . $type . ',' . $time; } $this->redirect('Homepage:rezervace#booking' . $end); } } }