$val){ if($key != "x" and $key != "y"){ $post[$key] = $val; } } /*クエリ取得(定型)*/ foreach ($_GET as $key => $val){ if($key != "x" and $key != "y"){ $get[$key] = $val; } } $assigns[] = array("FORM",$get); ///////サービスの検索条件をまとめる////// $get["OR_user_service"]=""; foreach($get as $k => $v){ if( strstr($k,"service_cate")){ if($get["OR_user_service"] !=""){ $get["OR_user_service"] .= ",";} $get["OR_user_service"] .= $v; } } ///////都道府県の検索条件をまとめる////// $get["OR_user_area"]=""; foreach($get as $k => $v){ if( strstr($k,"area_")){ if($get["OR_user_area"] !=""){ $get["OR_user_area"] .= ",";} $get["OR_user_area"] .= $v; } } ///////////////////公開ステータス取得/////////////////////// //////////////////////////////////////////////////////// /*SQL設定*/ $table_name = ""; $where = ""; $sort = ""; $order = ""; $table_name = "publish_status"; $order = "publish_status_sort ASC"; //SQL発行 $all_publish_status=serach($table_name,$where,$order,'9999','1'); $assigns[] = array("all_publish_status",$all_publish_status["result"]); //ハッシュ foreach($all_publish_status["result"] as $temp){ $publish_status_array[$temp["publish_status_id"]] = $temp["publish_status_name"]; } $assigns[] = array("publish_status_array",$publish_status_array); //////////////////////////////////////////////////////// //////////////////////////////////////////////////////// ///////////////////サービスカテゴリー取得/////////////////////// //////////////////////////////////////////////////////// /*SQL設定*/ $table_name = ""; $where = ""; $sort = ""; $order = ""; $table_name = "service_category"; $order = "service_category_sort ASC"; //SQL発行 $all_service_category=serach($table_name,$where,$order,'9999','1'); $assigns[] = array("all_service_category",$all_service_category["result"]); //ハッシュ foreach($all_service_category["result"] as $temp){ $service_array[$temp["service_category_id"]] = $temp["service_category_name"]; } $assigns[] = array("service_array",$service_array); //////////////////////////////////////////////////////// //////////////////////////////////////////////////////// ///////////////////都道府県取得/////////////////////// //////////////////////////////////////////////////////// /*SQL設定*/ $table_name = ""; $where = ""; $order = ""; $table_name = "area_category"; $order = "area_category_sort_number ASC"; //SQL発行 $all_pref=serach($table_name,$where,$order,'200','1'); $assigns[] = array("all_pref",$all_pref["result"]); //ハッシュ foreach($all_pref["result"] as $temp){ $area_array[$temp["area_category_id"]] = $temp["area_category_name"]; } $assigns[] = array("area_array",$area_array); //////////////////////////////////////////////////////// //////////////////////////////////////////////////////// //define("SQL","1"); //画像フィールドリスト for($i=1; $i < 2; $i++){ $photo_list[] = "user_picture".$i; } $assigns[] = array("photo_list",$photo_list); //////////////////////////////////////////////////////// ////////////////都道県別カウント///////////////////////// //////////////////////////////////////////////////////// //登録済みの全企業情報 $table_name = "`user`"; $where = "user.disp = 0 AND user_service REGEXP '^1$|^1,|,1$|,1,' AND user_publish_status = 1 AND user_ccf_hidden = 0 "; $lj = ""; $on = ""; $sl = "*"; $order = ""; $all_result=serach_all($table_name,$where,$order,99999,1,$lj,$on,$sl); //都道県別カウント初期値設定 $count_area=array(); foreach($all_pref["result"] as $temp){ $count_area["area_".$temp["area_category_id"]] = 0; } if($all_result["count"] > 0){ foreach($all_result["result"] as $temp){ //都道県別カウント $count_area["area_".$temp["user_area"]]++; $fix_all_result[] = $temp; } } //エリアカウント情報セット for($count = 1; $count <= 7; $count++){ $area_group["ag1"] = $area_group["ag1"] + $count_area["area_".$count]; }//北海道・東北地方 for($count = 8; $count <= 14; $count++){ $area_group["ag2"] = $area_group["ag2"] + $count_area["area_".$count]; }//関東 for($count = 15; $count <= 23; $count++){ $area_group["ag3"] = $area_group["ag3"] + $count_area["area_".$count]; }//中部 for($count = 24; $count <= 30; $count++){ $area_group["ag4"] = $area_group["ag4"] + $count_area["area_".$count]; }//近畿 for($count = 31; $count <= 35; $count++){ $area_group["ag5"] = $area_group["ag5"] + $count_area["area_".$count]; }//中国 for($count = 36; $count <= 39; $count++){ $area_group["ag6"] = $area_group["ag6"] + $count_area["area_".$count]; }//四国 for($count = 40; $count <= 47; $count++){ $area_group["ag7"] = $area_group["ag7"] + $count_area["area_".$count]; }//九州・沖縄 $assigns[] = array("count_area",$count_area); $assigns[] = array("area_group",$area_group); //////////////登録済みの企業情報////////////////// $table_name = "`user`"; $where = "user.disp = 0 AND user_service REGEXP '^1$|^1,|,1$|,1,' AND user_publish_status = 1 AND user_ccf_hidden = 0 "; $lj = ""; $on = ""; $sl = "*"; if(!$_GET["page"]){$_GET["page"] = 1;} //検索条件 if(isset($get)){ foreach ($get as $key => $val){ //完全一致 if(preg_match("/^S_/",$key) && $val != ""){ if($where != ""){ $where .= " AND ";} $where .= " ".ereg_replace("^S_", "", $key)." LIKE '".$val."' "; $url[] = URLSET($key,$val); } //完全一致(否定) if(preg_match("/^SN_/",$key) && $val != ""){ if($where != ""){ $where .= " AND ";} $where .= " ".ereg_replace("^SN_", "", $key)." NOT LIKE '".$val."' "; $url[] = URLSET($key,$val); } //カンマ区切り検索 if(preg_match("/^RS_/",$key) && $val != ""){ if($where != ""){ $where .= " AND ";} $where .= " ".ereg_replace("^RS_", "", $key)." REGEXP '^".$val."$|^".$val.",|,".$val."$|,".$val.",' "; $url[] = URLSET($key,$val); } //ORカンマ if(preg_match("/^OR_/",$key) && $val != ""){ if($where != ""){ $where .= " AND ";} $temp_array = explode(",", $val); $temp_where = " ( "; $temp_where_count = 0; foreach($temp_array as $temp){ if ($temp_where_count > 0){ $temp_where .= " OR ";} $temp_where .= " ".ereg_replace("^OR_", "", $key)." REGEXP '^".$temp."$|^".$temp.",|,".$temp."$|,".$temp.",' "; $temp_where_count++; } $temp_where .= " ) "; $where .= $temp_where; $url[] = URLSET($key,$val); } } } //URLセット function URLSET($T,$V){ $NT = $T."=".$v; return $NT; } //キーワード検索 if(isset($get['keywords']) && $get['keywords'] != ""){ $target = array( "user_name","user_number","user_ccf_number" ); $keywords_value = keywords($get['keywords'],$target); if($where != ""){ $where .= " AND ( ".$keywords_value['where']." ) "; }else{ $where .= $keywords_value['where']; } $url[] = $keywords_value['url']; } //順番 $order = "user.user_sort DESC, user.user_id DESC"; //表示件数 $_GET["max"] = 10; //SQL発行 //define("SQL","1"); $result=serach_all($table_name,$where,$order,$_GET["max"],$_GET["page"],$lj,$on,$sl); if($result["count"] > 0){ foreach($result["result"] as $temp){ //対応サービス $temp["user_service_array"] = array(); if($temp["user_service"] != ""){ $temp["user_service_array"] = explode(",", $temp["user_service"]); } //CCFフラグ追加 $user_service_array=array(); $temp["user_ccf_flg"]=""; if($temp["user_service"]){ $user_service_array=explode(",",$temp["user_service"]); if(in_array("1",$user_service_array)){ $temp["user_ccf_flg"] = 1; } } unset($user_service_array); //サムネイル画像URL foreach($photo_list as $photo){ $temp["thumbtype"][$photo] = preg_replace( "/^[0-9-]+/" ,"", $temp[$photo]); $temp["thumbname"][$photo] = preg_replace( "/".$temp["thumbtype"][$photo]."$/" ,"", $temp[$photo]); } $fix_result[] = $temp; } } //////////////////////////////////////////////////////// $assigns[] = array("result",$fix_result); $assigns[] = array("count",$result["count"]); $assigns[] = array("all_page",$result["all_page"]); $assigns[] = array("page",$result["page"]); //ページャー用URI生成 $pager_uri = ""; $base_uri="/treat/"; if(count($get) > 0){ foreach($get as $k => $v){ if($k != "page"){ if($QUERY_STRING !=""){ $QUERY_STRING .="&";} $QUERY_STRING.= $k."=".$v; } } } $pager_uri = $base_uri."?".$QUERY_STRING; $assigns[] = array("simple_uri",$base_uri); $assigns[] = array("pager_uri",$pager_uri); //SEO //未指定時のタイトル $SortName = '全てのCCF取扱店'; //温熱環境加盟企業 $S1 = $get["S_user_member_flg"]; $S1line = "温熱加盟済み"; //サービス種類 $S2 = $get["OR_user_service"]; $S2array =array(); $temp_array = explode(",",$S2); foreach($temp_array as $temp){ $S2array[]= $service_array[$temp]; } //都道府県指定(複数可) $S3 = $get["OR_user_area"]; $S3array =array(); $temp_array = explode(",",$S3); foreach($temp_array as $temp){ $S3array[]= $area_array[$temp]; } // フリーワード $S4 = $get["keywords"]; $S4s = mb_strimwidth($_GET["keywords"],0,15,"…"); $S4en = urlencode($S2); //検索条件カウント $Scount = 0; if(count($get)>0){ foreach($get as $k => $v){ if($k != "page" and $v != ""){ $Scount++; } } } ### 検索条件なし ### if( $Scount > 0){ ### 組み合わせ ### $SName=array(); if ( $S1 != ''){ $SName[] = $S1line;} if ( $S2 != ''){ foreach($S2array as $temp){ $SName[] = $temp;} } if ( $S3 != ''){ foreach($S3array as $temp){ $SName[] = $temp;} } if ( $S4 != ''){ $SName[] = "「".$S4."」を含む";} } ////////タイトル決定//////// if( $Scount == 0){ $SNameTitle = $SortName; }else{ $SNameTitle = "登録企業(".implode(" × ", $SName).")"; } ############################# # メタ情報生成 # ############################# if(count($SName) > 0){ $SKEY = "CCF,取扱店". implode(",", $SName); $seo_description = "CCF取扱店(".implode(" × ", $SName).")"; }else{ $SKEY = "CCF,取扱店"; $seo_description = "CCF取扱店"; } if($result["page"] > 1){ $SNameTitle .= ":".$result["page"]."ページ目"; $seo_description .= ":".$result["page"]."ページ目"; $SKEY .= ":".$result["page"]."ページ目"; } $assigns[] = array("result_info",$SName[0]); $assigns[] = array("seo_title",$SNameTitle); $assigns[] = array("seo_keywords",$SKEY); $assigns[] = array("seo_description",$seo_description); //件数表示(start) if($result["count"] == 0){ $start_num = 0; }elseif($_GET["page"] > 1){ $start_num = ($result["page"] - 1) * $max + 1; }else{ $start_num = 1;} //件数表示(end) if($result["count"] == 0){ $end_num = 0; }elseif($_GET["page"] == $result["all_page"]){ $end_num = $result["count"]; }else{ $end_num = $result["page"] * $max; } $assigns[] = array("start_num",$start_num); $assigns[] = array("end_num",$end_num); //検索結果用表示作成 $pager = search_sub($pager_uri,$result["all_page"],$result["page"]); $assigns[] = array("pager",$pager); $main_tpl="ccf/treat/index.tpl"; /*画面出力*/ $disp = new DISP; $disp->assigns=$assigns; $disp->main_tpl=$main_tpl; $disp->display(); exit(); ?>