| 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 |
|---|
| 25 | require_once(CLASS_PATH . "pages/LC_Page.php"); |
|---|
| 26 | |
|---|
| 27 | /** |
|---|
| 28 | * 退会手続き のページクラス. |
|---|
| 29 | * |
|---|
| 30 | * @package Page |
|---|
| 31 | * @author LOCKON CO.,LTD. |
|---|
| 32 | * @version $Id$ |
|---|
| 33 | */ |
|---|
| 34 | class 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_navi = TEMPLATE_DIR . 'mypage/navi.tpl'; |
|---|
| 49 | $this->tpl_mainno = 'mypage'; |
|---|
| 50 | $this->tpl_mypageno = 'refusal'; |
|---|
| 51 | $this->tpl_column_num = 1; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | /** |
|---|
| 55 | * Page のプロセス. |
|---|
| 56 | * |
|---|
| 57 | * @return void |
|---|
| 58 | */ |
|---|
| 59 | function process() { |
|---|
| 60 | $objView = new SC_SiteView(); |
|---|
| 61 | $objCustomer = new SC_Customer(); |
|---|
| 62 | $objQuery = new SC_Query(); |
|---|
| 63 | $objSiteSess = new SC_SiteSession(); |
|---|
| 64 | |
|---|
| 65 | //ログイン判定 |
|---|
| 66 | if (!$objCustomer->isLoginSuccess()){ |
|---|
| 67 | SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); |
|---|
| 68 | }else { |
|---|
| 69 | //マイページトップ顧客情報表示用 |
|---|
| 70 | $this->CustomerName1 = $objCustomer->getvalue('name01'); |
|---|
| 71 | $this->CustomerName2 = $objCustomer->getvalue('name02'); |
|---|
| 72 | $this->CustomerPoint = $objCustomer->getvalue('point'); |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | // レイアウトデザインを取得 |
|---|
| 77 | $objLayout = new SC_Helper_PageLayout_Ex(); |
|---|
| 78 | $objLayout->sfGetPageLayout($this, false, "mypage/index.php"); |
|---|
| 79 | |
|---|
| 80 | if (!isset($_POST['mode'])) $_POST['mode'] = ""; |
|---|
| 81 | |
|---|
| 82 | switch ($_POST['mode']){ |
|---|
| 83 | case 'confirm': |
|---|
| 84 | |
|---|
| 85 | $this->tpl_mainpage = TEMPLATE_DIR . 'mypage/refusal_confirm.tpl'; |
|---|
| 86 | $this->tpl_title = "MYページ/退会手続き(確認ページ)"; |
|---|
| 87 | |
|---|
| 88 | // 確認ページを経由したことを登録 |
|---|
| 89 | $objSiteSess->setRegistFlag(); |
|---|
| 90 | // hiddenにuniqidを埋め込む |
|---|
| 91 | $this->tpl_uniqid = $objSiteSess->getUniqId(); |
|---|
| 92 | |
|---|
| 93 | break; |
|---|
| 94 | |
|---|
| 95 | case 'complete': |
|---|
| 96 | // 正しい遷移かどうかをチェック |
|---|
| 97 | $this->lfIsValidMovement($objSiteSess); |
|---|
| 98 | |
|---|
| 99 | //会員削除 |
|---|
| 100 | $objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id'))); |
|---|
| 101 | |
|---|
| 102 | $objCustomer->EndSession(); |
|---|
| 103 | //完了ページへ |
|---|
| 104 | $this->sendRedirect($this->getLocation("./refusal_complete.php")); |
|---|
| 105 | exit; |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | $objView->assignobj($this); |
|---|
| 109 | $objView->display(SITE_FRAME); |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | /** |
|---|
| 113 | * モバイルページを初期化する. |
|---|
| 114 | * |
|---|
| 115 | * @return void |
|---|
| 116 | */ |
|---|
| 117 | function mobileInit() { |
|---|
| 118 | $this->tpl_mainpage = 'mypage/refusal.tpl'; |
|---|
| 119 | $this->tpl_title = "MYページ/退会手続き(入力ページ)"; |
|---|
| 120 | |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | /** |
|---|
| 124 | * Page のプロセス(モバイル). |
|---|
| 125 | * |
|---|
| 126 | * @return void |
|---|
| 127 | */ |
|---|
| 128 | function mobileProcess() { |
|---|
| 129 | $objView = new SC_MobileView(); |
|---|
| 130 | $objCustomer = new SC_Customer(); |
|---|
| 131 | $objQuery = new SC_Query(); |
|---|
| 132 | |
|---|
| 133 | //ログイン判定 |
|---|
| 134 | if (!$objCustomer->isLoginSuccess(true)){ |
|---|
| 135 | SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); |
|---|
| 136 | }else { |
|---|
| 137 | //マイページトップ顧客情報表示用 |
|---|
| 138 | $this->CustomerName1 = $objCustomer->getvalue('name01'); |
|---|
| 139 | $this->CustomerName2 = $objCustomer->getvalue('name02'); |
|---|
| 140 | $this->CustomerPoint = $objCustomer->getvalue('point'); |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | if (isset($_POST['no'])) { |
|---|
| 144 | $this->sendRedirect($this->getLocation("./index.php"), true); |
|---|
| 145 | exit; |
|---|
| 146 | } elseif (isset($_POST['complete'])){ |
|---|
| 147 | //会員削除 |
|---|
| 148 | $objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id'))); |
|---|
| 149 | |
|---|
| 150 | $where = "email = ?"; |
|---|
| 151 | $objCustomer->EndSession(); |
|---|
| 152 | //完了ページへ |
|---|
| 153 | $this->sendRedirect($this->getLocation("./refusal_complete.php"), true); |
|---|
| 154 | exit; |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | $objView->assignobj($this); |
|---|
| 158 | $objView->display(SITE_FRAME); |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | /** |
|---|
| 162 | * デストラクタ. |
|---|
| 163 | * |
|---|
| 164 | * @return void |
|---|
| 165 | */ |
|---|
| 166 | function destroy() { |
|---|
| 167 | parent::destroy(); |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | // 正しい遷移かどうかをチェック |
|---|
| 171 | function lfIsValidMovement(&$objSiteSess) { |
|---|
| 172 | // 確認ページからの遷移かどうかをチェック |
|---|
| 173 | SC_Utils_Ex::sfIsPrePage($objSiteSess); |
|---|
| 174 | |
|---|
| 175 | // uniqid がPOSTされているかをチェック |
|---|
| 176 | $uniqid = $objSiteSess->getUniqId(); |
|---|
| 177 | if ( !empty($_POST['uniqid']) && ($_POST['uniqid'] === $uniqid) ) { |
|---|
| 178 | return; |
|---|
| 179 | } else { |
|---|
| 180 | SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSess); |
|---|
| 181 | } |
|---|
| 182 | } |
|---|
| 183 | } |
|---|
| 184 | ?> |
|---|