source: branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Delivery.php @ 19773

Revision 19773, 5.1 KB checked in by Seasoft, 13 years ago (diff)

#829(mtb_pref を他の mtb_* と同等のテーブル定義に)

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • 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-2010 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_PATH . "pages/LC_Page.php");
26
27/**
28 * お届け先編集 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Mypage_Delivery extends LC_Page {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = TEMPLATE_DIR .'mypage/delivery.tpl';
47        $this->tpl_title = 'MYページ';
48        $this->tpl_subtitle = 'お届け先追加・変更';
49        $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
50        $this->tpl_mainno = 'mypage';
51        $this->tpl_mypageno = 'delivery';
52        $masterData = new SC_DB_MasterData_Ex();
53        $this->arrPref= $masterData->getMasterData('mtb_pref');
54        $this->tpl_column_num = 1;
55        $this->httpCacheControl('nocache');
56    }
57
58    /**
59     * Page のプロセス.
60     *
61     * @return void
62     */
63    function process() {
64        parent::process();
65        $this->action();
66        $this->sendResponse();
67    }
68
69    /**
70     * Page のAction.
71     *
72     * @return void
73     */
74    function action() {
75        //$objView = new SC_SiteView();
76        $objCustomer = new SC_Customer();
77       
78        // 退会判定用情報の取得
79        $this->tpl_login = $objCustomer->isLoginSuccess();
80
81        // ポップアップを開けたまま退会された状態でポップアップが閉じた場合のエラー画面の抑止。
82        // コメントアウトした「ログイン判定」は他の「Mypage」内に施した退会時処理で補間。
83       
84        // XXX コメントアウトによる問題が確認された場合はコメントアウトを外し、エラー画面が出る様に戻す。
85        ////ログイン判定
86        // if(!$objCustomer->isLoginSuccess()) {
87        //     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
88        // }else {
89            //マイページトップ顧客情報表示用
90            $this->CustomerName1 = $objCustomer->getvalue('name01');
91            $this->CustomerName2 = $objCustomer->getvalue('name02');
92            $this->CustomerPoint = $objCustomer->getvalue('point');
93        //}
94
95        $mode = isset($_POST['mode']) ? $_POST['mode'] : '';
96        $customerId = $objCustomer->getValue('customer_id');
97
98        switch($mode) {
99
100        // お届け先の削除
101        case 'delete':
102            $objForm = $this->initParam();
103            if ($objForm->checkError()) {
104                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
105                exit;
106            }
107
108            $this->deleteOtherDeliv($customerId, $objForm->getValue('other_deliv_id'));
109            break;
110
111        // お届け先の表示
112        default:
113            break;
114        }
115
116        //別のお届け先情報
117        $this->arrOtherDeliv = $this->getOtherDeliv($customerId);
118
119        //お届け先登録数
120        $this->tpl_linemax = count($this->arrOtherDeliv);;
121
122        //$objView->assignobj($this);
123        //$objView->display(SITE_FRAME);
124    }
125
126    /**
127     * デストラクタ.
128     *
129     * @return void
130     */
131    function destroy() {
132        parent::destroy();
133    }
134
135    /**
136     * フォームパラメータの初期化
137     *
138     * @return SC_FormParam
139     */
140    function initParam() {
141        $objForm = new SC_FormParam();
142        $objForm->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
143        $objForm->setParam($_POST);
144        $objForm->convParam();
145        return $objForm;
146    }
147
148    /**
149     * お届け先の取得
150     *
151     * @param integer $customerId
152     * @return array
153     */
154    function getOtherDeliv($customerId) {
155        $objQuery = new SC_Query;
156        $objQuery->setOrder('other_deliv_id DESC');
157        $arrRet = $objQuery->select('*', 'dtb_other_deliv', 'customer_id = ?', array($customerId));
158        return empty($arrRet) ? array() : $arrRet;
159    }
160
161    /**
162     * お届け先の削除
163     *
164     * @param integer $customerId
165     * @param integer $delivId
166     */
167    function deleteOtherDeliv($customerId, $delivId) {
168        $where = 'customer_id = ? AND other_deliv_id = ?';
169        $objQuery = new SC_Query;
170        $objQuery->delete("dtb_other_deliv", $where, array($customerId, $delivId));
171    }
172}
173?>
Note: See TracBrowser for help on using the repository browser.