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


PHP BFCHelper::setFilterSearchParamsSession方法代码示例

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


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

示例1: filterResults

 private function filterResults($results)
 {
     $params = $this->getState('params');
     $filters = null;
     if (!empty($params['filters'])) {
         $filters = $params['filters'];
     }
     if ($filters == null) {
         //provo a recuperarli dalla sessione...
         $filters = BFCHelper::getFilterSearchParamsSession();
     }
     if ($filters == null) {
         return $results;
     }
     BFCHelper::setFilterSearchParamsSession($filters);
     // zone filtering
     if (!empty($filters['locationzones']) && is_array($results)) {
         $locationzones = $filters['locationzones'];
         $locationzones = explode(",", $locationzones);
         if (is_array($locationzones) || $locationzones != "0") {
             $results = array_filter($results, function ($result) use($locationzones) {
                 return is_array($locationzones) && (in_array($result->MrcZoneId, $locationzones) || in_array($result->ResZoneId, $locationzones)) || ($result->MrcZoneId == $locationzones || $result->ResZoneId == $locationzones);
             });
         }
     }
     // merchantgroups filtering
     if (!empty($filters['merchantgroups']) && is_array($results)) {
         $merchantgroups = $filters['merchantgroups'];
         $merchantgroups = explode(",", $merchantgroups);
         if (is_array($merchantgroups)) {
             //if ($stars > 0) {
             $results = array_filter($results, function ($result) use($merchantgroups) {
                 $hasTags = false;
                 $val = preg_replace('/\\s+/', '', $result->MrcTagsIdList);
                 $merchantGroupIdList = explode(",", $val);
                 if (is_array($merchantGroupIdList)) {
                     $arrayresult = array_intersect($merchantgroups, $merchantGroupIdList);
                     $hasTags = count($arrayresult) > 0;
                 } else {
                     $hasTags = is_array($merchantgroups) && in_array($merchantGroupIdList, $merchantgroups) || $merchantGroupIdList == $merchantgroups;
                 }
                 $val = preg_replace('/\\s+/', '', $result->TagsIdList);
                 $merchantGroupIdList = explode(",", $val);
                 if (is_array($merchantGroupIdList)) {
                     $arrayresult = array_intersect($merchantgroups, $merchantGroupIdList);
                     $hasTags = $hasTags || count($arrayresult) > 0;
                 } else {
                     $hasTags = $hasTags || (is_array($merchantgroups) && in_array($merchantGroupIdList, $merchantgroups) || $merchantGroupIdList == $merchantgroups);
                 }
                 return $hasTags;
             });
         }
     }
     //		// services filtering
     //		if (!empty($filters['services']) && is_array($results)) {
     //			$services = $filters['services'];
     //			$services = explode(",", $services);
     //			if (is_array($services)){
     //				$results = array_filter($results, function($result) use ($services) {
     //					$merchantServiceIdList = explode(",",$result->MrcServiceIdList);
     //					$resourceServiceIdList = explode(",",$result->ResServiceIdList);
     //					$serviceIdList = array_merge($merchantServiceIdList,$resourceServiceIdList);
     //					if (is_array($serviceIdList)) {
     //						$arrayresult = array_intersect($services, $serviceIdList);
     //						return (count($arrayresult)==count($services));
     //
     //					}else{
     //						return ((is_array($services) && in_array( $serviceIdList, $services )) || $serviceIdList == $services  );
     //					}
     //				});
     //			}
     //		}
     // services filtering resource
     if (!empty($filters['services']) && is_array($results)) {
         $services = $filters['services'];
         $services = explode(",", $services);
         if (is_array($services)) {
             $results = array_filter($results, function ($result) use($services) {
                 $serviceIdList = explode(",", $result->ResServiceIdList);
                 if (is_array($serviceIdList)) {
                     $arrayresult = array_intersect($services, $serviceIdList);
                     return count($arrayresult) == count($services);
                 } else {
                     return is_array($services) && in_array($serviceIdList, $services) || $serviceIdList == $services;
                 }
             });
         }
     }
     // services filtering merchants
     if (!empty($filters['servicesmerchants']) && is_array($results)) {
         $services = $filters['servicesmerchants'];
         $services = explode(",", $services);
         if (is_array($services)) {
             $results = array_filter($results, function ($result) use($services) {
                 $serviceIdList = explode(",", $result->MrcServiceIdList);
                 if (is_array($serviceIdList)) {
                     $arrayresult = array_intersect($services, $serviceIdList);
                     return count($arrayresult) == count($services);
                 } else {
                     return is_array($services) && in_array($serviceIdList, $services) || $serviceIdList == $services;
//.........这里部分代码省略.........
开发者ID:Bookingfor,项目名称:joomla-extension-v-2,代码行数:101,代码来源:search.php

示例2: filterResults

 private function filterResults($results)
 {
     $params = $this->getState('params');
     $filters = null;
     if (!empty($params['filters'])) {
         $filters = $params['filters'];
     }
     if ($filters == null) {
         //provo a recuperarli dalla sessione...
         $filters = BFCHelper::getFilterSearchParamsSession();
     }
     if ($filters == null) {
         return $results;
     }
     BFCHelper::setFilterSearchParamsSession($filters);
     // zone filtering
     if (!empty($filters['locationzones']) && is_array($results)) {
         $locationzones = $filters['locationzones'];
         $locationzones = explode(",", $locationzones);
         if (is_array($locationzones) || $locationzones != "0") {
             $results = array_filter($results, function ($result) use($locationzones) {
                 return is_array($locationzones) && (in_array($result->MrcZoneId, $locationzones) || in_array($result->ResZoneId, $locationzones)) || ($result->MrcZoneId == $locationzones || $result->ResZoneId == $locationzones);
             });
         }
     }
     // merchantgroups filtering
     if (!empty($filters['merchantgroups']) && is_array($results)) {
         $merchantgroups = $filters['merchantgroups'];
         //			echo "<pre>";
         //			echo print_r($mastertypologies);
         //			echo "</pre>";
         $merchantgroups = explode(",", $merchantgroups);
         if (is_array($merchantgroups)) {
             //if ($stars > 0) {
             $results = array_filter($results, function ($result) use($merchantgroups) {
                 $val = preg_replace('/\\s+/', '', $result->MrcGroupIdList);
                 $merchantGroupIdList = explode(",", $val);
                 if (is_array($merchantGroupIdList)) {
                     $arrayresult = array_intersect($merchantgroups, $merchantGroupIdList);
                     return count($arrayresult) > 0;
                 } else {
                     return is_array($merchantgroups) && in_array($merchantGroupIdList, $merchantgroups) || $merchantGroupIdList == $merchantgroups;
                 }
             });
         }
     }
     // services filtering
     if (!empty($filters['services']) && is_array($results)) {
         $services = $filters['services'];
         //			echo "<pre>";
         //			echo print_r($services);
         //			echo "</pre>";
         $services = explode(",", $services);
         if (is_array($services)) {
             $results = array_filter($results, function ($result) use($services) {
                 $merchantServiceIdList = explode(",", $result->MrcServiceIdList);
                 $resourceServiceIdList = explode(",", $result->ResServiceIdList);
                 $serviceIdList = array_merge($merchantServiceIdList, $resourceServiceIdList);
                 if (is_array($serviceIdList)) {
                     $arrayresult = array_intersect($services, $serviceIdList);
                     //return (count($arrayresult)>0);
                     //21/11/2014
                     /// modifica per ritornare solo quelli che hanno TUTTI i servizi selezionati
                     return count($arrayresult) == count($services);
                 } else {
                     return is_array($services) && in_array($serviceIdList, $services) || $serviceIdList == $services;
                 }
             });
         }
     }
     // mastertypologies filtering
     if (!empty($filters['mastertypologies']) && is_array($results)) {
         $mastertypologies = $filters['mastertypologies'];
         $mastertypologies = explode(",", $mastertypologies);
         if (is_array($mastertypologies)) {
             //if ($stars > 0) {
             $results = array_filter($results, function ($result) use($mastertypologies) {
                 return is_array($mastertypologies) && in_array($result->MasterTypologyId, $mastertypologies) || $result->MasterTypologyId == $mastertypologies;
             });
         }
     }
     // stars filtering
     if (!empty($filters['stars']) && is_array($results)) {
         $stars = $filters['stars'];
         $stars = explode(",", $stars);
         if (is_array($stars) || $stars != "0") {
             $results = array_filter($results, function ($result) use($stars) {
                 return is_array($stars) && (in_array($result->MrcRating, $stars) || $result->MrcRating == $stars || in_array($result->ResRating, $stars)) || $result->ResRating == $stars;
             });
         }
     }
     // bookingTypes filtering
     if (!empty($filters['bookingtypes']) && is_array($results)) {
         $bookingTypes = $filters['bookingtypes'];
         $stars = explode(",", $bookingTypes);
         if (is_array($bookingTypes) || $bookingTypes != "0") {
             $results = array_filter($results, function ($result) use($bookingTypes) {
                 return is_array($bookingTypes) && in_array($result->BookingType, $bookingTypes) || $result->BookingType == $bookingTypes;
             });
         }
//.........这里部分代码省略.........
开发者ID:Bookingfor,项目名称:joomla-extension,代码行数:101,代码来源:search.php


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