1 | <?php |
---|
2 | /* |
---|
3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
---|
4 | * |
---|
5 | * http://www.lockon.co.jp/ |
---|
6 | */ |
---|
7 | require_once("../require.php"); |
---|
8 | |
---|
9 | class LC_Page { |
---|
10 | |
---|
11 | var $arrForm; |
---|
12 | |
---|
13 | function LC_Page() { |
---|
14 | $this->tpl_mainpage = 'mail/htmlmail_select.tpl'; |
---|
15 | $this->tpl_mainno = 'mail'; |
---|
16 | } |
---|
17 | } |
---|
18 | |
---|
19 | $conn = new SC_DBConn(); |
---|
20 | $objPage = new LC_Page(); |
---|
21 | $objView = new SC_AdminView(); |
---|
22 | $objSess = new SC_Session(); |
---|
23 | |
---|
24 | // 認証可否の判定 |
---|
25 | sfIsSuccess($objSess); |
---|
26 | |
---|
27 | if ($_POST['mode'] == "search") { |
---|
28 | |
---|
29 | // POST値の引き継ぎ |
---|
30 | $objPage->arrForm = $_POST; |
---|
31 | // 入力文字の強制変換 |
---|
32 | lfConvertParam(); |
---|
33 | |
---|
34 | // 削除されていない。公開商品である。 |
---|
35 | $where = "del_flg = 0 AND status = 1"; |
---|
36 | |
---|
37 | /* 入力エラーなし */ |
---|
38 | foreach ($objPage->arrForm as $key => $val) { |
---|
39 | if($val == "") { |
---|
40 | continue; |
---|
41 | } |
---|
42 | |
---|
43 | switch ($key) { |
---|
44 | case 'search_name': |
---|
45 | $where .= " AND name ILIKE ?"; |
---|
46 | $arrval[] = "%$val%"; |
---|
47 | break; |
---|
48 | case 'search_category_id': |
---|
49 | // 子カテゴリIDの取得 |
---|
50 | $arrRet = sfGetChildsID("dtb_category", "parent_category_id", "category_id", $val); |
---|
51 | $tmp_where = ""; |
---|
52 | foreach ($arrRet as $val) { |
---|
53 | if($tmp_where == "") { |
---|
54 | $tmp_where.= " AND ( category_id = ?"; |
---|
55 | } else { |
---|
56 | $tmp_where.= " OR category_id = ?"; |
---|
57 | } |
---|
58 | $arrval[] = $val; |
---|
59 | } |
---|
60 | $where.= $tmp_where . " )"; |
---|
61 | break; |
---|
62 | case 'search_product_code': |
---|
63 | $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)"; |
---|
64 | $where .= " OR product_code ILIKE ?"; |
---|
65 | $arrval[] = "%$val%"; |
---|
66 | $arrval[] = "%$val%"; |
---|
67 | break; |
---|
68 | default: |
---|
69 | break; |
---|
70 | } |
---|
71 | } |
---|
72 | |
---|
73 | $order = "update_date DESC"; |
---|
74 | |
---|
75 | // 読み込む列とテーブルの指定 |
---|
76 | $col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited"; |
---|
77 | $from = "vw_products_nonclass AS noncls "; |
---|
78 | |
---|
79 | $objQuery = new SC_Query(); |
---|
80 | // 行数の取得 |
---|
81 | $linemax = $objQuery->count($from, $where, $arrval); |
---|
82 | $objPage->tpl_linemax = $linemax; // 何件が該当しました。表示用 |
---|
83 | |
---|
84 | // ページ送りの処理 |
---|
85 | if(is_numeric($_POST['search_page_max'])) { |
---|
86 | $page_max = $_POST['search_page_max']; |
---|
87 | } else { |
---|
88 | $page_max = SEARCH_PMAX; |
---|
89 | } |
---|
90 | |
---|
91 | // ページ送りの取得 |
---|
92 | $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX); |
---|
93 | $objPage->tpl_strnavi = $objNavi->strnavi; // 表示文字列 |
---|
94 | $startno = $objNavi->start_row; |
---|
95 | |
---|
96 | // 取得範囲の指定(開始行番号、行数のセット) |
---|
97 | $objQuery->setlimitoffset($page_max, $startno); |
---|
98 | |
---|
99 | // 表示順序 |
---|
100 | $objQuery->setorder($order); |
---|
101 | // 検索結果の取得 |
---|
102 | $objPage->arrProducts = $objQuery->select($col, $from, $where, $arrval); |
---|
103 | |
---|
104 | } |
---|
105 | |
---|
106 | $objPage->arrCatList = sfGetCategoryList(); |
---|
107 | $objPage->name = $_GET['name']; |
---|
108 | |
---|
109 | |
---|
110 | $objView->assignobj($objPage); |
---|
111 | $objView->display($objPage->tpl_mainpage); |
---|
112 | |
---|
113 | /* 取得文字列の変換 */ |
---|
114 | function lfConvertParam() { |
---|
115 | global $objPage; |
---|
116 | /* |
---|
117 | * 文字列の変換 |
---|
118 | * K : 「半角(ハンカク)片仮名」を「全角片仮名」に変換 |
---|
119 | * C : 「全角ひら仮名」を「全角かた仮名」に変換 |
---|
120 | * V : 濁点付きの文字を一文字に変換。"K","H"と共に使用します |
---|
121 | * n : 「全角」数字を「半角(ハンカク)」に変換 |
---|
122 | */ |
---|
123 | $arrConvList['search_name'] = "KVa"; |
---|
124 | $arrConvList['search_product_code'] = "KVa"; |
---|
125 | |
---|
126 | // 文字変換 |
---|
127 | foreach ($arrConvList as $key => $val) { |
---|
128 | // POSTされてきた値のみ変換する。 |
---|
129 | if(isset($objPage->arrForm[$key])) { |
---|
130 | $objPage->arrForm[$key] = mb_convert_kana($objPage->arrForm[$key] ,$val); |
---|
131 | } |
---|
132 | } |
---|
133 | } |
---|
134 | |
---|
135 | ?> |
---|