/*
*********************************************************************************
* システム:katsuyo.net *
*===============================================================================*
* クラス:okazu_top_new |モジュール:okazu_top_new.php *
* 概要 :新・今日の晩ごはん 晩ごはんTOP表示画面 *
* パス :APP_HOME/okazu/ *
* 作成 :2006/07/14 J.Nikaido *
*-------------------------------------------------------------------------------*
* 更新 : *
*********************************************************************************
*/
require_once('../prepare.php');
require_once('lib/okazu_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;
}
u4user_close($db);
*/
//- ユーザデータ登録済みチェック
$user_data = is_MyRecipeUser($p);
function okazu_top_new( $p , $user_data){
$user_flg = 0;
$db = u4user_open();
if(!get_UserDetail_uid($db, $p['uid'], '0', '1') && MEMBER_CHECK){
$user_flg = 1;
}
u4user_close($db);
//変更用データ格納変数
$terms_arr = get_Terms();
if($user_data[0]['low_salt'] == 1){
$show = "塩分控えめ";
}
if($user_data[0]['low_calorie'] == 1){
if(!empty($show)){
$show .= " | ";
}
$show .= "カロリー控えめ";
}
if($user_data[0]['no_fried'] == 1){
if(!empty($show)){
$show .= " | ";
}
$show .= "揚げ物を除く";
}
if($user_data[0]['light_taste'] == 1){
if(!empty($show)){
$show .= " | ";
}
$show .= "あっさり系";
}
if($user_data[0]['simply_cook'] == 1){
if(!empty($show)){
$show .= " | ";
}
$show .= "お手軽料理";
}
if($user_data[0]['reject_egg'] == 1){
if(!empty($reject)){
$reject .= " | ";
}
$reject .= "卵";
}
if($user_data[0]['reject_milk'] == 1){
if(!empty($reject)){
$reject .= " | ";
}
$reject .= "牛乳";
}
if($user_data[0]['reject_meat'] == 1){
if(!empty($reject)){
$reject .= " | ";
}
$reject .= "肉類";
}
if($user_data[0]['reject_fish'] == 1){
if(!empty($reject)){
$reject .= " | ";
}
$reject .= "魚介類";
}
if($user_data[0]['reject_soba'] == 1){
if(!empty($reject)){
$reject .= " | ";
}
$reject .= "そば粉";
}
if($user_data[0]['reject_komugiko'] == 1){
if(!empty($reject)){
$reject .= " | ";
}
$reject .= "小麦粉";
}
if($user_data[0]['reject_beens'] == 1){
if(!empty($reject)){
$reject .= " | ";
}
$reject .= "大豆食品";
}
//DB接続
$this->db = cs4_open();
// テンプレート読み込み
$template =& loadTemplate( $p );
if(strlen($reject) <= 0 && strlen($show) <= 0){
//- 今日のおかず取得
$okazu_arr = get_csvdata("okazu");
$okazu_list = get_rcpList($this->db, $okazu_arr);
//現在時刻を取得
$today = getdate();
$hours = $today[hours];
//22:00以降は翌日のレシピを表示するための処理
if($hours >= 22){
$okazu_list['today'] = $okazu_list['tomorrow'];
}
$template->setCurrentBlock('__Title__');
if($user_flg == 1){
$template->setVariable('title',"糧無料おすすめレシピ糧");
}else{
$template->setVariable('title',"●おすすめレシピ秊");
}
$template->parseCurrentBlock();
//- okazu
if(!empty($okazu_list['today'])){
for($i=0;$isetCurrentBlock('__ImageLinkMain'.$i.'__');
$template->setVariable('image'.$i, $okazu_list['today'][$i]['uniq_id']);
$template->parseCurrentBlock();
}else{
$template->hideBlock('__ImageLinkMain__');
}
$template->setCurrentBlock('__List'.$i.'__');
$template->setVariable('phrase'.$i, $okazu_list['today'][$i]['rcp_exp']);
$template->setVariable('rcp_no'.$i, $okazu_list['today'][$i]['uniq_id']);
$template->setVariable('rcp_nm'.$i, $okazu_list['today'][$i]['rcp_nm']);
$template->parseCurrentBlock();
}
}
}else{
// 出力したい時間を指定
$time = array("", "hurry", "normal", "slowly");
//DB開放
cs4_close($this->db);
//リスト取得
for($q=0; $qsetCurrentBlock('__ImageLinkMain'.$q.'__');
$template->setVariable('image'.$q, $myrecipe_list['main'][$main_index]['rcp_no']);
$template->setVariable('phrase'.$q, $myrecipe_list['main'][$main_index]['rcp_exp']);
$template->parseCurrentBlock();
}
}
$template->setCurrentBlock('__List'.$q.'__');
$template->setVariable('phrase'.$q, $myrecipe_list['main'][$main_index]['rcp_exp']);
$template->setVariable('rcp_no'.$q, $myrecipe_list['main'][$main_index]['rcp_no']);
$template->setVariable('rcp_nm'.$q, $myrecipe_list['main'][$main_index]['rcp_nm']);
$template->parseCurrentBlock();
}else{
$template->hideBlock('__Main__');
$template->TouchBlock('__NoMain'.$q.'__');
}
}
$p['rcp_no'] = "";
//- データ変更用hiddenパラメータセット
foreach($terms_arr as $tmp_key => $tmp_val){
foreach($terms_arr[$tmp_key] as $key => $val){
if(1 == $user_data[0][$key]){
$template->setCurrentBlock('__HiddenParam__');
$template->setVariable('name',$key);
$template->parseCurrentBlock();
}
}
}
}
$template->setCurrentBlock('__SHOW__');
$template->setVariable('show',$show);
$template->parseCurrentBlock();
$template->setCurrentBlock('__REJECT__');
$template->setVariable('reject',$reject);
$template->parseCurrentBlock();
$template->show();
}
okazu_top_new( $p , $user_data);
?>