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

Revision 19661, 6.2 KB checked in by nanasess, 13 years ago (diff)

source:branches/camp/camp-2_5-E のマージ

  • スマートフォン対応(#787)
  • プラグイン機能(#494)
  • 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_Refusal 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/refusal.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 = 'refusal';
52        $this->tpl_column_num = 1;
53    }
54
55    /**
56     * Page のプロセス.
57     *
58     * @return void
59     */
60    function process() {
61        parent::process();
62        $this->action();
63        $this->sendResponse();
64    }
65
66    /**
67     * Page のAction.
68     *
69     * @return void
70     */
71    function action() {
72        //$objView = new SC_SiteView();
73        $objCustomer = new SC_Customer();
74        $objQuery = new SC_Query();
75        $objSiteSess = new SC_SiteSession();
76       
77        // 退会判定用情報の取得
78        $this->tpl_login = $objCustomer->isLoginSuccess();
79
80        //ログイン判定
81        if (!$objCustomer->isLoginSuccess()){
82            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
83        }else {
84            //マイページトップ顧客情報表示用
85            $this->CustomerName1 = $objCustomer->getvalue('name01');
86            $this->CustomerName2 = $objCustomer->getvalue('name02');
87            $this->CustomerPoint = $objCustomer->getvalue('point');
88        }
89
90
91        // レイアウトデザインを取得
92        $objLayout = new SC_Helper_PageLayout_Ex();
93        $objLayout->sfGetPageLayout($this, false, "mypage/index.php");
94
95        if (!isset($_POST['mode'])) $_POST['mode'] = "";
96
97        switch ($_POST['mode']){
98        case 'confirm':
99
100            $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/refusal_confirm.tpl';
101            $this->tpl_subtitle = '退会手続き(確認ページ)';
102
103            // 確認ページを経由したことを登録
104            $objSiteSess->setRegistFlag();
105            // hiddenにuniqidを埋め込む
106            $this->tpl_uniqid = $objSiteSess->getUniqId();
107
108            break;
109
110        case 'complete':
111            // 正しい遷移かどうかをチェック
112            $this->lfIsValidMovement($objSiteSess);
113
114            //会員削除
115            $objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id')));
116
117            $objCustomer->EndSession();
118            //完了ページへ
119            $this->objDisplay->redirect($this->getLocation("./refusal_complete.php"));
120            exit;
121        }
122
123        //$objView->assignobj($this);
124        //$objView->display(SITE_FRAME);
125    }
126
127    /**
128     * モバイルページを初期化する.
129     *
130     * @return void
131     */
132    function mobileInit() {
133        $this->init();
134        $this->tpl_mainpage = 'mypage/refusal.tpl';
135        $this->tpl_title = "MYページ/退会手続き(入力ページ)";
136
137    }
138
139    /**
140     * Page のプロセス(モバイル).
141     *
142     * @return void
143     */
144    function mobileProcess() {
145        parent::mobileProcess();
146        $this->mobileAction();
147        $this->sendResponse();
148    }
149
150    /**
151     * Page のAction(モバイル).
152     *
153     * @return void
154     */
155    function mobileAction() {
156
157        //$objView = new SC_MobileView();
158        $objCustomer = new SC_Customer();
159        $objQuery = new SC_Query();
160
161        //ログイン判定
162        if (!$objCustomer->isLoginSuccess(true)){
163            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
164        }else {
165            //マイページトップ顧客情報表示用
166            $this->CustomerName1 = $objCustomer->getvalue('name01');
167            $this->CustomerName2 = $objCustomer->getvalue('name02');
168            $this->CustomerPoint = $objCustomer->getvalue('point');
169        }
170
171        if (isset($_POST['no'])) {
172            $this->objDisplay->redirect($this->getLocation(DIR_INDEX_URL));
173            exit;
174        } elseif (isset($_POST['complete'])){
175            //会員削除
176            $objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id')));
177
178            $where = "email = ?";
179            $objCustomer->EndSession();
180            //完了ページへ
181            $this->objDisplay->redirect($this->getLocation("./refusal_complete.php"));
182            exit;
183        }
184
185        //$objView->assignobj($this);
186        //$objView->display(SITE_FRAME);
187    }
188
189    /**
190     * デストラクタ.
191     *
192     * @return void
193     */
194    function destroy() {
195        parent::destroy();
196    }
197
198    // 正しい遷移かどうかをチェック
199    function lfIsValidMovement(&$objSiteSess) {
200        // 確認ページからの遷移かどうかをチェック
201        SC_Utils_Ex::sfIsPrePage($objSiteSess);
202
203        // uniqid がPOSTされているかをチェック
204        $uniqid = $objSiteSess->getUniqId();
205        if ( !empty($_POST['uniqid']) && ($_POST['uniqid'] === $uniqid) ) {
206            return;
207        } else {
208            SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSess);
209        }
210    }
211}
212?>
Note: See TracBrowser for help on using the repository browser.