source: branches/comu-ver2/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php @ 18429

Revision 18429, 7.0 KB checked in by nanasess, 14 years ago (diff)

認証判定を追加

  • Property svn:eol-style set to LF
  • Property svn:keywords set to "Id Revision Date"
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
RevLine 
[17876]1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once(CLASS_PATH . "pages/LC_Page.php");
26
27/**
28 * Admin_Customer_SearchCustomer のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Customer_SearchCustomer extends LC_Page
35{
36
37    // }}}
38    // {{{ functions
39
40    /**
41     * Page を初期化する.
42     *
43     * @return void
44     */
45    function init()
46    {
47        parent::init();
48        $this->tpl_mainpage = 'customer/search_customer.tpl';
[18187]49        $this->httpCacheControl('nocache');
[17876]50    }
51
52    /**
53     * Page のプロセス.
54     *
55     * @return void
56     */
57    function process()
58    {
[18429]59        // 認証可否の判定
60        $objSess = new SC_Session();
61        SC_Utils_Ex::sfIsSuccess($objSess);
62
[17876]63        $objView = new SC_AdminView();
64        // POSTのモードがsearchなら顧客検索開始
65        if($_POST['mode'] == 'search'){
66            $this->objFormParam = new SC_FormParam();
67            // 値の初期化
68            $this->lfInitParam();
69            // POST値の取得
70            $this->objFormParam->setParam($_POST);
71            // 入力値の変換
72            $this->objFormParam->convParam();
73
74            // 入力された値を取得する
75            $arrForm = $this->objFormParam->getHashArray();
76
77            // エラーチェック
78            $this->arrErr = $this->lfCheckError();
79            if( is_array($this->arrErr) === true && 0 < count($this->arrErr) ){
80                $is_select = false;
81            }else{
82                $where = "del_flg = 0";
83
84                // 検索
85                foreach($arrForm as $tmp_key => $val){
86                    if( is_array($val) === false && 0 < strlen($val)){
87                        $key = strtr($tmp_key , array('search_' => ''));
88                        switch($key){
89                            case 'customer_id':
90                                $where .= " AND customer_id = ? ";
91                                $sqlval[$key] = $val;
92                                break;
93                            case 'name01':
94                                    $where .= " AND name01 ILIKE ? ";
95                                    $sqlval[$key] = '%'.$val.'%';
96                                break;
97                            case 'name02':
98                                    $where .= " AND name02 ILIKE ? ";
99                                    $sqlval[$key] = '%'.$val.'%';
100                                break;
101                            case 'kana01':
102                                    $where .= " AND kana01 ILIKE ? ";
103                                    $sqlval[$key] = '%'.$val.'%';
104                                break;
105                            case 'kana02':
106                                    $where .= " AND kana02 ILIKE ? ";
107                                    $sqlval[$key] = '%'.$val.'%';
108                                break;
109                            default :
110                                break;
111                        }
112                    }
113                }
114
115                $is_select = true;
116            }
117
118
119            if( $is_select === true ){
120                $objQuery = new SC_Query();
121
122                // 既に購入した事がある顧客を取得
123                $col = '*';
124                $from = 'dtb_customer';
125                $order = 'customer_id';
126                $arrCustomer = $objQuery->select($col, $from, $where, $sqlval);
127
128                // 顧客情報を取得できたら、テンプレートに
129                if( is_array($arrCustomer) === true && count($arrCustomer) > 0){
130                    $customer_count = count($arrCustomer);
131                    if( $customer_count != 0 ){
132                        $this->tpl_linemax = $customer_count;
133                    }
134                } else {
135                    $this->tpl_linemax = null;
136                }
137
138                // ページ送りの処理
139                if(isset($_POST['search_page_max'])
140                   && is_numeric($_POST['search_page_max'])) {
141                    $page_max = $_POST['search_page_max'];
142                } else {
143                    $page_max = SEARCH_PMAX;
144                }
145
146                // ページ送りの取得
147                $objNavi = new SC_PageNavi($_POST['search_pageno'], $customer_count, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
148                $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
149                $startno = $objNavi->start_row;
150
151                // 取得範囲の指定(開始行番号、行数のセット)
152                $objQuery->setlimitoffset($page_max, $startno);
153                // 表示順序
154                $objQuery->setorder($order);
155                // 検索結果の取得
156                $this->arrCustomer = $objQuery->select($col, $from, $where, $sqlval);
157            }
158
159        }
160        // 画面の表示
161        $this->arrForm = $arrForm;
162        $objView->assignobj($this);
163        $objView->display($this->tpl_mainpage);
164    }
165
166    /**
167     * デストラクタ.
168     *
169     * @return void
170     */
171    function destroy()
172    {
173        parent::destroy();
174    }
175
176    /* パラメータ情報の初期化 */
177    function lfInitParam() {
178        $this->objFormParam->addParam("顧客ID", "search_customer_id", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
179        $this->objFormParam->addParam("顧客名(姓)", "search_name01", STEXT_LEN, "aKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
180        $this->objFormParam->addParam("顧客名(名)", "search_name02", STEXT_LEN, "aKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
181        $this->objFormParam->addParam("顧客名(カナ)", 'search_kana01', STEXT_LEN, "CKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
182        $this->objFormParam->addParam("顧客名(カナ/名)", 'search_kana02', STEXT_LEN, "CKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
183    }
184
185    /* 入力内容のチェック */
186    function lfCheckError() {
187        // 入力データを渡す。
188        $arrRet =  $this->objFormParam->getHashArray();
189        $objErr = new SC_CheckError($arrRet);
190        $objErr->arrErr = $this->objFormParam->checkError();
191
192        return $objErr->arrErr;
193    }
194}
195?>
Note: See TracBrowser for help on using the repository browser.