/* ********************************************************************************* * システム:katsuyo.net * *===============================================================================* * クラス:diet_list |モジュール:diet_list.php * * 概要 :ダイエット趣向レシピ お気に入りダイエットセットリスト表示画面 * * パス :APP_HOME/diet/ * * 作成 :2006/08/10 J.Nikaido * *-------------------------------------------------------------------------------* * 更新 : * ********************************************************************************* */ require_once('../prepare.php'); require_once('lib/diet_function.php'); //- メンバーチェック if("e" == $p['carrier']){ chdir(dirname(__FILE__) . "/authcheck"); require_once("../authcheck/authcheck.php"); chdir(dirname(__FILE__)); } $db = u4user_open(); if(!get_UserDetail_uid($db, $p['uid'], '0', '1') && MEMBER_CHECK){ header("Location: " . MEMBER_REGIST_URL . "?p[contents]=" . substr(strrchr(dirname( __FILE__ ) , '/'), 1)); exit; } function diet_list( $p ){ //本日日付取得 $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接続 $this->db = cs4_open(); $terms = $p; //ページ番号セット $terms['page'] = (empty($terms['page'])) ? "1" : $terms['page'] ; //******************************// // セットメニューリスト取得 // //******************************// //DB接続 $db = DB::connect(constant('KTY_DSN')); if(DB::isError($db)){ echo "DB接続エラー:".DB::errorMessage($db)."\n"; exit; } $where = " u.user_id = '".$p['uid']."' and u.set_id = d.uniq_id and dlt_flg = 0"; $order = " d.date desc"; $sql = "select d.uniq_id, d.date, d.set_name "; $sql.= sprintf(" from contents_data_kty_diet_set_users u, contents_data_kty_diet_set d where %s order by %s",$where,$order); $ret = $db->query($sql); if(DB::isError($ret)){ echo "
クエリの送信が失敗しました。
"; exit; } //件数取得 $count = $ret->numRows(); while($row = $ret->fetchRow(DB_FETCHMODE_ASSOC)){ $array[uniq_id][] = $row['uniq_id']; $array[date][] = $row['date']; $array[set_name][] = $row['set_name']; } //DB開放 $db->disconnect(); // テンプレート読み込み $template =& loadTemplate( $p ); //- 検索エラーハンドリング if($count){ $template->setCurrentBlock('__SerachResult__'); $template->setVariable('count',$count); $template->parseCurrentBlock(); $template->hideBlock('__SearchError__'); }else{ $template->TouchBlock('__SearchError__'); $template->hideBlock('__SearchResult__'); } //-- レシピ一覧作成 $start = ($terms['page'] - 1) * constant('RCP_LIST_COUNT'); $limit = (($start + constant('RCP_LIST_COUNT')) > $count) ? $count : $start + constant('RCP_LIST_COUNT'); for($i = $start;$i < $limit;$i++){ //文字列置換 if('' != $array['date'][$i]){ $ymd = str_replace('-','.',substr($array['date'][$i],0,10)); } $template->setCurrentBlock('__RecipeList__'); $template->setVariable('set_name',$array['set_name'][$i]); $template->setVariable('date',$ymd); $template->setVariable('uniq_id',$array['uniq_id'][$i]); $template->parseCurrentBlock(); } //デバッグ処理 if(constant('BBS_DEBUG_MODE')){ print "