Changeset 15557
- Timestamp:
- 2007/09/01 21:16:57 (17 years ago)
- Location:
- branches/feature-module-update
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update/html/admin/products/product_select.php
r15532 r15557 6 6 */ 7 7 8 require_once("../require.php"); 8 // {{{ requires 9 require_once("../../require.php"); 10 require_once(CLASS_PATH . "page_extends/admin/products/LC_Page_Admin_Products_ProductSelect_Ex.php"); 9 11 10 class LC_Page { 11 12 function LC_Page() { 13 $this->tpl_mainpage = 'products/product_select.tpl'; 14 $this->tpl_mainno = 'products'; 15 $this->tpl_subnavi = ''; 16 $this->tpl_subno = ""; 17 $this->tpl_subtitle = '商品選択'; 18 } 19 } 12 // }}} 13 // {{{ generate page 20 14 21 $conn = new SC_DBConn(); 22 $objPage = new LC_Page(); 23 $objView = new SC_AdminView(); 24 $objSess = new SC_Session(); 25 26 // 認証可否の判定 27 sfIsSuccess($objSess); 28 29 if ($_POST['mode'] == "search") { 30 31 // POST値の引き継ぎ 32 $objPage->arrForm = $_POST; 33 // 入力文字の強制変換 34 lfConvertParam(); 35 36 $where = "del_flg = 0"; 37 38 /* 入力エラーなし */ 39 foreach ($objPage->arrForm as $key => $val) { 40 if($val == "") { 41 continue; 42 } 43 44 switch ($key) { 45 case 'search_name': 46 $where .= " AND name ILIKE ?"; 47 $arrval[] = "%$val%"; 48 break; 49 case 'search_category_id': 50 // 子カテゴリIDの取得 51 $arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val); 52 $tmp_where = ""; 53 foreach ($arrRet as $val) { 54 if($tmp_where == "") { 55 $tmp_where.= " AND ( category_id = ?"; 56 } else { 57 $tmp_where.= " OR category_id = ?"; 58 } 59 $arrval[] = $val; 60 } 61 $where.= $tmp_where . " )"; 62 break; 63 case 'search_product_code': 64 $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)"; 65 $arrval[] = "$val%"; 66 break; 67 default: 68 break; 69 } 70 } 71 72 $order = "update_date DESC, product_id DESC "; 73 74 // 読み込む列とテーブルの指定 75 $col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited"; 76 $from = "vw_products_nonclass AS noncls "; 77 78 $objQuery = new SC_Query(); 79 // 行数の取得 80 $linemax = $objQuery->count("dtb_products", $where, $arrval); 81 $objPage->tpl_linemax = $linemax; // 何件が該当しました。表示用 82 83 // ページ送りの処理 84 if(is_numeric($_POST['search_page_max'])) { 85 $page_max = $_POST['search_page_max']; 86 } else { 87 $page_max = SEARCH_PMAX; 88 } 89 90 // ページ送りの取得 91 $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX); 92 $objPage->tpl_strnavi = $objNavi->strnavi; // 表示文字列 93 $startno = $objNavi->start_row; 94 95 // 取得範囲の指定(開始行番号、行数のセット) 96 if(DB_TYPE != "mysql") $objQuery->setlimitoffset($page_max, $startno); 97 // 表示順序 98 $objQuery->setorder($order); 99 100 // viewも絞込みをかける(mysql用) 101 sfViewWhere("&&noncls_where&&", $where, $arrval, $objQuery->order . " " . $objQuery->setlimitoffset($page_max, $startno, true)); 102 103 // 検索結果の取得 104 $objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval); 105 106 } 107 108 // カテゴリ取得 109 $objPage->arrCatList = sfGetCategoryList(); 110 111 112 113 114 115 116 //---- ページ表示 117 $objView->assignobj($objPage); 118 $objView->display($objPage->tpl_mainpage); 119 120 121 122 123 124 125 //--------------------------------------------------------------------------------------------------------------------------------------------------------- 126 127 /* 取得文字列の変換 */ 128 function lfConvertParam() { 129 global $objPage; 130 /* 131 * 文字列の変換 132 * K : 「半角(ハンカク)片仮名」を「全角片仮名」に変換 133 * C : 「全角ひら仮名」を「全角かた仮名」に変換 134 * V : 濁点付きの文字を一文字に変換。"K","H"と共に使用します 135 * n : 「全角」数字を「半角(ハンカク)」に変換 136 */ 137 $arrConvList['search_name'] = "KVa"; 138 $arrConvList['search_product_code'] = "KVa"; 139 140 // 文字変換 141 foreach ($arrConvList as $key => $val) { 142 // POSTされてきた値のみ変換する。 143 if(isset($objPage->arrForm[$key])) { 144 $objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val); 145 } 146 } 147 } 148 149 15 $objPage = new LC_Page_Admin_Products_ProductSelect_Ex(); 16 $objPage->init(); 17 $objPage->process(); 18 register_shutdown_function(array($objPage, "destroy")); 150 19 ?>
Note: See TracChangeset
for help on using the changeset viewer.