db = cs4_open(); //- レシピ詳細情報取得 $detail = get_rcpDetail($this->db,$p['id']); //- 今日のおかず取得 $okazu_arr = get_csvdata("okazu"); $okazu_list = get_rcpList($this->db, $okazu_arr); //- 2007.12.07 J.Nikaido Add 有料レシピの場合には無料会員はマイメニュー登録ページへ遷移 //- 2008.07.25 J.Nikaido Chg おすすめレシピのみ無料会員でも表示する $user_flg = 0; $db = u4user_open(); if(!get_UserDetail_uid($db, $p['uid'], '0', '1') && MEMBER_CHECK && "w" != $p['carrier']){ $user_flg = 1; } u4user_close($db); if( $user_flg == 1 && $okazu_list['today'][0]["uniq_id"] != $p['id']){ if("e" == $p['carrier']){ chdir(dirname(__FILE__) . "/authcheck"); require_once("../authcheck/authcheck.php"); chdir(dirname(__FILE__)); } $db = u4user_open(); if($user_flg == 1){ $p['template'] = preg_replace('/.php$/','_free.html', basename( $_SERVER['SCRIPT_NAME'] ) ); $p['template_x'] = preg_replace('/.php$/','_free.xhtml', basename( $_SERVER['SCRIPT_NAME'] ) ); $free_flg = true; } } $dir_name = substr(strrchr(dirname( __FILE__ ) , '/'), 1); // テンプレート読み込み $template =& loadTemplate( $p ); if($free_flg){ if($p['carrier'] == 'i'){ $template->setVariable('regist_url', MEMBER_REGIST_URL . "?uid=NULLGWDOCOMO&p[contents]=" . $dir_name."_".$p['id']); }else{ $template->setVariable('regist_url', MEMBER_REGIST_URL . "?p[contents]=" . $dir_name."_".$p['id']); } } if(!$free_flg){ //マイレシピ配列取得(主菜[main]&副菜[sub]) $myrecipe_list = get_MyRecipe($p['uid'],$user_data[0]); //$myrecipe_list = get_MyRecipe_new($p['uid'],$user_data[0],$p['id']); //$myrecipe_list = get_MyRecipe_new($p['uid'],$user_data[0]); //var_dump($myrecipe_list['main']['sub_index'][$p['id']]); //print substr($p['id'],2,4); $ix = 0; if(!empty($myrecipe_list['sub'])){ // if(!empty($p[sub])){ $nowdate_count = (mktime(0,0,0,date("m"),date("d"),date("Y")) - mktime(0,0,0,1,1,2005)) / (24*60*60); $sub_index = ($nowdate_count + $p['id']) % count($myrecipe_list['sub']); foreach($myrecipe_list['sub'] as $key => $val){ clearstatcache(); if($ix < 3){ //print "[$ix]:".$sub_index."/"; //主食と同じになった時の処理 if(!empty($p['id'])){ if($p['id'] == $myrecipe_list['sub'][$sub_index]['rcp_no']){ //副菜が一個だけなら非表示 if(1 >= count($myrecipe_list['sub'])){ $myrecipe_list['sub'] = ""; }else{ $sub_index++; } } } $template->setCurrentBlock('__List__'); $template->setVariable('rcp_no',$myrecipe_list['sub'][$sub_index]['rcp_no']); $template->setVariable('rcp_nm',$myrecipe_list['sub'][$sub_index]['rcp_nm']); $template->setVariable('rcp_exp',$myrecipe_list['sub'][$sub_index]['rcp_exp']); $ix++; $sub_index++; $template->parseCurrentBlock(); } } // } /* if(DEBUG_MODE){ print "
副菜 -> "; print ($sub_index + 1)."/".count($myrecipe_list['sub'])." ( view / total )"; print "
RecipeID => "; } */ } } //- レシピ詳細情報取得 $detail = get_rcpDetail($this->db,$p['id']); //- レシピ写真サイズ判定 // $photo_size = (empty($p['p_size'])) ? '0' : '1' ; if("1" == $p['version']){ $photo_size = 1; }else{ $photo_size = 0; } //- au Ver.2 対応 if("e" == $p['carrier'] && $p['version'] == "2"){ $photo_size = 1; } $template->setVariable('recipe_name',$detail[0]['rcp_nm']); $img_filename = array(sprintf("%s_n.jpg",$detail[0]['uniq_id']),sprintf("%s_n-s.jpg",$detail[0]['uniq_id'])); switch($photo_size){ case "0": $img_path = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[0]); $another_url = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[1]); if(file_exists($img_path)){ $template->setVariable('recipe_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path))); } clearstatcache(); break; case "1": $img_path = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[1]); $another_url = sprintf("%s/%s",constant('IMG_DIR_RECIPE'),$img_filename[0]); if(file_exists($img_path)){ $template->setVariable('recipe_image',sprintf("",str_replace(KTY_SERVER_ROOT,"",$img_path))); } clearstatcache(); break; default: break; } //- 塩分量表示追加 if(!empty($detail[0]['rcp_salt']) && "1" == $detail[0]['rcp_salt_flg']){ $template->setCurrentBlock('__Salt__'); $template->setVariable('salt',sprintf("%sg
",$detail[0]['rcp_salt'])); $template->parseCurrentBlock(); } if(!empty($detail[0]['rcp_menu'])){ $template->setCurrentBlock('__Genre__'); $template->setVariable('genre',sprintf("%s
",$detail[0]['rcp_menu'])); $template->parseCurrentBlock(); } if(!empty($detail[0]['rcp_time'])){ $template->setCurrentBlock('__Time__'); $template->setVariable('time',sprintf("%s
",$detail[0]['rcp_time']."分")); $template->parseCurrentBlock(); } if(!empty($detail[0]['rcp_crl'])){ $template->setCurrentBlock('__Calorie__'); $template->setVariable('calorie',sprintf("%skcal
",$detail[0]['rcp_crl'])); $template->parseCurrentBlock(); } if(!empty($detail[0]['rcp_style'])){ $template->setCurrentBlock('__Style__'); $template->setVariable('style',sprintf("%s
",$detail[0]['rcp_style'])); $template->parseCurrentBlock(); } if(!empty($detail[0]['rcp_num'])){ $template->setVariable('number_of_persons',sprintf("(%s人分)",$detail[0]['rcp_num'])); } //- 材料セット $ing = array(); $detail[0]['rcp_cook_mtr'] = str_replace("、",",",$detail[0]['rcp_cook_mtr']); $ing = explode(",",$detail[0]['rcp_cook_mtr']); for($i=0;$isetCurrentBlock('__Ingedients__'); $template->setVariable('Ingredients',$ing_name); if(!empty($ing_amount)){ $template->setVariable('amount',sprintf(":%s",$ing_amount)); } $template->parseCurrentBlock(); } if(!$free_flg){ //- 作り方セット $howto = array(); $howto = explode(",",$detail[0]['mtr_cook_exp']); for($i=0;$isetCurrentBlock('__HowtoCook__'); $template->setVariable('process',sprintf("%s.%s",$i + 1,$howto[$i])); $template->parseCurrentBlock(); } //- Memoセット $template->setCurrentBlock('__Memo__'); $template->setVariable('memo',$detail[0]['rcp_comment']); $template->parseCurrentBlock(); $template->setVariable('rcp_no',$detail[0]['uniq_id']); // $template->setVariable('',$detail['']); //- 検索条件 $p['pre_terms'] = serialize($p); // $template->setVariable('pre_terms',$serialize($p)); //- お気に入り セット if( is_favorite($this->db,$detail[0]['uniq_id'],$p['uid']) ){ $template->setCurrentBlock('__FavoriteOff__'); $template->setVariable('rcp_no',$detail[0]['uniq_id']); $template->setVariable('contents','okazu'); $template->parseCurrentBlock(); $template->hideBlock('__FavoriteOn__'); }else{ $template->setCurrentBlock('__FavoriteOn__'); $template->setVariable('rcp_no',$detail[0]['uniq_id']); $template->setVariable('contents','okazu'); $template->parseCurrentBlock(); $template->hideBlock('__FavoriteOff__'); } } //- access_log 記録 // $ret = bsc_insert_acslog($this->db,$detail[0],"r",$p['uid']); $template->show(); cs4_close($this->db); } okazu_detail( $p ); ?>