/* ********************************************************************************* * システム:katsuyo.net * *===============================================================================* * クラス:bentou_list |モジュール:bentou_list.php * * 概要 :新・あしたのお弁当 あしたのお弁当保存リスト表示画面 * * パス :APP_HOME/bentou/ * * 作成 :2006/08/14 J.Nikaido * *-------------------------------------------------------------------------------* * 更新 : * ********************************************************************************* */ require_once('../prepare.php'); //require_once('./lib/config_my.php'); require_once('./lib/bentou_function.php'); //- メンバーチェック $db = u4user_open(); if(!get_UserDetail_uid($db, $p['uid'], '0', '1') ){ header("Location: ".MEMBER_REGIST_URL); exit; } u4user_close($db); function favor_list($p){ if(!empty($p[d])){ $yy = substr($p[d],0,4); $mm = substr($p[d],4,2); $dd = substr($p[d],6,2); $date = $yy.".".$mm.".".$dd; } //テンプレートを開く $template =& loadTemplate($p); // DB接続 $this->user = u4user_open(); $db = DB::connect(constant('KTY_DSN')); if(DB::isError($db)){ echo "DB接続エラー:".DB::errorMessage($db)."\n"; exit; } // 1ページの表示数 $show_line = 10; $p['page'] = (!empty($p['page']) && '0' < $p['page']) ? $p['page'] : '1'; $join = " inner join contents_data_bsc_r_new AS r1 ON r1.rcp_no = b.main_rcp_no "; $join.= " inner join contents_data_bsc_r_new AS r2 ON r2.rcp_no = b.submain_rcp_no"; $join.= " inner join contents_data_bsc_r_new AS r3 ON r3.rcp_no = b.sub_rcp_no"; $where = ""; $where .= " where regist_date = '$p[d]' and user_id = '$p[uid]' "; $ct = 0; $ct = cs4_num_rows($this->db,'bsc_bento_user',$where); $sql = "select b.main_rcp_no,r1.rcp_nm name1 , b.submain_rcp_no,r2.rcp_nm name2,b.sub_rcp_no,r3.rcp_nm name3 "; $sql.= sprintf(" from contents_data_bsc_bento_user as b %s %s",$join,$where); $res = $db->query($sql); if(DB::isError($res)){ echo "
クエリの送信が失敗しました。
"; exit; } //件数取得 $num = $res->numRows(); //件数分だけループ while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)){ $array[main_rcp_no][] = $row['main_rcp_no']; $array[submain_rcp_no][] = $row['submain_rcp_no']; $array[sub_rcp_no][] = $row['sub_rcp_no']; $array[name1][] = $row['name1']; $array[name2][] = $row['name2']; $array[name3][] = $row['name3']; } $ct = $num; if(!$num || $num == "0"){ $template->hideBlock('__main_List__'); $template->hideBlock('__submain_List__'); $template->hideBlock('__sub_List__'); }else{ for($i=0 ;$i < $num ;$i++){ //画像取得 $thumbnail_path1 = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$array[main_rcp_no][$i]); $thumbnail_path2 = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$array[submain_rcp_no][$i]); $thumbnail_path3 = sprintf("%s/%s_n-thm.jpg",IMG_DIR_RECIPE,$array[sub_rcp_no][$i]); if(file_exists($thumbnail_path1)){ $template->setCurrentBlock('__ShowImage1__'); $template->setVariable('img_src1',sprintf("/image/recipe/%s_n-thm.jpg",$array[main_rcp_no][$i])); $template->parseCurrentBlock(); } if(file_exists($thumbnail_path2)){ $template->setCurrentBlock('__ShowImage2__'); $template->setVariable('img_src2',sprintf("/image/recipe/%s_n-thm.jpg",$array[submain_rcp_no][$i])); $template->parseCurrentBlock(); } if(file_exists($thumbnail_path3)){ $template->setCurrentBlock('__ShowImage3__'); $template->setVariable('img_src3',sprintf("/image/recipe/%s_n-thm.jpg",$array[sub_rcp_no][$i])); $template->parseCurrentBlock(); } clearstatcache(); $template->setCurrentBlock('__Date__'); $template->setVariable('date',$date); $template->parseCurrentBlock(); $template->setCurrentBlock('__main_List__'); $template->setVariable('main_rcp_no',$array[main_rcp_no][$i]); $template->setVariable('name1',$array[name1][$i]); $template->parseCurrentBlock(); $template->setCurrentBlock('__submain_List__'); $template->setVariable('submain_rcp_no',$array[submain_rcp_no][$i]); $template->setVariable('name2',$array[name2][$i]); $template->parseCurrentBlock(); $template->setCurrentBlock('__sub_List__'); $template->setVariable('sub_rcp_no',$array[sub_rcp_no][$i]); $template->setVariable('name3',$array[name3][$i]); $template->parseCurrentBlock(); } } $template->show(); //DB開放 cs4_close($this->db); u4user_close($this->user); } favor_list($p); ?>