db = cs4_open(); $user_prof = array(); $user_meal = array(); $now_date = (empty($p['ymd'])) ? date("Ymd") : $p['ymd']; $meal_type_arr = get_MealType(); //- graph表示フラグ $show_graph = 0; $show_graph = get_UserProf( $p , date("Ymd") ,date("Ymd",mktime(0,0,0,date("m"),date("d") - 7,date("Y")))); //- 最新一件取得 by Aida 06/03/06 $user_prof = get_UserProf( $p ,'' ,'' ,1 ); $user_meal = get_UserMeal($p); $standard_weight = get_StandardWeight($user_prof[0]['height']); //- プロフィール・食事履歴ともにゼロのユーザは初回ユーザページへ遷移 if(!$user_prof && !$user_meal){ $url = ""; switch($p['carrier']){ case "i": default: $add_param = "?uid=NULLGWDOCOMO"; break; case "v": $add_param = "?uid=1&sid=".V_SID; break; case "e": break; } $url = sprintf("%s/notebook/nb_first_top.php%s",KTY_BASE_URL,$add_param); header("Location: ".$url); exit; } if(NOTEBOOK_DEBUG_MODE){ var_dump($user_prof); } //$user_prof = 0; //$user_meal = 0; //- 食事登録あり foreach($user_meal[$now_date] as $key => $val){ //- 食事タイプ毎に整形 for($i=0;$idb); // テンプレート読み込み $template =& loadTemplate( $p ); if(empty($user_prof[0]) && empty($user_meal[$now_date])){ //- グラフ非表示 $template->hideBlock('__GraphImage__'); //- 適正値非表示 $template->hideBlock('__BestProfile__'); //- 体重推移リンク $template->touchBlock('__GoProfile__'); //- 体重登録なし $template->setCurrentBlock('__NoProfile__'); $template->setVariable('month',sprintf("%d",substr($now_date,4,2))); $template->setVariable('day',sprintf("%d",substr($now_date,6,2))); $template->parseCurrentBlock(); //- 食事登録なし $template->setCurrentBlock('__NoMeal__'); $template->setVariable('month',sprintf("%d",substr($now_date,4,2))); $template->setVariable('day',sprintf("%d",substr($now_date,6,2))); $template->parseCurrentBlock(); //- BMI解説ページリンク // $template->touchBlock('__bmiLink__'); //- 参考資料リンク // $template->touchBlock('__NbDataLink__'); }elseif(!empty($user_prof[0]) && empty($user_meal[$now_date])){ //- グラフ表示 if("3" == $p['version'] || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] || "g" == $p['carrier']){ if($show_graph){ $interval = (empty($p['id'])) ? "1" : $p['id']; $template->setCurrentBlock('__GraphImage__'); $template->setVariable('interval_id',$interval); $template->parseCurrentBlock(); } }else{ $template->hideBlock('__GraphImage__'); } //- 体重推移ページボタン $template->TouchBlock('__GoProfile__'); //- 適正値表示 $template->setCurrentBlock('__BestProfile__'); $template->setVariable('best_weight',$standard_weight); $template->setVariable('best_calorie',$user_prof[0]['necessary_calorie']); $template->parseCurrentBlock(); //- 体重登録アリ $template->setCurrentBlock('__ShowProfile__'); $template->setVariable('date',sprintf("%d月%d日",substr($user_prof[0]['measure_ymd'],4,2),substr($user_prof[0]['measure_ymd'],6,2))); $template->setVariable('weight_val',$user_prof[0]['weight']); $template->setVariable('bmi_val',$user_prof[0]['bmi']); $body_status = get_BodyCondition($user_prof[0]['bmi']); $template->setVariable('body_status',sprintf("%sです",$body_status)); $template->parseCurrentBlock(); //- 食事登録なし $template->setCurrentBlock('__NoMeal__'); $template->setVariable('month',sprintf("%d",substr($now_date,4,2))); $template->setVariable('day',sprintf("%d",substr($now_date,6,2))); $template->parseCurrentBlock(); //- Myヘルシー手帳ボタン if(0 < count($user_meal)){ $template->TouchBlock('__GoNotebook__'); } //- 体重推移グラフページボタン /* $weekly_count = GRAPH_SPAN_W; $prev_ymd = date("Ymd",mktime( 0, 0, 0, date("n"), date("j") - $weekly_count , date("Y"))); $prof = get_UserProf($p , date("Ymd") ,$prev_ymd ,7 ); if(2 < count($prof)){ if("3" == $p['version'] || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] || "g" == $p['carrier']){ $template->TouchBlock('__GoProfileGraph_Spec_3__'); }else{ $template->TouchBlock('__GoProfileGraph_OtherSpec__'); } } */ }elseif(empty($user_prof[0]) && !empty($user_meal[$now_date])){ //- グラフ非表示 $template->hideBlock('__GraphImage__'); //- 適正値非表示 $template->hideBlock('__BestProfile__'); //- 体重推移リンク $template->touchBlock('__GoProfile__'); //- 体重登録なし $template->setCurrentBlock('__NoProfile__'); $template->setVariable('month',sprintf("%d",substr($now_date,4,2))); $template->setVariable('day',sprintf("%d",substr($now_date,6,2))); $template->parseCurrentBlock(); //- 食事登録あり $total_cal = 0; for($i=0;$i $val){ $total_cal = $total_cal + $val['calorie']; $template->setCurrentBlock('__RecipeLine__'); $template->setVariable('title',$val['recipe_name']); $template->setVariable('calorie',$val['calorie']); $template->parseCurrentBlock(); } if(!empty($meal_type[$i])){ $template->setCurrentBlock('__MealBlock__'); $template->setVariable('meal_type',$meal_type_arr[$i]); $template->setVariable('eat_ymd_val', $now_date); $template->setVariable('type_val',$i); $template->parseCurrentBlock(); } } $template->setCurrentBlock('__HadMeal__'); $template->setVariable('get_calorie',$total_cal); $template->setVariable('month',sprintf("%d",substr($now_date,4,2))); $template->setVariable('day',sprintf("%d",substr($now_date,6,2))); $template->parseCurrentBlock(); //- Myヘルシー手帳ボタン if(0 < count($user_meal)){ $template->TouchBlock('__GoNotebook__'); } }elseif(!empty($user_prof[0]) && !empty($user_meal[$now_date])){ //- グラフ表示 if("3" == $p['version'] || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] || "g" == $p['carrier']){ if($show_graph){ $interval = (empty($p['id'])) ? "1" : $p['id']; $template->setCurrentBlock('__GraphImage__'); $template->setVariable('interval_id',$interval); $template->parseCurrentBlock(); } }else{ $template->hideBlock('__GraphImage__'); } //- 体重推移リンク $template->touchBlock('__GoProfile__'); //- 適正値表示 $template->setCurrentBlock('__BestProfile__'); $template->setVariable('best_weight',$standard_weight); $template->setVariable('best_calorie',$user_prof[0]['necessary_calorie']); $template->setVariable('bmi_value',$user_prof[0]['bmi']); $template->parseCurrentBlock(); //- 体重登録アリ $template->setCurrentBlock('__ShowProfile__'); $template->setVariable('date',sprintf("%d月%d日",substr($user_prof[0]['measure_ymd'],4,2),substr($user_prof[0]['measure_ymd'],6,2))); $template->setVariable('weight_val',$user_prof[0]['weight']); $template->setVariable('bmi_val',$user_prof[0]['bmi']); $body_status = get_BodyCondition($user_prof[0]['bmi']); $template->setVariable('body_status',sprintf("%sです",$body_status)); $template->parseCurrentBlock(); //- 食事登録あり $total_cal = 0; for($i=0;$i $val){ $total_cal = $total_cal + $val['calorie']; $template->setCurrentBlock('__RecipeLine__'); $template->setVariable('title',$val['recipe_name']); $template->setVariable('calorie',$val['calorie']); $template->parseCurrentBlock(); } if(!empty($meal_type[$i])){ $template->setCurrentBlock('__MealBlock__'); $template->setVariable('meal_type',$meal_type_arr[$i]); $template->setVariable('eat_ymd_val', $now_date); $template->setVariable('type_val',$i); $template->parseCurrentBlock(); } } $template->setCurrentBlock('__HadMeal__'); $template->setVariable('get_calorie',$total_cal); $template->setVariable('month',sprintf("%d",substr($now_date,4,2))); $template->setVariable('day',sprintf("%d",substr($now_date,6,2))); $template->parseCurrentBlock(); //- Myヘルシー手帳ボタン if(0 < count($user_meal)){ $template->TouchBlock('__GoNotebook__'); } //- 体重推移グラフページボタン /* $weekly_count = GRAPH_SPAN_W; $prev_ymd = date("Ymd",mktime( 0, 0, 0, date("n"), date("j") - $weekly_count , date("Y"))); $prof = get_UserProf($p , date("Ymd") ,$prev_ymd ,7 ); if(2 < count($prof)){ if("3" == $p['version'] || ("2" == $p['version'] && "i" == $p['carrier']) || "w" == $p['carrier'] || "g" == $p['carrier']){ $template->TouchBlock('__GoProfileGraph_Spec_3__'); }else{ $template->TouchBlock('__GoProfileGraph_OtherSpec__'); } } */ } //- ヘルプリンク $template->touchBlock('__HelpLink__'); $template->setVariable('contents_name_title', NOTEBOOK_NAME ); $template->setVariable('contents_name_alt', NOTEBOOK_NAME ); $template->show(); } nb_top( $p ); ?>