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


PHP Helper::isBackofficeUser方法代码示例

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


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

示例1: __construct

 public function __construct($data, $postalCodeStatus)
 {
     $this->add(array('name' => 'first-name', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StripTags')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 250, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 250'))))));
     $this->add(array('name' => 'last-name', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StripTags')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 250, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 250'))))));
     $this->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'EmailAddress', 'options' => array('useDomainCheck' => false, 'messages' => array(EmailAddress::INVALID => 'Please provide correct email address', EmailAddress::INVALID_FORMAT => 'Please provide correct formated email address'))))));
     if (Helper::isBackofficeUser()) {
         $requiredPhone = false;
     } else {
         $requiredPhone = true;
         // Has filtered in booking process
     }
     $this->add(array('name' => 'phone', 'required' => $requiredPhone, 'filters' => array(array('name' => 'StringTrim'))));
     $this->add(array('name' => 'remarks', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StripTags')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 1000, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 1000'))))));
     $this->add(array('name' => 'aff-id', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Digits', 'options' => array('messages' => array(Digits::NOT_DIGITS => 'Can contain only digits.'))))));
     $this->add(array('name' => 'aff-ref', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StripTags')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 200, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 200'))))));
     $this->add(array('name' => 'address', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StripTags')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 400, 'min' => 2, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 400'))))));
     $this->add(array('name' => 'country', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Digits', 'options' => array('messages' => array(Digits::NOT_DIGITS => 'Can contain only digits.'))))));
     $this->add(array('name' => 'city', 'required' => true, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StripTags')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 100, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 100'))))));
     $this->add(array('name' => 'zip', 'required' => $postalCodeStatus == Location::POSTAL_CODE_REQUIRED ? true : false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StripTags')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 50, 'min' => 3, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 50'))))));
     $isBackofficeUser = Helper::isBackofficeUser() && isset($data['noCreditCard']) ? true : false;
     $this->add(array('name' => 'number', 'required' => !$isBackofficeUser, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'CreditCard', 'options' => array('type' => array(CreditCard::AMERICAN_EXPRESS, CreditCard::VISA, CreditCard::MASTERCARD, CreditCard::DISCOVER, CreditCard::JCB, CreditCard::DINERS_CLUB), 'messages' => array(CreditCard::CHECKSUM => "Invalid CreditCard", CreditCard::CONTENT => "Invalid CreditCard", CreditCard::INVALID => "Invalid CreditCard", CreditCard::LENGTH => "Invalid CreditCard", CreditCard::PREFIX => "Invalid CreditCard", CreditCard::SERVICE => "Invalid CreditCard", CreditCard::SERVICEFAILURE => "Invalid CreditCard"))))));
     $this->add(array('name' => 'credit_card_type', 'required' => !$isBackofficeUser, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Digits', 'options' => array('messages' => array(Digits::NOT_DIGITS => 'Can contain only digits.'))))));
     $this->add(array('name' => 'holder', 'required' => !$isBackofficeUser, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StripTags')), 'validators' => array(array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 300, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 300'))))));
     $this->add(array('name' => 'cvc', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Digits', 'options' => array('messages' => array(Digits::NOT_DIGITS => 'Can contain only digits.'))), array('name' => 'StringLength', 'options' => array('encoding' => 'UTF-8', 'max' => 4, 'min' => 3, 'messages' => array(StringLength::TOO_LONG => 'maximum symbols 10', StringLength::TOO_SHORT => 'minimum symbols 3'))))));
     $validatorYear = array('name' => 'Date', 'options' => array('format' => 'Y', 'messages' => array(Date::INVALID => 'Invalid data', Date::INVALID_DATE => 'Invalid data', Date::FALSEFORMAT => 'Invalid data')));
     $validatorMonth = array('name' => 'Date', 'options' => array('format' => 'm', 'messages' => array(Date::INVALID => 'Invalid data', Date::INVALID_DATE => 'Invalid data', Date::FALSEFORMAT => 'Invalid data')));
     if (!$isBackofficeUser) {
         $validatorYear[] = array('name' => 'Callback', 'options' => array('messages' => array(Callback::INVALID_VALUE => 'Invalid data', Callback::INVALID_CALLBACK => 'Invalid data'), 'callback' => function ($value, $context = array()) {
             $current = date('Y');
             return $value >= $current;
         }));
         $validatorMonth[] = array('name' => 'Callback', 'options' => array('messages' => array(Callback::INVALID_VALUE => 'Invalid data', Callback::INVALID_CALLBACK => 'Invalid data'), 'callback' => function ($value, $context = array()) {
             if ($context['year'] == date('Y') && $value < date('m')) {
                 return false;
             }
             return true;
         }));
     }
     $this->add(array('name' => 'year', 'required' => $isBackofficeUser, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array($validatorYear)));
     $this->add(array('name' => 'month', 'required' => $isBackofficeUser, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array($validatorMonth)));
     $this->add(['name' => 'apartel', 'required' => false, 'filters' => [array('name' => 'StringTrim')], 'validators' => [['name' => 'Digits', 'options' => ['messages' => [Digits::NOT_DIGITS => 'Can contain only digits.']]]]]);
     $this->add(array('name' => 'not_send_mail', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Digits', 'options' => array('messages' => array(Digits::NOT_DIGITS => 'Can contain only digits.'))))));
     $this->add(array('name' => 'noCreditCard', 'required' => false));
 }
开发者ID:arbi,项目名称:MyCode,代码行数:44,代码来源:BookingFilter.php

示例2: getUserCountry

 private function getUserCountry()
 {
     $userCountry = Helper::getUserCountry();
     return !Helper::isBackofficeUser() && isset($userCountry['country_id']) && $userCountry['country_id'] ? $userCountry['country_id'] : 0;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:5,代码来源:Booking.php

示例3: 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

示例4: getAvailableRates

 public function getAvailableRates($apartmentUrl, $city, $guestCount, $arrivalDate, $departureDate)
 {
     $bookNightCount = Helper::getDaysFromTwoDate($arrivalDate, $departureDate);
     $checkNightCount = Helper::getDaysFromTwoDate($arrivalDate, date('Y-m-d'));
     $sql = "\n            select * from (\n                select\n                    product_rates.id               AS id,\n                    product_rates.name             AS name,\n                    product_rates.capacity         AS capacity,\n                    product_rates.type             AS type,\n                    product_rates.is_refundable    AS is_refundable,\n                    product_rates.refundable_before_hours AS refundable_before_hours,\n                    product_rates.penalty_percent  AS penalty_percent,\n                    product_rates.penalty_nights     AS penalty_nights,\n                    product_rates.penalty_fixed_amount   AS penalty_fixed_amount,\n                    product_rates.penalty_type     AS penalty_type,\n                    avg(rate_av.price)             AS price,\n                    min(rate_av.availability)     AS availability,\n                    apartments.currency_id         AS currency_id,\n                    geo_details.name            AS city_name,\n                    currency.code                  AS code,\n                    currency.symbol                AS symbol\n                from " . DbTables::TBL_APARTMENT_INVENTORY . " as rate_av\n                    left join " . DbTables::TBL_APARTMENT_RATES . "    as product_rates on product_rates.id = rate_av.rate_id\n                    left join " . DbTables::TBL_APARTMENTS . "       as apartments    on apartments.id = rate_av.apartment_id\n                    left join " . DbTables::TBL_CITIES . "           as cities        on cities.id = apartments.city_id\n                    left join " . DbTables::TBL_LOCATION_DETAILS . " as geo_details   on geo_details.id = cities.detail_id and lower(geo_details.name) = ?\n                    left join " . DbTables::TBL_CURRENCY . "         as currency      on currency.id = apartments.currency_id\n                where\n                    apartments.url         = ? and\n                    product_rates.active   = 1 and\n                    product_rates.capacity >= ? and\n                    product_rates.min_stay <= ? and\n                    product_rates.max_stay >= ? and\n                    product_rates.release_period_start <= ? and\n                    product_rates.release_period_end >= ? and\n                    rate_av.date           >= ? and\n                    rate_av.date           < ?\n                group by rate_av.rate_id\n                order by\n                  rate_av.price asc,\n                  product_rates.capacity asc\n            ) as result where result.availability > 0";
     if (!Helper::isBackofficeUser()) {
         $sql .= " limit 4";
     }
     $statement = $this->adapter->createStatement($sql, [$city, $apartmentUrl, $guestCount, $bookNightCount, $bookNightCount, $checkNightCount, $checkNightCount, $arrivalDate, $departureDate]);
     $result = $statement->execute();
     return $result;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:12,代码来源:Inventory.php


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