本文整理汇总了PHP中Library\Utility\Helper::urlForSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::urlForSearch方法的具体用法?PHP Helper::urlForSearch怎么用?PHP Helper::urlForSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library\Utility\Helper
的用法示例。
在下文中一共展示了Helper::urlForSearch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
public function __invoke($options = array())
{
$render = array_key_exists('render', $options) ? $options['render'] : true;
$searchService = $this->getServiceLocator()->get('service_website_search');
$options = $searchService->getOptions();
$request = $this->getServiceLocator()->get('request');
$getParams = $request->getQuery();
$setParams = [];
if (isset($getParams['city']) && ClassicValidator::checkCityName($getParams['city'])) {
$setParams['city_url'] = $getParams['city'];
$city = Helper::urlForSearch($getParams['city']);
// $setParams['city'] = ;
if (isset($getParams['guest'])) {
$setParams['guest'] = $getParams['guest'];
}
$date = $searchService->getFixedDate($getParams);
$setParams['arrival'] = $date['arrival'];
$setParams['departure'] = $date['departure'];
}
$vm = new ViewModel(['options' => $options, 'setParams' => $setParams]);
$vm->setTemplate($this->viewTemplate);
return $render ? $this->getView()->render($vm) : $vm;
}
示例2: filterReservationData
/**
* @param array $data
* @return string
*/
private function filterReservationData($data)
{
$currentDate = date('Y-m-d');
$cityDao = new City($this->getServiceLocator(), 'ArrayObject');
if (isset($data['city']) && ClassicValidator::checkCityName($data['city'])) {
$cityResp = $cityDao->getCityByName(Helper::urlForSearch($data['city']));
if ($cityResp) {
/* @var $websiteSearchService \DDD\Service\Website\Search */
$websiteSearchService = $this->getServiceLocator()->get('service_website_search');
$diffHours = $websiteSearchService->getDiffHoursForDate();
$currentDate = Helper::getCurrenctDateByTimezone($cityResp['timezone'], 'd-m-Y', $diffHours);
}
}
if (!isset($data['city']) || !ClassicValidator::checkCityName($data['city']) || !isset($data['apartment']) || !ClassicValidator::checkApartmentTitle($data['apartment']) || !isset($data['guest']) || !is_numeric($data['guest']) || !isset($data['apartment_id']) || !is_numeric($data['apartment_id']) || !isset($data['arrival']) || !ClassicValidator::validateDate($data['arrival'], 'd M Y') || !isset($data['departure']) || !ClassicValidator::validateDate($data['departure'], 'd M Y') || strtotime($data['arrival']) >= strtotime($data['departure']) || strtotime($currentDate) - strtotime($data['arrival']) > 129600 || !isset($data['rate-for-booking']) || !is_numeric($data['rate-for-booking']) || isset($data['apartel_id']) && !is_numeric($data['apartel_id'])) {
return false;
}
return true;
}
示例3: getPoiData
/**
* @param int $cityId
* @param string $poiSlug
* @return boolean
*/
public function getPoiData($cityId, $poiSlug)
{
if (!$poiSlug || !ClassicValidator::checkCityName($poiSlug)) {
return false;
}
/* @var $poiDao \DDD\Dao\Geolocation\Poi */
$poiDao = $this->getPoiDao();
$poi = $poiDao->getPoiDataBySlug($cityId, Helper::urlForSearch($poiSlug, TRUE));
if ($poi) {
$poi['img'] = Helper::getImgByWith('/locations/' . $poi['detail_id'] . '/' . $poi['cover_image'], WebSite::IMG_WIDTH_LOCATION_BIG);
}
return $poi;
}
示例4: getBreadcrumbParams
/**
*
* @param string $controller
* @param string $action
* @param string $routeParam
* @param ArrayObject $getQuery
* @return boolean
*/
public function getBreadcrumbParams($controller = false, $action = false, $routeParam = false, $getQuery = false)
{
$noSecureDomain = '//' . \Library\Constants\DomainConstants::WS_DOMAIN_NAME;
if (!$controller || !$action) {
return false;
}
$controller = strtolower($controller);
$action = strtolower($action);
$controller = str_replace('website\\controller\\', '', $controller);
$params[] = ['name' => $this->getTextline(1449), 'url' => '/'];
switch ($controller) {
case 'search':
$params[] = ['name' => $this->getTextline(1322), 'url' => '/location'];
if ($cityName = $this->getNameFromQuery($getQuery, 'city')) {
$params[] = ['name' => $cityName, 'url' => ''];
}
break;
case 'apartment':
$apartmentTitle = isset($routeParam['apartmentTitle']) ? $routeParam['apartmentTitle'] : '';
$cityProvince = $provinceUrl = $apartment = $cityName = '';
if ($apartmentTitle) {
$cityParams = explode('--', $apartmentTitle);
$cityUrl = $cityParams[1];
$apartmentName = $cityParams[0];
$generalDao = new General($this->getServiceLocator(), 'ArrayObject');
$generalResult = $generalDao->getBreadcrupDataByCityApartment($apartmentName, Helper::urlForSearch($cityUrl));
if ($generalResult) {
$provinceUrl = $generalResult['prov_name'];
$cityName = $generalResult['city_name'];
$apartment = $generalResult['name'];
}
$cityProvince = $cityUrl . '--' . Helper::urlForSite($provinceUrl);
}
$params[] = ['name' => $this->getTextline(865), 'url' => '/location'];
if ($cityName) {
$params[] = ['name' => $cityName, 'url' => '/location/' . $cityProvince];
}
if ($apartment) {
$params[] = ['name' => $apartment . ' ' . $this->getTextline(1418), 'url' => ''];
}
break;
case 'aboutus':
if ($action == 'index') {
$params[] = ['name' => $this->getTextline(1440), 'url' => ''];
} elseif ($action == 'privacy-policy') {
$params[] = ['name' => $this->getTextline(1371), 'url' => ''];
} elseif ($action == 'terms-and-conditions') {
$params[] = ['name' => $this->getTextline(1373), 'url' => ''];
}
break;
case 'contactus':
$params[] = ['name' => $this->getTextline(1353), 'url' => ''];
break;
case 'faq':
$params[] = ['name' => $this->getTextline(1379), 'url' => ''];
break;
case 'location':
if ($action == 'index') {
$params[] = ['name' => $this->getTextline(1320), 'url' => ''];
} else {
$params[] = ['name' => $this->getTextline(1320), 'url' => '/location'];
$cityProvince = isset($routeParam['cityProvince']) ? $routeParam['cityProvince'] : '';
$locationService = $this->getServiceLocator()->get('service_website_location');
$cityResponse = $locationService->getCityByProvincCity($cityProvince);
$city = isset($cityResponse['city_data']['city_name']) ? $cityResponse['city_data']['city_name'] : '';
if (isset($routeParam['poi'])) {
$params[] = ['name' => $city, 'url' => '/location/' . $cityProvince];
$params[] = ['name' => $this->getNameFromRoute($routeParam['poi'], 0), 'url' => ''];
} else {
$params[] = ['name' => $city, 'url' => ''];
}
}
break;
case 'blog':
if ($action == 'index') {
$params[] = ['name' => $this->getTextline(1331), 'url' => ''];
} else {
$blogTitel = isset($routeParam['article']) ? $routeParam['article'] : '';
$params[] = ['name' => $this->getTextline(1331), 'url' => '/blog'];
$params[] = ['name' => $this->getNameFromRoute($blogTitel, 0), 'url' => ''];
}
break;
case 'news':
if ($action == 'index') {
$params[] = ['name' => $this->getTextline(1417), 'url' => ''];
} else {
$blogTitel = isset($routeParam['article']) ? $routeParam['article'] : '';
$params[] = ['name' => $this->getTextline(1417), 'url' => '/news'];
$params[] = ['name' => $this->getNameFromRoute($blogTitel, 0), 'url' => ''];
}
break;
case 'jobs':
//.........这里部分代码省略.........
示例5: filterQueryData
/**
* @param array $data
* @return string
*/
public function filterQueryData($data)
{
$currentDate = date('Y-m-d');
$cityDao = new City($this->getServiceLocator(), 'ArrayObject');
if (!isset($data['city'])) {
$pageSlugExp = explode('--', $data['slug']);
$citySlug = $pageSlugExp[1];
} else {
$citySlug = $data['city'];
}
if (isset($citySlug) && ClassicValidator::checkCityName($citySlug)) {
$cityResp = $cityDao->getCityBySlug(Helper::urlForSearch($citySlug, TRUE));
if ($cityResp) {
/* @var $websiteSearchService \DDD\Service\Website\Search */
$websiteSearchService = $this->getServiceLocator()->get('service_website_search');
$diffHours = $websiteSearchService->getDiffHoursForDate();
$currentDate = Helper::getCurrenctDateByTimezone($cityResp['timezone'], 'd-m-Y', $diffHours);
}
}
if (!isset($data['arrival']) || !ClassicValidator::validateDate($data['arrival']) || !isset($data['departure']) || !ClassicValidator::validateDate($data['departure']) || strtotime($data['arrival']) < strtotime($currentDate) || strtotime($data['arrival']) >= strtotime($data['departure'])) {
return false;
}
return true;
}