setTable("cms_companion_data INNER JOIN cms_sch_data ON cms_companion_data.companion_id = cms_sch_data.sch_companion_id "); $a_variable = "*"; $query->addColumn($a_variable); $query->setWhere("companion_hide = 1 AND companion_pickup = 1"); /* setOrderBy(), setGroupBy(), setHaving() */ $query->setGroupBy("companion_id ORDER BY companion_sort_no"); $sql_query = $query->buildQuery(); $result = $dbconnect->fetch($sql_query); $smarty->assign("result", $result ); //******************************************************************* //******************************************************************* // 鎥μETtypeѥ᡼ȽǡʥǥեȎ˻ $type = 'a'; if(isset($_GET['type'])) { $type = $_GET['type']; } else { header( "Location: $_SERVER[REQUEST_URI]?type=".$type); exit(); } $smarty->assign("ranking_type", $type); //******************************************************************* //******************************************************************* //SELECT ܡ νжϿѥꥹȥå $today_lag_date = lag_date(LAG_HOUR);// ɤ߹ $query = new SqlQueryS("SELECT"); $query->setTable("cms_companion_data INNER JOIN cms_sch_data ON cms_companion_data.companion_id = cms_sch_data.sch_companion_id "); //$query->setTable("cms_companion_data //INNER JOIN cms_co_sc_id ON cms_companion_data.companion_id = cms_co_sc_id.companion_co_sc_id //INNER JOIN cms_sch_data ON cms_co_sc_id.sch_co_sc_id = cms_sch_data.sch_id //"); $a_variable = "*"; $query->addColumn($a_variable); //$query->setWhere("companion_id"); $query->setWhere("companion_hide >= 0"); /* setOrderBy(), setGroupBy(), setHaving() */ $query->setGroupBy("companion_id"); $query->setOrderBy("companion_sort_no"); $sql_query = $query->buildQuery(); $result = $dbconnect->fetch($sql_query); //print($sql_query); if(!get_magic_quotes_gpc()){ $result2 = stripslashes_deep($result); }else{ $result2 = $result; } //ɽ玤¤ؤ switch($type) { case 'a': $column_name = "companion_ranking_a"; break; case 'b': $column_name = "companion_ranking_b"; break; case 'c': $column_name = "companion_ranking_c"; break; } foreach($result2 as $key => $val) { //print_r($val); if((int)$val["cms_companion_data.".$column_name] >= 1) { $buf[$key] = $val["cms_companion_data.".$column_name]; } else { $buf[$key] = 6; } } array_multisort($buf, SORT_ASC, $result2); // // 鎥 foreach($buf as $key => $val) { if($val == 6) { unset($result2[$key]); } } $smarty->assign("sch_y", $result2 ); //print_r($result2); //******************************************************************* $rankinglevel = array(1,2,3,4,5); $smarty->assign('custid',$rankinglevel); //******************************************************************* // ХюϤ $smarty->assign("sch_place", $sch_place); $smarty->assign("sch_place_img", $sch_place_img); //******************************************************************* //******************************************************************* // Ԥ ХюϤ $wait_time_num = array(); $wait_set = array(); foreach($result2 as $key => $val) { $wait_time_num[$key] = $sch_wait[$val["cms_sch_data.sch_wait"]]; $wait_set[$key] = floor($wait_time_num[$key] - dist_minute($val["cms_sch_data.sch_wait_set"])); if($wait_set[$key] < 0) { $wait_set[$key] = 0; } } $smarty->assign("wait_time_num", $wait_time_num); $smarty->assign("wait_time", $sch_wait ); $smarty->assign("sch_wait_img", $sch_wait_img); $smarty->assign("wait_set", $wait_set ); //******************************************************************* //******************************************************************* //type SELECT $query = new SqlQueryS("SELECT"); $query->setTable("cms_type_data"); $a_variable = "*"; $query->addColumn($a_variable); $query->setWhere("type_id"); /* setOrderBy(), setGroupBy(), setHaving() */ $query->setOrderBy("type_id ASC LIMIT 100"); $sql_query = $query->buildQuery(); $t_result = $dbconnect->fetch($sql_query); $smarty->assign("comp_type", $t_result ); //******************************************************************* //******************************************************************* //SELECT Źޡ $query = new SqlQueryS("SELECT"); $query->setTable("cms_admin_data"); $a_variable = "*"; $query->addColumn($a_variable); //$query->setWhere("companion_id"); $query->setWhere("admin_id"); /* setOrderBy(), setGroupBy(), setHaving() */ $query->setOrderBy("admin_id DESC LIMIT 1"); $sql_query = $query->buildQuery(); $result = $dbconnect->fetch($sql_query); if(!get_magic_quotes_gpc()){ $result_shop = stripslashes_deep($result); }else{ $result_shop = $result; } $smarty->assign("shop", $result_shop ); //******************************************************************* //******************************************************************* // $cookie_val = explode("\t", $_COOKIE['c_cms_db_login']); //print_r($cookie_val); $smarty->assign("ck_id", $cookie_val[0]); $smarty->assign("ck_passwd", $cookie_val[1]); //******************************************************************* //******************************************************************* // 塼ط(cms_sch_dataơ֥Ύѿ֤) //print_r($result2); foreach($result2 as $key => $val) { $db_sch_data[$key]["sch_id"] = $val["cms_sch_data.sch_id"]; $db_sch_data[$key]["sch_date"] = $val["cms_sch_data.sch_date"]; $db_sch_data[$key]["sch_time_text1"] = $val["cms_sch_data.sch_time_text1"]; $db_sch_data[$key]["sch_time_text2"] = $val["cms_sch_data.sch_time_text2"]; $db_sch_data[$key]["sch_flag"] = $val["cms_sch_data.sch_flag"]; $db_sch_data[$key]["sch_place"] = $val["cms_sch_data.sch_place"]; $db_sch_data[$key]["sch_wait"] = $val["cms_sch_data.sch_wait"]; $db_sch_data[$key]["sch_wait_set"] = $val["cms_sch_data.sch_wait_set"]; } $smarty->assign("db_sch_data", $db_sch_data); //print_r($db_sch_data); //******************************************************************* //******************************************************************* $smarty->assign("today_lag_date", lag_date(LAG_HOUR) ); //******************************************************************* //******************************************************************* $smarty->assign("comp_list_table_cols", COMP_LIST_TABLE_COLS ); //******************************************************************* //******************************************************************* $smarty->assign("url_back", $_SERVER[HTTP_REFERER]); //******************************************************************* $smarty->display(basename($_SERVER['SCRIPT_NAME'],".html").".tpl"); ?>