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

Revision 23605, 7.5 KB checked in by kimoto, 10 years ago (diff)

#2448 typo修正・ソース整形・ソースコメントの改善 for 2.13.3

Scrutinizer Auto-Fixes

This patch was automatically generated as part of the following inspection:
 https://scrutinizer-ci.com/g/nobuhiko/EC-CUBE/inspections/d8722894-69a6-4b1b-898d-43618035c60d

Enabled analysis tools:

  • PHP Analyzer
  • PHP PDepend
  • PHP Similarity Analyzer
  • PHP Change Tracking Analyzer
  • 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-2014 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    public 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    public function process()
86    {
87        $this->action();
88        $this->sendResponse();
89    }
90
91    /**
92     * Page のアクション.
93     *
94     * @return void
95     */
96    public 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     * @param  SC_FormParam_Ex $objFormParam フォームパラメータークラス
146     * @return void
147     */
148    public function lfInitParam(&$objFormParam)
149    {
150        SC_Helper_Customer_Ex::sfSetSearchParam($objFormParam);
151        $objFormParam->addParam('編集対象会員ID', 'edit_customer_id', INT_LEN, 'n', array('NUM_CHECK','MAX_LENGTH_CHECK'));
152    }
153
154    /**
155     * エラーチェック
156     *
157     * @param  array $objFormParam フォームパラメータークラス
158     * @return array エラー配列
159     */
160    public function lfCheckError(&$objFormParam)
161    {
162        return SC_Helper_Customer_Ex::sfCheckErrorSearchParam($objFormParam);
163    }
164
165    /**
166     * 会員を削除する処理
167     *
168     * @param  integer $customer_id 会員ID
169     * @return boolean true:成功 false:失敗
170     */
171    public function lfDoDeleteCustomer($customer_id)
172    {
173        return SC_Helper_Customer_Ex::delete($customer_id);
174    }
175
176    /**
177     * 会員に登録メールを再送する処理
178     *
179     * @param  integer $customer_id 会員ID
180     * @return boolean true:成功 false:失敗
181     */
182    public function lfDoResendMail($customer_id)
183    {
184        $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id);
185        if (SC_Utils_Ex::isBlank($arrData) or $arrData['del_flg'] == 1) {
186            //対象となるデータが見つからない、または削除済み
187            return false;
188        }
189        //仮登録メール再送
190        $resend_flg = true;
191        // 登録メール再送
192        $objHelperMail = new SC_Helper_Mail_Ex();
193        $objHelperMail->setPage($this);
194        $objHelperMail->sfSendRegistMail($arrData['secret_key'], $customer_id, null, $resend_flg);
195        return true;
196    }
197
198    /**
199     * 会員一覧を検索する処理
200     *
201     * @param  array  $arrParam 検索パラメーター連想配列
202     * @return array( integer 全体件数, mixed 会員データ一覧配列, mixed SC_PageNaviオブジェクト)
203     */
204    public function lfDoSearch($arrParam)
205    {
206        return SC_Helper_Customer_Ex::sfGetSearchData($arrParam);
207    }
208
209    /**
210     * 会員一覧CSVを検索してダウンロードする処理
211     *
212     * @param  array   $arrParam 検索パラメーター連想配列
213     * @return boolean|string true:成功 false:失敗
214     */
215    public function lfDoCSV($arrParam)
216    {
217        $objSelect = new SC_CustomerList_Ex($arrParam, 'customer');
218        $objCSV = new SC_Helper_CSV_Ex();
219
220        $order = 'update_date DESC, customer_id DESC';
221
222        list($where, $arrVal) = $objSelect->getWhere();
223
224        return $objCSV->sfDownloadCsv('2', $where, $arrVal, $order, true);
225    }
226}
Note: See TracBrowser for help on using the repository browser.