当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::getSessionContainer方法代码示例

本文整理汇总了PHP中Library\Utility\Helper::getSessionContainer方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::getSessionContainer方法的具体用法?PHP Helper::getSessionContainer怎么用?PHP Helper::getSessionContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Library\Utility\Helper的用法示例。


在下文中一共展示了Helper::getSessionContainer方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: downloadCsvAction

 public function downloadCsvAction()
 {
     $apartmentGeneralService = $this->getServiceLocator()->get('service_apartment_general');
     $currency = $apartmentGeneralService->getCurrencySymbol($this->apartmentId);
     $expenseDao = new ExpenseCost($this->getServiceLocator(), '\\ArrayObject');
     $costs = $expenseDao->getApartmentCosts($this->apartmentId);
     $costArray = [];
     foreach ($costs as $cost) {
         $costArray[] = ["ID" => $cost['id'], "Category" => $cost['category'], "Date" => date(Constants::GLOBAL_DATE_FORMAT, strtotime($cost['date'])), "Amount ({$currency})" => $cost['amount'], "Purpose" => $cost['purpose']];
     }
     if (!empty($costArray)) {
         $response = $this->getResponse();
         $headers = $response->getHeaders();
         $utilityCsvGenerator = new CsvGenerator();
         $filename = 'costs_apartment_' . str_replace(' ', '_', date('Y-m-d')) . '.csv';
         $utilityCsvGenerator->setDownloadHeaders($headers, $filename);
         $csv = $utilityCsvGenerator->generateCsv($costArray);
         $response->setContent($csv);
         return $response;
     } else {
         $flash_session = Helper::getSessionContainer('use_zf2');
         $flash_session->flash = ['notice' => 'There are empty data, nothing to download.'];
         $url = $this->getRequest()->getHeader('Referer')->getUri();
         $this->redirect()->toUrl($url);
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:26,代码来源:Cost.php

示例2: __invoke

 public function __invoke($data = [])
 {
     /**
      * @var UserManager $userDao
      */
     $userId = false;
     $result = ['boUser' => 'no'];
     if (isset($_COOKIE['backoffice_user'])) {
         $userId = (int) $_COOKIE['backoffice_user'];
     }
     if ($userId) {
         $userDao = $this->serviceLocator->get('dao_user_user_manager');
         $userInfo = $userDao->getUserTrackingInfo($userId);
         if ($userInfo) {
             $result = ['boUser' => 'yes', 'uid' => strval($userId), 'userCity' => $userInfo['city'], 'userDept' => $userInfo['department']];
         }
     }
     $router = $this->getServiceLocator()->get('application')->getMvcEvent()->getRouteMatch();
     if ($router) {
         $action = $router->getParam('action', 'index');
         $controller = $router->getParam('controller', 'index');
         $controllerArray = explode("\\", $controller);
         $controller = strtolower(array_pop($controllerArray));
         if ($controller == 'booking' && $action == 'thank-you') {
             $session_booking = Helper::getSessionContainer('booking');
             if ($session_booking->offsetExists('reservation') && $session_booking->offsetExists('tankyou') && isset($_SERVER['HTTPS'])) {
                 $reservation = $session_booking->reservation;
                 $thankYou = $session_booking->tankyou;
                 $variant = $reservation['bedroom_count'] > 0 ? $reservation['bedroom_count'] . ' ' . $this->getTextline(1446) : $this->getTextline(1190);
                 $cityName = $this->getServiceLocator()->get('service_textline')->getCityName($reservation['city_id']);
                 $result['page_httpResponseCode'] = "200";
                 $result['transactionAffiliation'] = $thankYou['partner'];
                 $result['transaction_currency'] = "USD";
                 $result['transaction_subtotal_include_tax'] = "no";
                 $result['transactionId'] = $thankYou['res_number'];
                 $result['transactionTotal'] = $thankYou['totalWithoutTax'];
                 $result['transactionProducts'] = ['sku' => $reservation['prod_id'], 'name' => $reservation['prod_name'], 'category' => $cityName, 'variant' => $variant, 'price' => $thankYou['totalWithoutTax'], 'quantity' => "1"];
                 $result['ticketID'] = $thankYou['res_number'];
                 $result['PartnerID'] = $data['partner_id'];
             }
         } elseif ($controller == 'key' && $action == 'index' || $controller == 'booking' && $action == 'update-cc-details' || $controller == 'review' && $action == 'index' || $controller == 'chargeauthorization' && $action == 'index') {
             $result['ticketID'] = $data['res_number'];
             $result['PartnerID'] = $data['partner_id'];
         }
     }
     return '<script>dataLayer = [' . json_encode($result) . '];</script>';
 }
开发者ID:arbi,项目名称:MyCode,代码行数:47,代码来源:UserTracking.php

示例3: downloadCsvAction

 public function downloadCsvAction()
 {
     /**
      * @var ExpenseTicket $expenseService
      */
     $expenseService = $this->getServiceLocator()->get('service_finance_expense_expense_ticket');
     try {
         $data = $expenseService->getCsvArrayForDownload($this->params()->fromQuery());
     } catch (\Exception $ex) {
         $flash = Helper::getSessionContainer('use_zf2');
         $flash->flash = ['error' => $ex->getMessage()];
         return $this->redirect()->toRoute('finance/purchase-order');
     }
     $response = $this->getResponse();
     $headers = $response->getHeaders();
     $filename = 'Purchase Order Items ' . date('Y-m-d') . '.csv';
     $utilityCsvGenerator = new CsvGenerator();
     $utilityCsvGenerator->setDownloadHeaders($headers, $filename);
     $csv = $utilityCsvGenerator->generateCsv($data);
     $response->setContent($csv);
     return $response;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:22,代码来源:PurchaseOrderItemController.php

示例4: thankYouAction

 /**
  * @return \Zend\Http\Response|ViewModel
  */
 public function thankYouAction()
 {
     try {
         $reservationSession = Helper::getSessionContainer('booking');
         if (!$reservationSession->offsetExists('reservation') || !$reservationSession->offsetExists('tankyou') || !isset($_SERVER['HTTPS'])) {
             return $this->redirect()->toRoute('home');
         }
         /**
          * @var \DDD\Service\Website\Booking $bookingService
          */
         $bookingService = $this->getServiceLocator()->get('service_website_booking');
         $paymentDetails = $bookingService->changePaymentDetailsByGuestCurrency($reservationSession->tankyou['reservation_id']);
         $reservationSession->reservation['payments'] = $paymentDetails;
         $this->layout()->userTrackingInfo = ['partner_id' => $reservationSession->tankyou['partner_id']];
         return new ViewModel(['thankYouPageData' => $reservationSession->tankyou, 'reservation' => $reservationSession->reservation]);
     } catch (\Exception $e) {
         return $this->redirect()->toRoute('home');
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:22,代码来源:BookingController.php

示例5: saveItemAction

 public function saveItemAction()
 {
     /**
      * @var ExpenseTicket $expenseService
      */
     $expenseService = $this->getServiceLocator()->get('service_finance_expense_expense_ticket');
     $request = $this->getRequest();
     $id = $this->params()->fromRoute('id');
     $result = ['status' => 'error', 'msg' => TextConstants::SERVER_ERROR];
     if ($request->isPost() && $request->isXmlHttpRequest()) {
         try {
             if ($expenseService->saveItem($request->getPost()->data, $request->getFiles(), $extra)) {
                 $result = ['status' => 'success'];
                 if ($extra['poId']) {
                     $message = TextConstants::SUCCESS_UPDATE;
                     $result['redirect-url'] = $this->url()->fromRoute('finance/purchase-order/edit', ['id' => $extra['poId']]);
                 } else {
                     $message = $id ? TextConstants::SUCCESS_UPDATE : TextConstants::SUCCESS_ADD;
                     $result['redirect-url'] = $this->url()->fromRoute('finance/item/edit', ['id' => $extra['itemId']]);
                 }
                 $result['msg'] = $message;
                 $flash = Helper::getSessionContainer('use_zf2');
                 $flash->flash = ['success' => $message];
             }
         } catch (\Exception $ex) {
             $result['msg'] = $ex->getMessage();
             // do nothing
         }
     }
     return new JsonModel($result);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:31,代码来源:PurchaseOrderController.php

示例6: ajaxDownloadOfficeCostsCsvAction

 public function ajaxDownloadOfficeCostsCsvAction()
 {
     try {
         /**
          * @var \DDD\Dao\Finance\Expense\ExpenseCost $expenseCostDao
          */
         $expenseCostDao = $this->getServiceLocator()->get('dao_finance_expense_expense_cost');
         $officeId = $this->params()->fromRoute('id');
         $filter = $this->params()->fromQuery('filter');
         $officeCostsFiltered = $expenseCostDao->getOfficeCosts($officeId, ['sSearch' => $filter, 'iSortCol_0' => 2, 'sSortDir_0' => 'desc']);
         $costArray = [];
         foreach ($officeCostsFiltered as $cost) {
             $costArray[] = ["ID" => $cost['id'], "Category" => $cost['category'], "Date" => date(Constants::GLOBAL_DATE_FORMAT, strtotime($cost['date'])), "Currency" => $cost['currency_code'], "Amount" => $cost['amount'], "Purpose" => $cost['purpose']];
         }
         if (!empty($costArray)) {
             $response = $this->getResponse();
             $headers = $response->getHeaders();
             $utilityCsvGenerator = new CsvGenerator();
             $filename = 'costs_office_' . $officeId . '_' . str_replace(' ', '_', date('Y-m-d')) . '.csv';
             $utilityCsvGenerator->setDownloadHeaders($headers, $filename);
             $csv = $utilityCsvGenerator->generateCsv($costArray);
             $response->setContent($csv);
             return $response;
         } else {
             $flash_session = Helper::getSessionContainer('use_zf2');
             $flash_session->flash = ['notice' => 'There are empty data, nothing to download.'];
             $url = $this->getRequest()->getHeader('Referer')->getUri();
             $this->redirect()->toUrl($url);
         }
     } catch (\Exception $e) {
         $this->gr2logException($e, 'Cannot Download Office Costs Csv');
     }
     return $this->redirect()->toUrl('/');
 }
开发者ID:arbi,项目名称:MyCode,代码行数:34,代码来源:OfficeController.php

示例7: getUserCountry

 public static function getUserCountry()
 {
     $sessionNamespase = Helper::getSessionContainer('visitor');
     $country_name = $sessionNamespase->country_name;
     $country_id = $sessionNamespase->country_id;
     $country_iso = $sessionNamespase->country_iso;
     return ['country_name' => $country_name, 'country_id' => $country_id, 'country_iso' => $country_iso];
 }
开发者ID:arbi,项目名称:MyCode,代码行数:8,代码来源:Helper.php

示例8: onViewHelper

 public function onViewHelper(MvcEvent $e)
 {
     /**
      * @var ViewModel|\ArrayObject $viewModel
      */
     $viewModel = $e->getViewModel();
     $base_url = Constants::BASE_PATH_VIEW;
     $viewModel->basePathView = $base_url;
     $viewModel->globalVersion = Constants::VERSION;
     $viewModel->globalImgDomainName = DomainConstants::IMG_DOMAIN_NAME;
     $viewModel->flashMessenger = Helper::getSessionContainer('use_zf2')->flash;
     $home_url = '/home';
     $session_home_url = Helper::getSessionContainer('default_home_url');
     if (isset($session_home_url->home_url)) {
         $home_url = $session_home_url->home_url;
     }
     $viewModel->default_home_url = $base_url . $home_url;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:18,代码来源:Module.php

示例9: bookingProcess

 /**
  * @param array $userAndPayData
  * @return array
  */
 public function bookingProcess($userAndPayData)
 {
     /**
      * @var BookingTicket $bookingTicketService
      * @var ChannelManager $channelManagerService
      * @var PenaltyCalculation $penaltyService
      * @var ApartmentGroup $apartmentGroupService
      * @var \DDD\Service\Finance\Customer $customerFinanceService
      * @var Logger $logger
      * @var \DDD\Service\Reservation\Main $reservationService
      * @var \DDD\Service\Partners $partnerService
      * @var \DDD\Service\Queue\InventorySynchronizationQueue $syncService
      */
     $bookingTicketService = $this->getServiceLocator()->get('service_booking_booking_ticket');
     $channelManagerService = $this->getServiceLocator()->get('service_channel_manager');
     $apartmentGroupService = $this->getServiceLocator()->get('service_apartment_group');
     $reservationService = $this->getServiceLocator()->get('service_reservation_main');
     $partnerService = $this->getServiceLocator()->get('service_partners');
     $syncService = $this->getServiceLocator()->get('service_queue_inventory_synchronization_queue');
     $session_booking = Helper::getSessionContainer('booking');
     if (empty($userAndPayData) || !$session_booking->offsetExists('reservation')) {
         return ['status' => 'error'];
     }
     $reservationData = $session_booking->reservation;
     //bookingProcess
     $data = $tankYou = [];
     $data['apartment_id_assigned'] = $reservationData['prod_id'];
     $data['apartment_id_origin'] = $reservationData['prod_id'];
     $data['room_id'] = $reservationData['room_id'];
     $data['acc_name'] = $reservationData['prod_name'];
     $data['acc_country_id'] = $reservationData['country_id'];
     $data['acc_province_id'] = $reservationData['province_id'];
     $data['acc_city_id'] = $reservationData['city_id'];
     $data['acc_province_name'] = $reservationData['province_name'];
     $data['acc_city_name'] = $reservationData['city_name'];
     $data['acc_address'] = $reservationData['address'];
     $data['building_name'] = $apartmentGroupService->getBuildingName($reservationData['prod_id']);
     $data['date_from'] = $reservationData['date_from'];
     $data['date_to'] = $reservationData['date_to'];
     // Currency Rate
     /** @var \DDD\Service\Currency\Currency $currencyService */
     $currencyService = $this->getServiceLocator()->get('service_currency_currency');
     $data['currency_rate'] = $currencyService->getCurrencyConversionRate($this->getCurrencySite(), $reservationData['code']);
     $data['currency_rate_usd'] = $currencyService->getCurrencyConversionRate('USD', $reservationData['code']);
     $data['booker_price'] = $reservationData['amount_price'];
     $data['guest_currency_code'] = $this->getCurrencySite();
     $data['occupancy'] = $reservationData['guest'];
     $resNumber = $tankYou['res_number'] = $bookingTicketService->generateResNumber();
     $data['res_number'] = $resNumber;
     $data['timestamp'] = date('Y-m-d H:i:s');
     $data['apartment_currency_code'] = $reservationData['code'];
     $data['ki_page_status'] = BookingTicket::NOT_SEND_KI_PAGE_STATUS;
     $data['ki_page_hash'] = $bookingTicketService->generatePageHash($data['res_number'], $data['timestamp']);
     $data['review_page_hash'] = $bookingTicketService->generatePageHash($data['res_number'], $data['apartment_id_origin']);
     $data['remarks'] = isset($userAndPayData['remarks']) ? $userAndPayData['remarks'] : '';
     if (isset($reservationData['arrival_time']) && !empty($reservationData['arrival_time'])) {
         $data['guest_arrival_time'] = $reservationData['arrival_time'];
     }
     // Affiliate Data
     $webSiteAff = WebSite::WEB_SITE_PARTNER;
     $visitor = new Container('visitor');
     if (isset($userAndPayData['aff-id']) && (int) $userAndPayData['aff-id'] > 0 && $userAndPayData['aff-id'] != WebSite::WEB_SITE_PARTNER && Helper::isBackofficeUser()) {
         $webSiteAff = $userAndPayData['aff-id'];
     } elseif (!is_null($visitor->partnerId) && (int) $visitor->partnerId) {
         $webSiteAff = (int) $visitor->partnerId;
     }
     $partnerData = $partnerService->getPartnerDataForReservation($webSiteAff, $reservationData['prod_id'], true);
     $data['partner_ref'] = isset($userAndPayData['aff-ref']) ? $userAndPayData['aff-ref'] : '';
     $data['partner_id'] = $webSiteAff;
     $data['partner_name'] = $partnerData->getPartnerName();
     $data['partner_commission'] = $partnerData->getCommission();
     $data['model'] = $partnerData->getBusinessModel();
     // Is backoffice user
     if (Helper::isBackofficeUser()) {
         if (isset($userAndPayData['not_send_mail']) && $userAndPayData['not_send_mail'] > 0) {
             $otherInfo['no_send_guest_mail'] = true;
         }
     }
     // check apartel
     if (isset($userAndPayData['apartel']) && $userAndPayData['apartel'] > 0) {
         /** @var $apartelGeneralDao \DDD\Dao\Apartel\General */
         $apartelGeneralDao = $this->getServiceLocator()->get('dao_apartel_general');
         if ($apartelGeneralDao->checkApartmentFromThisApartel($userAndPayData['apartel'], $reservationData['prod_id'])) {
             $data['apartel_id'] = $userAndPayData['apartel'];
         }
     }
     $userAndPayData['phone'] = $this->clearPhone($userAndPayData['phone']);
     // Personal Data
     $data['guest_first_name'] = $tankYou['first_name'] = $userAndPayData['first-name'];
     $data['guest_last_name'] = $tankYou['last_name'] = $userAndPayData['last-name'];
     $data['guest_email'] = $tankYou['email'] = $userAndPayData['email'];
     $data['guest_address'] = $tankYou['address'] = $userAndPayData['address'];
     $data['guest_city_name'] = $tankYou['city'] = $userAndPayData['city'];
     $data['guest_country_id'] = $tankYou['country'] = $userAndPayData['country'];
     $data['guest_language_iso'] = 'en';
     $data['guest_zip_code'] = $userAndPayData['zip'];
//.........这里部分代码省略.........
开发者ID:arbi,项目名称:MyCode,代码行数:101,代码来源:Booking.php

示例10: getUrlForRedirect

 public function getUrlForRedirect()
 {
     $last_visit = Helper::getSessionContainer('last_visit');
     $last_visit_url = $last_visit->last_visit_url;
     $homeUrl = $this->getHomeUrl();
     $homeNamespase = Helper::getSessionContainer('default_home_url');
     $homeNamespase->home_url = $homeUrl;
     if (!$last_visit_url) {
         $last_visit_url = $homeUrl;
     }
     return $last_visit_url;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:12,代码来源:BackofficeAuthenticationService.php

示例11: loginAction

 public function loginAction()
 {
     /**
      * @var BackofficeAuthenticationService $backofficeAuthenticationService
      */
     $this->layout('layout/login');
     $session = new Container('authFailed');
     $router = $this->getEvent()->getRouter();
     $request = $this->getRequest();
     $lastRequestUrl = $request->getQuery()->request_url;
     $loginUrl = $router->assemble([], ['name' => 'backoffice_user_login']);
     if ($session->authFailed) {
         $form = new LoginForm();
         $form->setInputFilter(new LoginFilter());
         $error = $session->authFailed === self::CONNECTION_TIMEDOUT ? 'Connection Timed Out.' : 'Authentication failed.';
         $session->getManager()->getStorage()->clear('authFailed');
         return new ViewModel(['form' => $form, 'error' => $error, 'backofficeVersion' => Constants::APP_VERSION]);
     }
     $serviceLocator = $this->getServiceLocator();
     $backofficeAuthenticationService = $serviceLocator->get('library_backoffice_auth');
     if ($backofficeAuthenticationService->hasIdentity()) {
         $redirectHome = $backofficeAuthenticationService->getHomeUrl();
         if (!empty($lastRequestUrl) && $lastRequestUrl != $loginUrl) {
             $redirectUrl = $lastRequestUrl;
         } else {
             $redirectUrl = $redirectHome;
         }
         return $this->redirect()->toUrl($redirectUrl);
     }
     $failure = '';
     $request = $this->getRequest();
     $form = new LoginForm();
     if ($request->isPost()) {
         $postData = $request->getPost();
         $form->setInputFilter(new LoginFilter());
         $form->setData($postData);
         if ($form->isValid()) {
             $formData = $form->getData();
             $result = $backofficeAuthenticationService->authenticate(null, $formData['identity'], $formData['credential']);
             if ($result->isValid()) {
                 $auth = $this->getServiceLocator()->get('library_backoffice_auth');
                 $userIdentity = $auth->getIdentity();
                 // update user last login date and time
                 $userManagerService = $serviceLocator->get('service_user');
                 $userManagerService->updateLastLogin($userIdentity->id);
                 $appConfig = $serviceLocator->get('config');
                 $backofficeAuthenticationService->setAsBackofficeUser($appConfig['session']['config']['options']['cookie_domain']);
                 $backofficeAuthenticationService->setRememberMyEmail($formData['identity'], $appConfig['session']['config']['options']['cookie_domain']);
                 $redirect = $backofficeAuthenticationService->getUrlForRedirect();
                 if (!empty($lastRequestUrl) && $lastRequestUrl != $loginUrl) {
                     $redirect = $lastRequestUrl;
                 } else {
                     $redirect = $redirect;
                 }
                 return $this->redirect()->toUrl($redirect);
             } else {
                 $failure = 'Authentication failed.';
             }
         } else {
             $failure = 'Authentication failed.';
         }
     }
     $session1 = Helper::getSessionContainer('logout');
     if ($session1->offsetExists('loggedOut') && $session1->offsetGet('loggedOut')) {
         $session1->getManager()->getStorage()->clear();
     }
     return new ViewModel(['form' => $form, 'error' => $failure, 'lastRequestUrl' => $lastRequestUrl, 'backofficeVersion' => Constants::APP_VERSION]);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:68,代码来源:AuthenticationController.php

示例12: downloadCsvAction

 public function downloadCsvAction()
 {
     $requestParams = $this->params()->fromQuery();
     /* @var $documentService \DDD\Service\Document\Document */
     $documentService = $this->getServiceLocator()->get('service_document_document');
     $documents = $documentService->getDocumentSearchResults($requestParams);
     $result = [];
     if (count($documents) > 0) {
         foreach ($documents as $document) {
             $documentDescriptionCleaup = str_replace('&nbsp;', ' ', strip_tags($document->getDescription(), '<br>'));
             $result[] = ['Property' => $document->getEntityName(), 'Security Level' => $document->getTeamName(), 'Document Type' => $document->getTypeName(), 'Supplier' => $document->getSupplierName(), 'Account Number' => $document->getAccountNumber(), 'Account Holder' => $document->getAccountHolder(), 'Description' => $documentDescriptionCleaup, 'Created Date' => $document->getCreatedDate(), 'Has Attachment' => empty($document->getAttachment()) ? '-' : '+', 'Has url' => empty($document->getUrl()) ? '-' : '+', 'Valid From' => $document->getValidFrom(), 'Valid To' => $document->getValidTo(), 'Legal Entity' => $document->getLegalEntityName(), 'Signatory' => $document->getSignatoryFullName()];
         }
         $response = $this->getResponse();
         $headers = $response->getHeaders();
         $filename = 'Apartment Documents ' . date('Y-m-d') . '.csv';
         $utilityCsvGenerator = new CsvGenerator();
         $utilityCsvGenerator->setDownloadHeaders($headers, $filename);
         $csv = $utilityCsvGenerator->generateCsv($result);
         $response->setContent($csv);
         return $response;
     } else {
         $flash_session = Helper::getSessionContainer('use_zf2');
         $flash_session->flash = ['notice' => 'The search results were empty, nothing to download.'];
         $url = $this->getRequest()->getHeader('Referer')->getUri();
         $this->redirect()->toUrl($url);
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:27,代码来源:Document.php


注:本文中的Library\Utility\Helper::getSessionContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。