Exemplo n.º 1
0
 /**
  * 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();
     }
 }
Exemplo n.º 2
0
 /**
  * Creates a new booking
  *
  * @param Guso\Promoshop\Domain\Model\Booking $newBooking 
  * @param array $bookingitems An array of booked products.
  *
  * @return void
  */
 public function createAction(\Guso\Promoshop\Domain\Model\Booking $newBooking = NULL, $bookingitems = array())
 {
     $isCreated = $this->sessionRepository->findBySession();
     if (array_key_exists('backlink', $this->args)) {
         $this->redirect('new', 'Booking', NULL, array('args' => $this->args));
     }
     if ($this->accessControlService->hasLoggedInFrontendUserOnStoragePid($this->storagePid)) {
         if ($isCreated) {
             $this->view->assign('isCreated', $isCreated);
         } else {
             $starttime = $newBooking->getStarttime();
             $endtime = $newBooking->getEndtime();
             $newBooking = $this->createAndAddBookingitems($newBooking, $bookingitems, $starttime, $endtime);
             $this->bookingRepository->add($newBooking);
             $newBooking->setCustomer($this->customer);
             $token = md5($this->args['__hmac']);
             $this->sessionRepository->writeToSession($token);
             $this->settings['filePath'] == '' ? $filePath = 'uploads/tx_promoshop/bookings/' : ($filePath = $this->settings['filePath']);
             // Construct a filename from the actual date and title of the productcategorie
             $dateString = time();
             $dateString = date("Y_m_d_H_s", $dateString);
             // Create filename from categorie title
             $shopName = $this->categorieRepository->findByUid($this->settings['allowedProductCategories']);
             $shopName = $shopName->getTitle();
             $replace = array('ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue', 'ß' => 'ss', ' ' => '_', '\\' => '-', '/' => '-');
             $fileName = strtr(strtolower($shopName), $replace);
             $fileName = $dateString . '_' . $fileName . '.pdf';
             $adminMail = $this->settings['adminMail'];
             $mailHeaderLogo = 'uploads/tx_promoshop/' . $this->settings['mailHeaderLogo'];
             $mailHeaderImage = 'uploads/tx_promoshop/' . $this->settings['mailHeaderImage'];
             $newBooking->setFile($fileName);
             $outputParams = array('newBooking' => $this->args['newBooking'], 'bookingItems' => $this->args['selectedProducts'], 'filePath' => $filePath, 'fileName' => $fileName, 'shopName' => $shopName, 'adminMail' => $adminMail, 'mailHeaderImage' => $mailHeaderImage, 'mailHeaderLogo' => $mailHeaderLogo, 'baseUrl' => $this->baseUrl);
             $this->view->assign('outputParams', $outputParams);
             $this->view->assign('filePath', $this->baseUrl . $filePath);
         }
     } else {
         $this->addFlashMessage('Bitte loggen Sie sich ein.', 'Log-in Fehler', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK, TRUE);
         $this->redirect('index', 'Product');
     }
 }