db = cs4_open(); $kind_arr = bsc_get_rcp_kind($this->db); $show_line = 3; $p['page'] = (!empty($p['page']) && '0' < $p['page']) ? $p['page'] : '1'; //- カツ代チェックレシピcsv取得 $csv_bbs = get_csvdata('bbs'); $start = (($p['page'] - 1) * $show_line) + 1; for($i=$start ; $i < count($csv_bbs) && $i < ($p['page'] * $show_line) + 1 ;$i++){ $line_arr = explode(",",$csv_bbs[$i]); if(is_numeric(trim($line_arr[0]))){ $bbs_rcp_arr[] = get_rcpDetail_ristrict($this->db, $line_arr[0],2); } } //- ユーザ情報取得 for($i=0;$isetCurrentBlock('__RecipeList__'); $template->setVariable('rcp_no',$bbs_rcp_arr[$i][0]['uniq_id']); $template->setVariable('title',$bbs_rcp_arr[$i][0]['rcp_nm']); if(!empty($user[$bbs_rcp_arr[$i][0]['uniq_id']])){ $template->setVariable('user_no',$user[$bbs_rcp_arr[$i][0]['uniq_id']]['user_id']); $template->setVariable('user_name',$user[$bbs_rcp_arr[$i][0]['uniq_id']]['mem_nm_kana']); } $template->parseCurrentBlock(); } $where = " r_gnr_no like '2%' and r_gnr_dlt = 0"; $order = "r_gnr_no"; $ret = cs4_select($this->db, "bsc_r_gnr ", $where, $order); while($row = cs4_fetch_row($ret)){ $gnr_arr[] = $row; } if(is_array($gnr_arr) == true){ foreach($gnr_arr as $key => $row){ $template->setCurrentBlock("__bbs_list__"); $template->setVariable("gnr_no", $row["r_gnr_no"]); $template->setVariable("gnr_name", $row["r_gnr_nm"]); $template->parse("__bbs_list__"); $template->setCurrentBlock('__bbs_rank__'); $template->setVariable("gnr_no", $row["r_gnr_no"]); $template->setVariable("gnr_name", $row["r_gnr_nm"]); if(count($gnr_arr) - 1 == $key){ $mark = "└"; }else{ $mark = "├"; } $template->setVariable("mark", $mark); $template->parse("__bbs_rank__"); } } if(!empty($kind_arr)){ for($i = 0; $i < count($kind_arr); $i++){ $template->setCurrentBlock('__Kind_1__'); $template->setVariable('val',$kind_arr[$i]['uniq_id']); $template->setVariable('show',$kind_arr[$i]['r_knd_nm']); $template->parseCurrentBlock(); } } //******************************// // 新着晩ごはん取得 // //******************************// //本日日付取得 $base_day = date("d"); $base_month = date("m"); $base_year = date("Y"); $base_hour = date("G"); $base_min = date("i"); $base_time = date("G:i:s"); //YYYYMMDD形式に変換 $date = $base_year."-".$base_month."-".$base_day; //DB接続 $db = DB::connect(constant('KTY_DSN')); if(DB::isError($db)){ echo "DB接続エラー:".DB::errorMessage($db)."\n"; exit; } //$where = " pub_date like '$date%' and pub_flg = 0 and dlt_flg = 0"; $where = " pub_flg = 0 and dlt_flg = 0"; $order = " pub_date desc"; $sql = "SELECT uniq_id, post_title, post_no, user_nm"; $sql.= sprintf(" FROM contents_data_tonari_contribute Where %s order by %s",$where,$order); $ret = $db->query($sql); if(DB::isError($ret)){ echo "

クエリの送信が失敗しました。

"; exit; } //件数取得 $num = $ret->numRows(); //件数分だけループ $i = 0; while($row = $ret->fetchRow(DB_FETCHMODE_ASSOC)){ $array[uniq_id][$i] = $row['uniq_id']; $array[title][$i] = $row['post_title']; $array[post_no][$i] = $row['post_no']; $array[user_nm][$i] = $row['user_nm']; $i ++; } if(!empty($num)){ for($i=0;$i<3;$i++){ //顧客情報からニックネーム取得 $template->setCurrentBlock('__new_list__'); $template->setVariable('uniq_id',$array['uniq_id'][$i]); $template->setVariable('title',$array['title'][$i]); $template->setVariable('nick_nm',$array['user_nm'][$i]); $template->setVariable('master_no', $array[post_no][$i]); $template->parseCurrentBlock(); $template->hideBlock('__non_new_list__'); } $template->setCurrentBlock('__list__'); $template->setVariable('list',"一覧→
"); $template->parseCurrentBlock(); }else{ $template->setCurrentBlock('__non_new_list__'); $template->setVariable('new_cmt','新着晩ごはんの投稿はありません。'); $template->parseCurrentBlock(); $template->hideBlock('__new_list__'); $template->hideBlock('__list__'); } u4user_close($this->db); //******************************// // 人気晩ごはん取得 // //******************************// //$where = sprintf(" v.post_id = c.uniq_id and c.pub_date like '%s' ","$date%"); $where = " v.post_id = c.uniq_id "; $order = " v.poll desc"; $from = " contents_data_tonari_vote v ,contents_data_tonari_contribute c"; $sql = "select v.post_id,v.poll,c.post_date, c.post_no, c.post_title, c.uniq_id, c.user_nm "; $sql .= sprintf(" from %s where %s order by %s",$from,$where,$order); $res = $db->query($sql); if(DB::isError($res)){ echo "

クエリの送信が失敗しました。

"; exit; } //件数取得 $num = $res->numRows(); $i = 0; while($row2 = $res->fetchRow(DB_FETCHMODE_ASSOC)){ $array2[uniq_id][$i] = $row2['uniq_id']; $array2[title][$i] = $row2['post_title']; $array2[post_no][$i] = $row2['post_no']; $array2[user_nm][$i] = $row2['user_nm']; $i ++; } if(!empty($num)){ for($i=0;$i<3;$i++){ //顧客情報からニックネーム取得 if($i == 0){ $master = $array2['user_nm'][$i]; $master_no = $array2['post_no'][$i]; } $template->setCurrentBlock('__pop_list__'); $template->setVariable('p_uniq_id',$array2['uniq_id'][$i]); $template->setVariable('p_title',$array2['title'][$i]); $template->setVariable('p_nick_nm',$array2['user_nm'][$i]); $template->setVariable('master_no',$master_no); $template->parseCurrentBlock(); $template->hideBlock('__non_pop_list__'); } $template->setCurrentBlock('__p_list__'); $template->setVariable('p_list',"一覧→
"); $template->parseCurrentBlock(); }else{ $template->setCurrentBlock('__non_pop_list__'); $template->setVariable('pop_cmt','今日の人気晩ごはんの投稿はありません。'); $template->parseCurrentBlock(); $template->hideBlock('__pop_list__'); $template->hideBlock('__p_list__'); } //******************************// // 達人の晩ごはん取得 // //******************************// //2006.08.25 J.Nikaido 一時的に削除 if(!empty($master)){ $template->setCurrentBlock('__master__'); $template->setVariable('master',$master); $template->setVariable('master_no',$master_no); $template->parseCurrentBlock(); $template->hideBlock('__non_master__'); }else{ $template->setCurrentBlock('__non_master__'); $template->setVariable('master_cmt','今日は該当者がいません。'); $template->parseCurrentBlock(); $template->hideBlock('__master__'); } $template->show(); cs4_close($this->db); //DB開放 $db->disconnect(); } tonari_top( $p ); ?>