[16092] | 1 | <?php |
---|
| 2 | /* |
---|
[16582] | 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
[22206] | 5 | * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. |
---|
[16092] | 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. |
---|
[16092] | 22 | */ |
---|
| 23 | |
---|
[20534] | 24 | require_once CLASS_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php'; |
---|
[16092] | 25 | |
---|
| 26 | /** |
---|
| 27 | * お届け先編集 のページクラス. |
---|
| 28 | * |
---|
| 29 | * @package Page |
---|
| 30 | * @author LOCKON CO.,LTD. |
---|
| 31 | * @version $Id$ |
---|
| 32 | */ |
---|
[22856] | 33 | class LC_Page_Mypage_Delivery extends LC_Page_AbstractMypage_Ex |
---|
[22567] | 34 | { |
---|
[16092] | 35 | /** |
---|
| 36 | * Page を初期化する. |
---|
| 37 | * |
---|
| 38 | * @return void |
---|
| 39 | */ |
---|
[22567] | 40 | function init() |
---|
| 41 | { |
---|
[16092] | 42 | parent::init(); |
---|
[17519] | 43 | $this->tpl_subtitle = 'お届け先追加・変更'; |
---|
[16092] | 44 | $this->tpl_mypageno = 'delivery'; |
---|
[20147] | 45 | $masterData = new SC_DB_MasterData_Ex(); |
---|
| 46 | $this->arrPref = $masterData->getMasterData('mtb_pref'); |
---|
[18187] | 47 | $this->httpCacheControl('nocache'); |
---|
[16092] | 48 | } |
---|
| 49 | |
---|
| 50 | /** |
---|
| 51 | * Page のプロセス. |
---|
| 52 | * |
---|
| 53 | * @return void |
---|
| 54 | */ |
---|
[22567] | 55 | function process() |
---|
| 56 | { |
---|
[19661] | 57 | parent::process(); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | * Page のAction. |
---|
| 62 | * |
---|
| 63 | * @return void |
---|
| 64 | */ |
---|
[22567] | 65 | function action() |
---|
| 66 | { |
---|
[20490] | 67 | $objCustomer = new SC_Customer_Ex(); |
---|
[20147] | 68 | $customer_id = $objCustomer->getValue('customer_id'); |
---|
[22065] | 69 | $objAddress = new SC_Helper_Address_Ex(); |
---|
[20501] | 70 | $objFormParam = new SC_FormParam_Ex(); |
---|
[20041] | 71 | |
---|
[20147] | 72 | $this->lfInitParam($objFormParam); |
---|
| 73 | $objFormParam->setParam($_POST); |
---|
| 74 | $objFormParam->convParam(); |
---|
[16092] | 75 | |
---|
[21441] | 76 | switch ($this->getMode()) { |
---|
[21526] | 77 | // お届け先の削除 |
---|
| 78 | case 'delete': |
---|
| 79 | if ($objFormParam->checkError()) { |
---|
| 80 | SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); |
---|
[21743] | 81 | SC_Response_Ex::actionExit(); |
---|
[21526] | 82 | } |
---|
[16092] | 83 | |
---|
[22546] | 84 | $objAddress->deleteAddress($objFormParam->getValue('other_deliv_id')); |
---|
[21526] | 85 | break; |
---|
[21420] | 86 | |
---|
[21526] | 87 | // スマートフォン版のもっと見るボタン用 |
---|
| 88 | case 'getList': |
---|
| 89 | $arrData = $objFormParam->getHashArray(); |
---|
| 90 | //別のお届け先情報 |
---|
[22065] | 91 | $arrOtherDeliv = $objAddress->getList($customer_id, (($arrData['pageno'] - 1) * SEARCH_PMAX)); |
---|
[21526] | 92 | //県名をセット |
---|
| 93 | $arrOtherDeliv = $this->setPref($arrOtherDeliv, $this->arrPref); |
---|
| 94 | $arrOtherDeliv['delivCount'] = count($arrOtherDeliv); |
---|
| 95 | $this->arrOtherDeliv = $arrOtherDeliv; |
---|
[21596] | 96 | |
---|
[21526] | 97 | echo SC_Utils_Ex::jsonEncode($this->arrOtherDeliv); |
---|
[21743] | 98 | SC_Response_Ex::actionExit(); |
---|
[21526] | 99 | break; |
---|
| 100 | |
---|
| 101 | // お届け先の表示 |
---|
| 102 | default: |
---|
[21072] | 103 | break; |
---|
[17110] | 104 | } |
---|
[16092] | 105 | |
---|
[17110] | 106 | //別のお届け先情報 |
---|
[22065] | 107 | $this->arrOtherDeliv = $objAddress->getList($customer_id); |
---|
[16092] | 108 | |
---|
[17110] | 109 | //お届け先登録数 |
---|
[20147] | 110 | $this->tpl_linemax = count($this->arrOtherDeliv); |
---|
[21420] | 111 | |
---|
[21072] | 112 | // 1ページあたりの件数 |
---|
| 113 | $this->dispNumber = SEARCH_PMAX; |
---|
[16092] | 114 | } |
---|
| 115 | |
---|
| 116 | /** |
---|
[21072] | 117 | * フォームパラメータの初期化 |
---|
[17110] | 118 | * |
---|
| 119 | * @return SC_FormParam |
---|
| 120 | */ |
---|
[22567] | 121 | function lfInitParam(&$objFormParam) |
---|
| 122 | { |
---|
[20147] | 123 | $objFormParam->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); |
---|
[21515] | 124 | $objFormParam->addParam('現在ページ', 'pageno', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'), '', false); |
---|
[17110] | 125 | } |
---|
| 126 | |
---|
| 127 | /** |
---|
[21103] | 128 | * 県名をセット |
---|
| 129 | * |
---|
| 130 | * @param array $arrOtherDeliv |
---|
| 131 | * @param array $arrPref |
---|
| 132 | * return array |
---|
| 133 | */ |
---|
[22567] | 134 | function setPref($arrOtherDeliv, $arrPref) |
---|
| 135 | { |
---|
[21103] | 136 | if (is_array($arrOtherDeliv)) { |
---|
[21441] | 137 | foreach ($arrOtherDeliv as $key => $arrDeliv) { |
---|
[21103] | 138 | $arrOtherDeliv[$key]['prefname'] = $arrPref[$arrDeliv['pref']]; |
---|
| 139 | } |
---|
| 140 | } |
---|
[22856] | 141 | |
---|
[21103] | 142 | return $arrOtherDeliv; |
---|
| 143 | } |
---|
[16092] | 144 | } |
---|