read("./template/shop_".$lang.".html"); //やまやの食卓 $company_cd = G_COMPANY_SHOKUTAKU; $shop_cate_cd = 9; $close_day_flg = false; $loop_prefix = "yamashoku_"; disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix); //須弥山 $shop_cate_cd = 10; $close_day_flg = false; $loop_prefix = "sumisen_"; disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix); //やまやコミュニケーションズ $company_cd = G_COMPANY_YAMAYA; $shop_cate_cd = 6; $close_day_flg = false; $loop_prefix = "yamaya_"; disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix); //やまや食工房 $company_cd = G_COMPANY_MOTSU; $shop_cate_cd = 1; $close_day_flg = true; $loop_prefix = "shokukobo_"; disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix); //博多Kitchen YAMAYA $company_cd = G_COMPANY_MOTSU; $shop_cate_cd = 3; $close_day_flg = true; $loop_prefix = "kitchen_"; disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix); //博多めんたい やまや食堂 $company_cd = G_COMPANY_MOTSU; $shop_cate_cd = 4; $close_day_flg = true; $loop_prefix = "hakatamentai_"; disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix); //博多天ぷらやまみ $company_cd = G_COMPANY_MOTSU; $shop_cate_cd = 2; $close_day_flg = true; $loop_prefix = "tenpurayamami_"; disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix); //ごはんとわたし $company_cd = G_COMPANY_MOTSU; $shop_cate_cd = 12; $close_day_flg = true; $loop_prefix = "gohantowatashi_"; disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix); $tmpl->assign("analysis_tag",file_get_contents($_SERVER['DOCUMENT_ROOT']."/include/analysis.php")); $tmpl->flush(); exit; function disp_shop_cate_table($company_cd,$shop_cate_cd,$close_day_flg,$loop_prefix){ global $tmpl,$lang; $area_list = get_area_list($company_cd,$shop_cate_cd); $tmpl->loopset($loop_prefix."area_loop"); $prefecture_labels = SF_CommonUtil::getPrefectureList($lang); foreach($area_list as $area_cd => $area_name){ $tmpl->assign("area_name",$area_name); $prefecture_list = get_prefecture_list($company_cd,$shop_cate_cd,$area_cd); $tmpl->loopset($loop_prefix."prefecture_loop"); foreach($prefecture_list as $prefecture_cd){ $tmpl->assign("prefecture_name",$prefecture_labels[$prefecture_cd]); $tmpl->assign("shop_list",get_shop_list($company_cd,$shop_cate_cd,$area_cd,$prefecture_cd,$close_day_flg,$lang,"JPN")); $tmpl->loopnext(); } $tmpl->loopend(); $tmpl->loopnext(); } $tmpl->loopend(); } function get_shop_list($company_cd, $category_cd, $area_cd, $prefecture_cd, $close_day_flg, $lang, $country){ $db = ITSDB::getInstance(); if($company_cd == G_COMPANY_YAMAYA){ $order = "view_no asc, prefecture_cd asc ,area_cd desc"; }elseif($company_cd == G_COMPANY_MOTSU){ $order = "view_no asc, shop_name asc, area_cd asc"; }elseif(G_COMPANY_SHOKUTAKU){ $order = "view_no asc, area_cd asc"; } $sql = " select id ,shop_cd from d_shop where language_cd = ? and country_cd = ? and company_cd = ? and shop_cate_cd = ? and area_cd = ? and del_flg = 0 "; $con = array($lang,$country,$company_cd,$category_cd,$area_cd); if($area_cd != 5){ $sql .= " and prefecture_cd = ? "; array_push($con,$prefecture_cd); } $sql .= " order by ".$order." "; $result = $db->getRows($sql,$con); $html = ""; while($row = $result->fetchRow()){ $s = new d_shop(); if(!$s->readById($row['id'])){ continue; } $ad = $s->getValue("address_1") .$s->getValue("address_2") .$s->getValue("address_3"); $url = $s->getValue("map_url"); $url_label = "Google Map"; $map_link = ''; if($url){ $map_link = "[{$url_label}]"; } $close_day= ""; if($s->getValue("close_day")){ $close_day = $s->getValue("close_day").""; } $tel = ""; if($s->getValue("free_tel")){ $tel .= "FREE_DIAL".$s->getValue("free_tel")."
"; } if($s->getValue("tel")){ $tel .= "TEL".$s->getValue("tel"); } //オープン日表示切替 $open_label = ""; $odate = $s->getValue("open_date"); if($odate != '' and $odate != '0000-00-00'){ $oday = date("n/j",strtotime($odate)); $open_label .= "".$oday."open!
"; } if($close_day_flg){ $html .= << {$open_label}{$s->getValue("shop_name")} {$ad}{$map_link}
{$tel} {$s->getValue("open_hour")} {$s->getValue("close_day")} EOM; }else{ $close_str = ""; if($s->getValue("close_day")){ $close_str = get_closed_day_str($lang).":"; } $html .= << {$open_label}{$s->getValue("shop_name")} {$ad}{$map_link}
{$tel} {$s->getValue("open_hour")}
{$close_str}{$s->getValue("close_day")} EOM; } } return $html; } function get_area_list($company_cd,$shop_cate_cd){ global $lang; //店舗が存在するエリアだけ抽出する $db = ITSDB::getInstance(); $sql = " select a.area_cd ,a.area_name from m_area as a inner join d_shop as s on s.area_cd = a.area_cd where s.company_cd = ? and s.shop_cate_cd = ? and s.language_cd = ? group by a.area_cd order by a.view_no asc "; $result = $db->getRows($sql,$company_cd,$shop_cate_cd,$lang); $ret = []; while($row = $result->fetchRow()){ $ret[$row['area_cd']] = $row['area_name']; } return $ret; } //店舗が存在する県だけ抽出する function get_prefecture_list($company_cd,$shop_cate_cd,$area_cd){ global $lang; $db = ITSDB::getInstance(); $sql = " select s.prefecture_cd from d_shop as s where s.company_cd = ? and s.shop_cate_cd = ? and s.area_cd = ? and s.language_cd = ? and s.del_flg = 0 group by s.prefecture_cd order by s.prefecture_cd asc "; $result = $db->getRows($sql,$company_cd,$shop_cate_cd,$area_cd,$lang); $ret = []; while($row = $result->fetchRow()){ array_push($ret,$row['prefecture_cd']); } return $ret; } function get_country_list($company_cd,$shop_cate_cd,$area_cd){ $db = ITSDB::getInstance(); $sql = " select s.country_cd from d_shop as s where s.company_cd = ? and s.shop_cate_cd = ? and s.area_cd = ? group by s.country_cd order by s.country_cd asc "; $result = $db->getRows($sql,$company_cd,$shop_cate_cd,$area_cd); $ret = []; while($row = $result->fetchRow()){ array_push($ret,$row['country_cd']); } return $ret; } function get_closed_day_str($lang){ if($lang == "en"){ return "Closed Days"; } if($lang == "ko"){ return "정기휴무일"; } if($lang == "zh-cn" || $lang == "zh-tw"){ return "定休日"; } return "Closed Days"; }