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

Revision 18840, 4.7 KB checked in by Ringo, 14 years ago (diff)

#634(new バグ指摘) mypageからの退会後の左メニューでTopページへ遷移。(残:ポップアップ)

  • 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                            array("pref_id", "pref_name", "rank"));
55        $this->tpl_column_num = 1;
56        $this->httpCacheControl('nocache');
57    }
58
59    /**
60     * Page のプロセス.
61     *
62     * @return void
63     */
64    function process() {
65        $objView = new SC_SiteView();
66        $objCustomer = new SC_Customer();
67       
68        // 退会判定用情報の取得
69        $this->tpl_login = $objCustomer->isLoginSuccess();
70
71        //ログイン判定
72        if(!$objCustomer->isLoginSuccess()) {
73            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
74        }else {
75            //マイページトップ顧客情報表示用
76            $this->CustomerName1 = $objCustomer->getvalue('name01');
77            $this->CustomerName2 = $objCustomer->getvalue('name02');
78            $this->CustomerPoint = $objCustomer->getvalue('point');
79        }
80
81        // レイアウトデザインを取得
82        $objLayout = new SC_Helper_PageLayout_Ex();
83        $objLayout->sfGetPageLayout($this, false, "mypage/index.php");
84
85        $mode = isset($_POST['mode']) ? $_POST['mode'] : '';
86        $customerId = $objCustomer->getValue('customer_id');
87
88        switch($mode) {
89
90        // お届け先の削除
91        case 'delete':
92            $objForm = $this->initParam();
93            if ($objForm->checkError()) {
94                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
95                exit;
96            }
97
98            $this->deleteOtherDeliv($customerId, $objForm->getValue('other_deliv_id'));
99            break;
100
101        // お届け先の表示
102        default:
103            break;
104        }
105
106        //別のお届け先情報
107        $this->arrOtherDeliv = $this->getOtherDeliv($customerId);
108
109        //お届け先登録数
110        $this->tpl_linemax = count($this->arrOtherDeliv);;
111
112        $objView->assignobj($this);
113        $objView->display(SITE_FRAME);
114    }
115
116    /**
117     * デストラクタ.
118     *
119     * @return void
120     */
121    function destroy() {
122        parent::destroy();
123    }
124
125    /**
126     * フォームパラメータの初期化
127     *
128     * @return SC_FormParam
129     */
130    function initParam() {
131        $objForm = new SC_FormParam();
132        $objForm->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
133        $objForm->setParam($_POST);
134        $objForm->convParam();
135        return $objForm;
136    }
137
138    /**
139     * お届け先の取得
140     *
141     * @param integer $customerId
142     * @return array
143     */
144    function getOtherDeliv($customerId) {
145        $objQuery = new SC_Query;
146        $objQuery->setOrder('other_deliv_id DESC');
147        $arrRet = $objQuery->select('*', 'dtb_other_deliv', 'customer_id = ?', array($customerId));
148        return empty($arrRet) ? array() : $arrRet;
149    }
150
151    /**
152     * お届け先の削除
153     *
154     * @param integer $customerId
155     * @param integer $delivId
156     */
157    function deleteOtherDeliv($customerId, $delivId) {
158        $where = 'customer_id = ? AND other_deliv_id = ?';
159        $objQuery = new SC_Query;
160        $objQuery->delete("dtb_other_deliv", $where, array($customerId, $delivId));
161    }
162}
163?>
Note: See TracBrowser for help on using the repository browser.