/**
  * Initializes the current action
  *
  * @return void
  */
 public function initializeAction()
 {
     $this->persistence = $this->settingsService->getPersistanceSettings();
     $this->storagePid = $this->persistence['storagePid'];
     $this->feUser = $GLOBALS['TSFE']->fe_user->user['uid'];
     $this->baseUrl = $GLOBALS['TSFE']->config['config']['baseURL'];
     $this->customer = $this->customerRepository->findByUid($this->feUser);
     $this->args = $this->request->getArguments();
 }
 /**
  * action index
  *
  * @return void
  */
 public function indexAction()
 {
     $GLOBALS['TSFE']->getPageRenderer()->addJsFooterFile(ExtensionManagementUtility::siteRelPath($this->request->getControllerExtensionKey()) . 'Resources/Public/Javascript/jquery.datetimepicker.js', NULL, FALSE, FALSE, '', TRUE);
     $GLOBALS['TSFE']->getPageRenderer()->addJsFooterFile(ExtensionManagementUtility::siteRelPath($this->request->getControllerExtensionKey()) . 'Resources/Public/Javascript/jquery.fancybox-1.3.4.pack.js', NULL, FALSE, FALSE, '', TRUE);
     $GLOBALS['TSFE']->getPageRenderer()->addJsFooterFile(ExtensionManagementUtility::siteRelPath($this->request->getControllerExtensionKey()) . 'Resources/Public/Javascript/jquery.fancybox-enable.js', NULL, FALSE, FALSE, '', TRUE);
     $GLOBALS['TSFE']->getPageRenderer()->addJsFooterFile(ExtensionManagementUtility::siteRelPath($this->request->getControllerExtensionKey()) . 'Resources/Public/Javascript/jquery.availableProducts.js', NULL, FALSE, FALSE, '', TRUE);
     $this->persistence = $this->settingsService->getPersistanceSettings();
     $selectedProducts = '';
     if (array_key_exists('args', $this->args)) {
         if (array_key_exists('newBooking', $this->args['args'])) {
             $this->view->assign('newCustomer', $this->args['args']['newBooking']);
             $starttime = date("d.m.Y H:s", $this->args['args']['newBooking']['starttime']);
             $this->view->assign('starttime', $starttime);
             $endtime = date("d.m.Y H:s", $this->args['args']['newBooking']['endtime']);
             $this->view->assign('endtime', $endtime);
         }
         if (array_key_exists('selectedProducts', $this->args['args'])) {
             foreach ($this->args['args']['selectedProducts'] as $key => $val) {
                 if ($val > 0) {
                     $selectedProducts .= $key . '=' . $val . ',';
                 }
             }
             $this->view->assign('selectedProducts', $selectedProducts);
         }
         $this->view->assign('agb', $this->args['args']['agb']);
     } else {
         if (is_array($this->args['selectedProducts'])) {
             foreach ($this->args['selectedProducts'] as $key => $val) {
                 if ($val > 0) {
                     $selectedProducts .= $key . '=' . $val . ',';
                 }
             }
         }
         $this->view->assign('selectedProducts', $selectedProducts);
         $this->view->assign('starttime', $this->args['starttime']);
         $this->view->assign('endtime', $this->args['endtime']);
         $this->view->assign('agb', $this->args['agb']);
     }
     $this->settings['filePath'] == '' ? $filePath = 'uploads/tx_promoshop/bookings/' : ($filePath = $this->settings['filePath']);
     $this->view->assign('filePath', $this->baseUrl . $filePath);
     $this->view->assign('baseUrl', $this->baseUrl);
     $storagePid = $this->persistence['storagePid'];
     if ($this->persistence['productStoragePid'] > 0) {
         $productStoragePid = $this->persistence['productStoragePid'];
     } else {
         $productStoragePid = $storagePid;
     }
     if ($this->accessControlService->hasLoggedInFrontendUserOnStoragePid($storagePid)) {
         $this->view->assign('products', $this->productRepository->findByCategorieAndPid(GeneralUtility::intExplode(',', $this->settings['allowedProductCategories']), $productStoragePid));
         $productCategorie = $this->settings['allowedProductCategories'];
         $pluginSetup = array('storagePid' => $storagePid, 'productStoragePid' => $productStoragePid, 'productCategorie' => $productCategorie);
         $this->view->assign('pluginSetup', $pluginSetup);
     } else {
         $this->addFlashMessage('Bitte loggen Sie sich ein.', 'Log-in Fehler', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK, TRUE);
         $this->sessionRepository->cleanUpSession();
     }
 }