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


PHP Helper::getImgByWith方法代码示例

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


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

示例1: getOptions

 /**
  *
  * @return array
  */
 public function getOptions()
 {
     //search options
     $searchService = $this->getServiceLocator()->get('service_website_search');
     $options = $searchService->getOptionsForSearch();
     //location options
     $cacheService = $this->getServiceLocator()->get('service_website_cache');
     $keyLocationsCache = 'locations_for_home_en';
     $router = $this->getServiceLocator()->get('router');
     if ($rowsLocations = $cacheService->get($keyLocationsCache)) {
         $options['locations'] = $rowsLocations;
     } else {
         $cityDao = new CityDao($this->getServiceLocator(), 'ArrayObject');
         $citiesList = $cityDao->getCityListForIndex();
         $cities = [];
         foreach ($citiesList as $city) {
             $cityProvince = $city['city_slug'] . '--' . $city['province_slug'];
             $img = Helper::getImgByWith('/locations/' . $city['detail_id'] . '/' . $city['cover_image'], WebSite::IMG_WIDTH_LOCATION_MEDIUM);
             $cities[$city['ordering']] = ['city_id' => $city['city_id'], 'country_id' => $city['country_id'], 'capacity' => $city['capacity'], 'spent_nights' => $city['spent_nights'], 'sold_future_nights' => $city['sold_future_nights'], 'img' => $img, 'url' => $router->assemble(['action' => 'location', 'cityProvince' => $cityProvince], ['name' => 'location/child'])];
         }
         ksort($cities);
         $options['locations'] = $cities;
         $cacheService->set($keyLocationsCache, $cities);
     }
     //country count
     $keyCountryCashe = 'country_count_for_home';
     if ($countryCount = $cacheService->get($keyCountryCashe)) {
         $options['countryCount'] = $countryCount;
     } else {
         $bookingDao = $this->getBookingWebDao();
         $countries = $bookingDao->getBookingCountryEmailCount('guest_country_id');
         $options['countryCount'] = $countries ? $countries['count'] : 0;
         $cacheService->set($keyCountryCashe, $options['countryCount']);
     }
     //people count
     $keyPeopleCache = 'people_count_for_home';
     if ($peopleCount = $cacheService->get($keyPeopleCache)) {
         $options['peopleCount'] = $peopleCount;
     } else {
         $bookingDao = $this->getBookingWebDao();
         $peoples = $bookingDao->getBookingCountryEmailCount('guest_email');
         $options['peopleCount'] = $peoples ? $peoples['count'] : 0;
         $cacheService->set($keyPeopleCache, $options['peopleCount']);
     }
     //blog list
     $blogDao = new Blog($this->getServiceLocator(), 'ArrayObject');
     $bloges = $blogDao->getBlogForWebIndex();
     $options['bloges'] = $bloges;
     $router = $this->getServiceLocator()->get('router');
     $url = $router->assemble([], ['name' => 'search']);
     $options['action'] = $url;
     return $options;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:57,代码来源:Index.php

示例2: bookingDataByCCPassword

 /**
  * @param array $data
  * @return array
  */
 public function bookingDataByCCPassword($data)
 {
     /**
      * @var \DDD\Service\Website\Apartment $apartmentService
      * @var \DDD\Service\Booking\Charge $chargeService
      */
     $apartmentService = $this->getServiceLocator()->get('service_website_apartment');
     $chargeService = $this->getServiceLocator()->get('service_booking_charge');
     if (!isset($data['code']) || !ClassicValidator::checkCCPdateCode($data['code'])) {
         return false;
     }
     /**
      * @var \DDD\Dao\Booking\Booking $bookingDao
      */
     $bookingDao = $this->getServiceLocator()->get('dao_booking_booking');
     $bookingDao->setEntity(new \ArrayObject());
     $resData = $bookingDao->getResDataByCCUpdateCode($data['code']);
     if (!$resData) {
         return false;
     }
     $img = Helper::getImgByWith($resData['img1'], WebSite::IMG_WIDTH_SEARCH, true, true);
     if ($img) {
         $resData['image'] = $img;
     }
     $resData['user_currency'] = $resData['guest_currency_code'];
     $bookNightCount = Helper::getDaysFromTwoDate($resData['date_from'], $resData['date_to']);
     $resData['night_count'] = $bookNightCount;
     $resData['totalNigthCount'] = $bookNightCount;
     // Cancelation Policy
     $cancelationDate = $resData;
     $cancelationDate['penalty_percent'] = $cancelationDate['penalty_fixed_amount'] = $cancelationDate['penalty_nights'] = $resData['penalty_val'];
     $cancelationDate['night_count'] = $bookNightCount;
     $cancelationDate['code'] = $resData['apartment_currency_code'];
     $cancelationPolicy = $apartmentService->cancelationPolicy($cancelationDate);
     $resData['cancelation_type'] = $cancelationPolicy['type'];
     $resData['cancelation_policy'] = $cancelationPolicy['description'];
     $paymentDetails = $chargeService->getCharges($resData['id']);
     // When showing to customers we don't really want to show base and additional parts of taxes separately
     // This part of code runs through payment details and combines same type of taxes for same day into a single unit
     $floatPattern = '/-?(?:\\d+|\\d*\\.\\d+)/';
     $smarterPaymentDetails = [];
     if ($paymentDetails) {
         foreach ($paymentDetails as $payment) {
             if ($payment['type'] != 'tax') {
                 array_push($smarterPaymentDetails, $payment);
             } else {
                 $paymentKey = $payment['type_id'] . '-' . $payment['date'];
                 if (!isset($smarterPaymentDetails[$paymentKey])) {
                     $smarterPaymentDetails[$paymentKey] = $payment;
                 } else {
                     preg_match($floatPattern, $smarterPaymentDetails[$paymentKey]['label'], $match);
                     $currValue = $match[0];
                     $currPrice = $smarterPaymentDetails[$paymentKey]['price'];
                     preg_match($floatPattern, $payment['label'], $match);
                     $additionalValue = $match[0];
                     $additionalPrice = $payment['price'];
                     $smarterPaymentDetails[$paymentKey]['label'] = str_replace($currValue, $currValue + $additionalValue, $smarterPaymentDetails[$paymentKey]['label']);
                     $smarterPaymentDetails[$paymentKey]['price'] = str_replace($currPrice, $currPrice + $additionalPrice, $smarterPaymentDetails[$paymentKey]['price']);
                     $smarterPaymentDetails[$paymentKey]['price_view'] = str_replace($currPrice, $currPrice + $additionalPrice, $smarterPaymentDetails[$paymentKey]['price_view']);
                 }
             }
         }
     }
     $resData['paymentDetails']['payments'] = $smarterPaymentDetails;
     return $resData;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:70,代码来源:Booking.php

示例3: searchApartmentList

 /**
  * @param array $data
  * @return array
  */
 public function searchApartmentList($data, $getAll = false)
 {
     /**
      * @var \DDD\Dao\Currency\Currency $currencyDao
      */
     $currencyDao = $this->getServiceLocator()->get('dao_currency_currency');
     $filterData = $this->filterSearchData($data);
     $apartelList = $apartels = $options = [];
     $error = false;
     $totalPages = 1;
     $queryString = '';
     if ($filterData) {
         return ['status' => 'error', 'msg' => $filterData];
     }
     $correcrData = $this->correctData($data);
     $bedrooms = $this->defineBedrooms($data);
     $guest = $correcrData['guest'];
     $page = $correcrData['page'];
     $arrival = $correcrData['arrival'];
     $departure = $correcrData['departure'];
     $apartelGeneralDao = $this->getApartelGeneralDao();
     $pageItemCount = WebSite::PAGINTAION_ITEM_COUNT;
     $offset = (int) ($page - 1) * $pageItemCount;
     if (isset($data['city'])) {
         $city = $data['city'];
         // Has date
         if ($arrival && $departure) {
             $apartelsResult = $apartelGeneralDao->getApartmentsByCityDate($city, $arrival, $departure, $guest, $pageItemCount, $offset, $bedrooms);
             $options['price_text'] = $this->getTextLineSite(1210);
         } else {
             $apartelsResult = $apartelGeneralDao->getApartmentsCity($city, $guest, $pageItemCount, $offset, $getAll, $bedrooms);
             $options['price_text'] = $this->getTextLineSite(1333);
         }
     } elseif (isset($data['apartel'])) {
         $apartel = $data['apartel'];
         // Has date
         if ($arrival && $departure) {
             $apartelsResult = $apartelGeneralDao->getApartmentsByApartelDate($apartel, $arrival, $departure, $guest, $pageItemCount, $offset, $bedrooms);
             $options['price_text'] = $this->getTextLineSite(1210);
         } else {
             $apartelsResult = $apartelGeneralDao->getApartmentsApartel($apartel, $guest, $pageItemCount, $offset, $getAll, $bedrooms);
             $options['price_text'] = $this->getTextLineSite(1333);
         }
     } else {
         return ['status' => 'error'];
     }
     $apartmentList = $apartelsResult['result'];
     $total = $apartelsResult['total'];
     $totalPages = $total > 0 ? ceil($total / $pageItemCount) : 1;
     if (!$apartmentList->count()) {
         return ['status' => 'no_av', 'msg' => $this->getTextLineSite(1218)];
     }
     $visitorLoc = $this->getVisitorCountry();
     // Change currency
     $userCurrency = $this->getCurrencySite();
     $currencySymbol = WebSite::DEFAULT_CURRENCY;
     $currencyResult = $currencyDao->fetchOne(['code' => $userCurrency]);
     if ($currencyResult) {
         $currencySymbol = $currencyResult->getSymbol();
     }
     $currencyUtility = new Currency($currencyDao);
     $query_array = [];
     if ($arrival && $departure) {
         array_push($query_array, 'arrival=' . Helper::dateForUrl($arrival));
         array_push($query_array, 'departure=' . Helper::dateForUrl($departure));
         array_push($query_array, 'guest=' . $guest);
         $queryString = '?' . implode('&', $query_array);
     } elseif ($guest >= 1) {
         $queryString = '?guest=' . $guest;
     } elseif ($getAll) {
         $queryString = '?show=reviews';
     }
     $apartmentList = iterator_to_array($apartmentList);
     // add apartel id if apartel reservation
     if (isset($data['apartel'])) {
         $queryString .= ($queryString ? '&' : '?') . 'apartel_id=' . current($apartmentList)['apartment_group_id'];
     }
     foreach ($apartmentList as $al) {
         // Generate image
         $noImg = false;
         if ($al['img1']) {
             if ($img = Helper::getImgByWith($al['img1'], WebSite::IMG_WIDTH_SEARCH)) {
                 $noImg = true;
                 $al['image'] = $img;
             }
         }
         if (!$noImg) {
             $al['image'] = Constants::VERSION . 'img/no_image.png';
         }
         // Calculate percent
         if ($arrival && $departure) {
             $al['percent'] = round(($al['price_max'] - $al['price_min']) / $al['price_max'] * 100);
         } else {
             $al['percent'] = rand(10, 13);
             $al['rate_name'] = 'Non refundable';
         }
//.........这里部分代码省略.........
开发者ID:arbi,项目名称:MyCode,代码行数:101,代码来源:Search.php

示例4: getCityForLocation

 /**
  *
  * @return type
  */
 public function getCityForLocation()
 {
     /* @var $cityDao \DDD\Dao\Geolocation\Cities */
     $cityDao = $this->getCityDao();
     $cities = $cityDao->getCityForLocation();
     $cityList = [];
     $router = $this->getServiceLocator()->get('router');
     foreach ($cities as $city) {
         $cityProvince = $city['city_url'] . '--' . $city['province_url'];
         $cityList[] = ['city_id' => $city['id'], 'country_id' => $city['country_id'], 'img' => Helper::getImgByWith('/locations/' . $city['detail_id'] . '/' . $city['cover_image'], WebSite::IMG_WIDTH_LOCATION_MEDIUM, false, false, $city['detail_id']), 'url' => $router->assemble(['action' => 'location', 'cityProvince' => $cityProvince], ['name' => 'location/child']), 'apartment_url' => 'search?city=' . $city['city_url'] . '&show=all'];
     }
     return $cityList;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:17,代码来源:Location.php

示例5: getApartment

 public function getApartment($cityApartel)
 {
     $cityApartel = explode('--', $cityApartel);
     if (!isset($cityApartel[1]) || !ClassicValidator::checkApartmentTitle($cityApartel[0]) || !ClassicValidator::checkApartmentTitle($cityApartel[1])) {
         return false;
     }
     $apartel = $otherParams['apartel'] = $cityApartel[0];
     $city = $cityApartel[1];
     $generalDao = $this->getApartmentGeneralDao();
     $descrDao = $this->getDescriptionDao();
     $roomDao = $this->getRoomDao();
     $officeDao = new \DDD\Dao\Office\OfficeManager($this->getServiceLocator());
     $furnitureDao = $this->getFurnitureDao();
     $apartmentAmenitiesDao = $this->getAmenitiesDao();
     $buildingFacilitiesDao = $this->getFacilitiesDao();
     $general = $generalDao->getApartmentGeneralBySlug($apartel, Helper::urlForSearch($city, TRUE));
     if (!$general) {
         return false;
     }
     //change currency
     $userCurrency = $this->getCurrencySite();
     if ($userCurrency != $general['code']) {
         $currencyResult = $this->currencyConvert($general['price_avg'], $userCurrency, $general['code']);
         $general['price_avg'] = $currencyResult[0];
         $general['symbol'] = $currencyResult[1];
     }
     //images
     $imgDomain = DomainConstants::IMG_DOMAIN_NAME;
     $imgPath = Website::IMAGES_PATH;
     $images = [];
     $checkHasImage = false;
     foreach ($general as $key => $img) {
         if (strpos($key, 'img') !== false && $img) {
             $original = Helper::getImgByWith($img);
             $smallImg = Helper::getImgByWith($img, WebSite::IMG_WIDTH_AMARTMENT_SMALL);
             $bigImg = Helper::getImgByWith($img, WebSite::IMG_WIDTH_AMARTMENT_BIG);
             if ($original && $bigImg && $smallImg) {
                 $checkHasImage = true;
                 $images[] = ['domain' => $imgDomain, 'big' => $bigImg, 'small' => $smallImg, 'orig' => $original];
             }
         }
     }
     if (!$checkHasImage) {
         $noImg = Constants::VERSION . 'img/no_image.png';
         $images[] = ['domain' => $noImg, 'big' => $noImg, 'small' => $noImg, 'orig' => $noImg];
     }
     $otherParams['images'] = $images;
     //video
     if (isset($general['video']) && $general['video']) {
         $video = Helper::getVideoUrl($general['video']);
         if ($video) {
             $otherParams['video'] = ['video_screen' => $video, 'src' => $general['video']];
         }
     }
     //facilities
     $tempFacilitiesData = $buildingFacilitiesDao->getApartmentBuildingFacilities($general['aprtment_id']);
     $facilities = [];
     foreach ($tempFacilitiesData as $tempFacility) {
         $facilities[$tempFacility->getFacilityName()] = $tempFacility->getFacilityTextlineId();
     }
     unset($tempFacilitiesData);
     //amenities
     $tempAmenitiesData = $apartmentAmenitiesDao->getApartmentAmenities($general['aprtment_id']);
     $amenities = [];
     foreach ($tempAmenitiesData as $tempAmenity) {
         $amenities[$tempAmenity->getAmenityName()] = $tempAmenity->getAmenityTextlineId();
     }
     unset($tempAmenitiesData);
     if (isset($facilities['Parking']) && $facilities['Parking']) {
         $otherParams['parking'] = true;
     }
     if (isset($amenitiesData['Free Wifi']) && $amenitiesData['Free Wifi']) {
         $otherParams['internet'] = true;
     }
     //furniture
     $furnitureData = $furnitureDao->getFurnitureLits($general['aprtment_id']);
     $otherParams['furnitures'] = $furnitureData;
     /* @var $websiteSearchService \DDD\Service\Website\Search */
     $websiteSearchService = $this->getServiceLocator()->get('service_website_search');
     $diffHours = $websiteSearchService->getDiffHoursForDate();
     $otherParams['current'] = Helper::getCurrenctDateByTimezone($general['timezone'], 'd-m-Y', $diffHours);
     $general['city_name'] = $general['city_name'];
     $general['city_slug'] = $general['city_slug'];
     $otherParams['guestList'] = Objects::getGuestList(['guest' => $this->getTextLineSite(1455), 'guests' => $this->getTextLineSite(1456)], true);
     $params = ['general' => $general, 'amenities' => $amenities, 'facilities' => $facilities, 'otherParams' => $otherParams];
     return $params;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:87,代码来源:Apartment.php

示例6: getApartel

 /**
  * @param $pageSlug
  * @return array|bool
  */
 public function getApartel($pageSlug)
 {
     // explode slug and get apartel name city name
     $pageSlug = explode('--', $pageSlug);
     if (!isset($pageSlug[1]) || !ClassicValidator::checkApartmentTitle($pageSlug[0]) || !ClassicValidator::checkApartmentTitle($pageSlug[1])) {
         return false;
     }
     /**
      * @var $apartelDao \DDD\Dao\Apartel\General
      * @var $serviceLocation \DDD\Service\Website\Location
      * @var $relApartelDao \DDD\Dao\Apartel\RelTypeApartment
      * @var $apartelTypeDao \DDD\Dao\Apartel\Type
      * @var $apartmentService \DDD\Service\Website\Apartment
      */
     $apartelDao = $this->getServiceLocator()->get('dao_apartel_general');
     $serviceLocation = $this->getServiceLocator()->get('service_website_location');
     $apartelTypeDao = $this->getServiceLocator()->get('dao_apartel_type');
     $apartmentService = $this->getServiceLocator()->get('service_website_apartment');
     $router = $this->getServiceLocator()->get('router');
     $apartelSlug = $pageSlug[0];
     $apartelData = $apartelDao->getApartelDataForWebsite($apartelSlug);
     if (!$apartelData) {
         return false;
     }
     $data = [];
     $apartel = $pageSlug[0];
     $city = $pageSlug[1];
     $apartelId = $apartelData['id'];
     $data = $apartelData;
     $data['apartel'] = $apartel;
     $data['city'] = $city;
     $data['img'] = Helper::getImgByWith('/' . DirectoryStructure::FS_IMAGES_APARTEL_BG_IMAGE . $apartelId . '/' . $apartelData['bg_image']);
     $data['apartel_slug'] = $apartelSlug;
     // get options for search
     $dataOption['city_data']['timezone'] = $apartelData['timezone'];
     $options = $serviceLocation->getOptions($dataOption);
     // get review list
     $relApartelDao = $this->getServiceLocator()->get('dao_apartel_rel_type_apartment');
     $reviews = $relApartelDao->getReviewForWebsite($apartelId);
     // review score
     $reviewsScore = $relApartelDao->getReviewAVGScoreForYear($apartelId);
     //change currency
     $userCurrency = $this->getCurrencySite();
     // get room type data
     $roomTypeData = $apartelTypeDao->getRoomTypeForWebsite($apartelId);
     $roomTypes = [];
     foreach ($roomTypeData as $roomtype) {
         if ($userCurrency != $roomtype['code']) {
             $currencyResult = $apartmentService->currencyConvert($roomtype['price'], $userCurrency, $roomtype['code']);
             $roomtype['price'] = $currencyResult[0];
             $roomtype['symbol'] = $currencyResult[1];
         }
         if (strpos(strtolower($roomtype['name']), 'studio') !== false) {
             $roomtype['img'] = 'studio_one_bedroom.png';
             $roomtype['search_name'] = 'studio';
             $roomtype['code'] = $userCurrency;
             $roomtypeName = 'studio';
             $roomTypes[0] = $roomtype;
         } elseif (strpos(strtolower($roomtype['name']), 'one') !== false) {
             $roomtype['img'] = 'studio_one_bedroom.png';
             $roomtype['search_name'] = 'onebedroom';
             $roomtype['code'] = $userCurrency;
             $roomtypeName = 'onebedroom';
             $roomTypes[1] = $roomtype;
         } else {
             $roomtype['img'] = 'two_bedroom.png';
             $roomtype['search_name'] = 'twobedroom';
             $roomtype['code'] = $userCurrency;
             $roomtypeName = 'twobedroom';
             $roomTypes[2] = $roomtype;
         }
         $roomtype['search_url'] = "/search?apartel={$apartel}&guest=2&{$roomtypeName}=1";
     }
     ksort($roomTypes);
     return ['data' => $data, 'options' => $options, 'reviews' => $reviews, 'reviewsScore' => $reviewsScore, 'roomTypes' => $roomTypes];
 }
开发者ID:arbi,项目名称:MyCode,代码行数:80,代码来源:Apartel.php


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