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

Revision 20911, 7.8 KB checked in by Seasoft, 13 years ago (diff)

#902 (タイトル表記をパンくずリスト形式とする)
#1290 (メニューとタイトルが一致していない)
#1291 (不要なクラス変数 $tpl_subnavi)

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