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