bootstrap = true; $this->display = 'view'; parent::__construct(); $this->meta_title = 'Rezeption'; } public function initToolbar() { parent::initToolbar(); $this->toolbar_btn = array(); } public function initPageHeaderToolbar() { parent::initPageHeaderToolbar(); $this->page_header_toolbar_btn = array(); } protected function day() { $day = Tools::getValue('day'); return $day && Validate::isDate($day) ? date('Y-m-d', strtotime($day)) : date('Y-m-d'); } public function postProcess() { if (!Tools::isSubmit('submitFrontDesk')) { return parent::postProcess(); } if (!$this->tabAccess['edit']) { $this->errors[] = 'Keine Berechtigung.'; return; } $id = (int)Tools::getValue('id_booking'); $action = Tools::getValue('fd_action'); $service = new FrontDeskService((int)$this->context->language->id); list($ok, $msg) = $service->act($id, $action, (int)$this->context->employee->id); $undo = array('checkin' => 'undo_checkin', 'checkout' => 'undo_checkout'); $flash = array('ok' => (bool)$ok, 'msg' => $msg, 'undo' => $ok && isset($undo[$action]) ? array($id, $undo[$action]) : null); $this->context->cookie->frontdesk_flash = json_encode($flash); $this->context->cookie->write(); // Post/Redirect/Get: reloading the page must not repeat the action Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&day='.$this->day()); } public function renderView() { $flash = null; if (!empty($this->context->cookie->frontdesk_flash)) { $flash = json_decode($this->context->cookie->frontdesk_flash, true); unset($this->context->cookie->frontdesk_flash); $this->context->cookie->write(); } $link = $this->context->link; $page = new FrontDeskPage( new FrontDeskService((int)$this->context->language->id), $this->day(), self::$currentIndex.'&token='.$this->token, array( 'planUrl' => Tab::getIdFromClassName('AdminOccupancyPlan') ? $link->getAdminLink('AdminOccupancyPlan') : null, 'reserveUrl' => $link->getAdminLink('AdminHotelRoomsBooking'), 'orderUrl' => function ($idOrder) use ($link) { return $link->getAdminLink('AdminOrders').'&id_order='.(int)$idOrder.'&vieworder'; }, ) ); return $page->render($flash); } }