require_once('../prepare.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 . "?contents=" . substr(strrchr(dirname( __FILE__ ) , '/'), 1));
exit;
}
function nb_rcp_detail( $p )
{
$this->db = cs4_open();
//- レシピ詳細情報取得
$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 =& loadTemplate( $p );
$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_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']));
}
//- カロリー登録リンク
$template->setVariable('rpc_id',$detail[0]['uniq_id']);
$template->setVariable('ymd_val',$p['eat_ymd']);
$template->setVariable('type_val',$p['type']);
//- 材料セット
$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);
$template->setVariable('amount',sprintf(":%s",$ing_amount));
$template->parseCurrentBlock();
}
//- 作り方セット
$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['']);
//- お気に入り セット
/*
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','notebook');
$template->parseCurrentBlock();
$template->hideBlock('__FavoriteOn__');
}else{
$template->setCurrentBlock('__FavoriteOn__');
$template->setVariable('rcp_no',$detail[0]['uniq_id']);
$template->setVariable('contents','notebook');
$template->parseCurrentBlock();
$template->hideBlock('__FavoriteOff__');
}
*/
//- 検索条件
$p['pre_terms'] = serialize($p);
// $template->setVariable('pre_terms',$serialize($p));
//- access_log 記録
// $ret = bsc_insert_acslog($this->db,$detail[0],"r",$p['uid']);
//- 戻りURLセット
$add_param = "";
if(!empty($p['vegetable'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%svegetable=%s",$prefix,$p['vegetable']);
}
if(!empty($p['meat'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%smeat=%s",$prefix,$p['meat']);
}
if(!empty($p['fish'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%sfish=%s",$prefix,$p['fish']);
}
if(!empty($p['other'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%sother=%s",$prefix,$p['other']);
}
if(!empty($p['genre'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%sgenre=%s",$prefix,$p['genre']);
}
if(!empty($p['ing_genre'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%sing_genre=%s",$prefix,$p['ing_genre']);
}
if(!empty($p['cook'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%scook=%s",$prefix,$p['cook']);
}
if(!empty($p['kind'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%skind=%s",$prefix,$p['kind']);
}
if(!empty($p['cal'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%scal=%s",$prefix,$p['cal']);
}
if(!empty($p['theme'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%stheme=%s",$prefix,$p['theme']);
}
if(!empty($p['keywords'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%skeywords=%s",$prefix,$p['keywords']);
}
if(!empty($p['mode'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%smode=%s",$prefix,$p['mode']);
}
if(!empty($p['date'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%sdate=%s",$prefix,$p['date']);
}
if(!empty($p['eat_ymd'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%seat_ymd=%s",$prefix,$p['eat_ymd']);
}
if(!empty($p['gid'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%sgid=%s",$prefix,$p['gid']);
}
if(!empty($p['type'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%stype=%s",$prefix,$p['type']);
}
if(!empty($p['page'])){
$prefix = (empty($add_param)) ? "?" : "&";
$add_param .= sprintf("%spage=%s",$prefix,$p['page']);
}
//- ファイル名セット
if("" != $p['mode'] ){
$ret_url = "nb_search_list.php".$add_param;
}else{
$ret_url = "nb_sweets_list.php".$add_param;
}
// $add_param = sprintf("?p[page]=%d%s",$p['page'],$add_param);
// $template->setVariable('add_param',$add_param);
$template->setVariable('ret_url',$ret_url);
$template->setVariable('contents_top',NOTEBOOK_NAME);
$template->show();
cs4_close($this->db);
}
nb_rcp_detail( $p );
?>