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

Revision 22856, 7.5 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

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