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

Revision 21693, 8.5 KB checked in by h_yoshimoto, 12 years ago (diff)

#1692 フックポイント名を変更

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