source: branches/version-2_12-dev/data/class/pages/admin/customer/LC_Page_Admin_Customer.php @ 22569

Revision 22569, 7.5 KB checked in by pineray, 11 years ago (diff)

#2044 会員の削除に関する処理を統一する.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2013 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_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
26
27/**
28 * 会員管理 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Customer extends LC_Page_Admin_Ex
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/index.tpl';
49        $this->tpl_mainno = 'customer';
50        $this->tpl_subno = 'index';
51        $this->tpl_pager = 'pager.tpl';
52        $this->tpl_maintitle = '会員管理';
53        $this->tpl_subtitle = '会員マスター';
54
55        $masterData = new SC_DB_MasterData_Ex();
56        $this->arrPref = $masterData->getMasterData('mtb_pref');
57        $this->arrJob = $masterData->getMasterData('mtb_job');
58        $this->arrJob['不明'] = '不明';
59        $this->arrSex = $masterData->getMasterData('mtb_sex');
60        $this->arrPageMax = $masterData->getMasterData('mtb_page_max');
61        $this->arrStatus = $masterData->getMasterData('mtb_customer_status');
62        $this->arrMagazineType = $masterData->getMasterData('mtb_magazine_type');
63
64        // 日付プルダウン設定
65        $objDate = new SC_Date_Ex();
66        // 登録・更新日検索用
67        $objDate->setStartYear(RELEASE_YEAR);
68        $objDate->setEndYear(DATE('Y'));
69        $this->arrRegistYear = $objDate->getYear();
70        // 生年月日検索用
71        $objDate->setStartYear(BIRTH_YEAR);
72        $objDate->setEndYear(DATE('Y'));
73        $this->arrBirthYear = $objDate->getYear();
74        // 月日の設定
75        $this->arrMonth = $objDate->getMonth();
76        $this->arrDay = $objDate->getDay();
77
78        // カテゴリ一覧設定
79        $objDb = new SC_Helper_DB_Ex();
80        $this->arrCatList = $objDb->sfGetCategoryList();
81
82        $this->httpCacheControl('nocache');
83    }
84
85    /**
86     * Page のプロセス.
87     *
88     * @return void
89     */
90    function process()
91    {
92        $this->action();
93        $this->sendResponse();
94    }
95
96    /**
97     * Page のアクション.
98     *
99     * @return void
100     */
101    function action()
102    {
103
104        // パラメーター管理クラス
105        $objFormParam = new SC_FormParam_Ex();
106        // パラメーター設定
107        $this->lfInitParam($objFormParam);
108        $objFormParam->setParam($_POST);
109        $objFormParam->convParam();
110        // パラメーター読み込み
111        $this->arrForm = $objFormParam->getFormParamList();
112        // 検索ワードの引き継ぎ
113        $this->arrHidden = $objFormParam->getSearchArray();
114
115        // 入力パラメーターチェック
116        $this->arrErr = $this->lfCheckError($objFormParam);
117        if (!SC_Utils_Ex::isBlank($this->arrErr)) {
118            return;
119        }
120
121        // モードによる処理切り替え
122        switch ($this->getMode()) {
123            case 'delete':
124                $this->is_delete = $this->lfDoDeleteCustomer($objFormParam->getValue('edit_customer_id'));
125                list($this->tpl_linemax, $this->arrData, $this->objNavi) = $this->lfDoSearch($objFormParam->getHashArray());
126                $this->arrPagenavi = $this->objNavi->arrPagenavi;
127                break;
128            case 'resend_mail':
129                $this->is_resendmail = $this->lfDoResendMail($objFormParam->getValue('edit_customer_id'));
130                list($this->tpl_linemax, $this->arrData, $this->objNavi) = $this->lfDoSearch($objFormParam->getHashArray());
131                $this->arrPagenavi = $this->objNavi->arrPagenavi;
132                break;
133            case 'search':
134                list($this->tpl_linemax, $this->arrData, $this->objNavi) = $this->lfDoSearch($objFormParam->getHashArray());
135                $this->arrPagenavi = $this->objNavi->arrPagenavi;
136                break;
137            case 'csv':
138
139                $this->lfDoCSV($objFormParam->getHashArray());
140                SC_Response_Ex::actionExit();
141                break;
142            default:
143                break;
144        }
145
146    }
147
148    /**
149     * デストラクタ.
150     *
151     * @return void
152     */
153    function destroy()
154    {
155        parent::destroy();
156    }
157
158    /**
159     * パラメーター情報の初期化
160     *
161     * @param array $objFormParam フォームパラメータークラス
162     * @return void
163     */
164    function lfInitParam(&$objFormParam)
165    {
166        SC_Helper_Customer_Ex::sfSetSearchParam($objFormParam);
167        $objFormParam->addParam('編集対象会員ID', 'edit_customer_id', INT_LEN, 'n', array('NUM_CHECK','MAX_LENGTH_CHECK'));
168    }
169
170    /**
171     * エラーチェック
172     *
173     * @param array $objFormParam フォームパラメータークラス
174     * @return array エラー配列
175     */
176    function lfCheckError(&$objFormParam)
177    {
178        return SC_Helper_Customer_Ex::sfCheckErrorSearchParam($objFormParam);
179    }
180
181    /**
182     * 会員を削除する処理
183     *
184     * @param integer $customer_id 会員ID
185     * @return boolean true:成功 false:失敗
186     */
187    function lfDoDeleteCustomer($customer_id)
188    {
189        return SC_Helper_Customer_Ex::delete($customer_id);
190    }
191
192    /**
193     * 会員に登録メールを再送する処理
194     *
195     * @param integer $customer_id 会員ID
196     * @return boolean true:成功 false:失敗
197     */
198    function lfDoResendMail($customer_id)
199    {
200        $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
201        if (SC_Utils_Ex::isBlank($arrData) or $arrData['del_flg'] == 1) {
202            //対象となるデータが見つからない、または削除済み
203            return false;
204        }
205        // 登録メール再送
206        $objHelperMail = new SC_Helper_Mail_Ex();
207        $objHelperMail->setPage($this);
208        $objHelperMail->sfSendRegistMail($arrData['secret_key'], $customer_id);
209        return true;
210    }
211
212    /**
213     * 会員一覧を検索する処理
214     *
215     * @param array $arrParam 検索パラメーター連想配列
216     * @return array( integer 全体件数, mixed 会員データ一覧配列, mixed SC_PageNaviオブジェクト)
217     */
218    function lfDoSearch($arrParam)
219    {
220        return SC_Helper_Customer_Ex::sfGetSearchData($arrParam);
221    }
222
223    /**
224     * 会員一覧CSVを検索してダウンロードする処理
225     *
226     * @param array $arrParam 検索パラメーター連想配列
227     * @return boolean true:成功 false:失敗
228     */
229    function lfDoCSV($arrParam)
230    {
231        $objSelect = new SC_CustomerList_Ex($arrParam, 'customer');
232        $order = 'update_date DESC, customer_id DESC';
233
234        $objCSV = new SC_Helper_CSV_Ex();
235        list($where, $arrVal) = $objSelect->getWhere();
236        return $objCSV->sfDownloadCsv('2', $where, $arrVal, $order, true);
237    }
238}
Note: See TracBrowser for help on using the repository browser.