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

Revision 22856, 4.5 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。もう少し整えたいが、一旦現状コミット。
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • 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-2013 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
24require_once CLASS_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php';
25
26/**
27 * お届け先編集 のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
33class LC_Page_Mypage_Delivery extends LC_Page_AbstractMypage_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    function init()
41    {
42        parent::init();
43        $this->tpl_subtitle = 'お届け先追加・変更';
44        $this->tpl_mypageno = 'delivery';
45        $masterData         = new SC_DB_MasterData_Ex();
46        $this->arrPref      = $masterData->getMasterData('mtb_pref');
47        $this->httpCacheControl('nocache');
48    }
49
50    /**
51     * Page のプロセス.
52     *
53     * @return void
54     */
55    function process()
56    {
57        parent::process();
58    }
59
60    /**
61     * Page のAction.
62     *
63     * @return void
64     */
65    function action()
66    {
67        $objCustomer    = new SC_Customer_Ex();
68        $customer_id    = $objCustomer->getValue('customer_id');
69        $objAddress     = new SC_Helper_Address_Ex();
70        $objFormParam   = new SC_FormParam_Ex();
71
72        $this->lfInitParam($objFormParam);
73        $objFormParam->setParam($_POST);
74        $objFormParam->convParam();
75
76        switch ($this->getMode()) {
77            // お届け先の削除
78            case 'delete':
79                if ($objFormParam->checkError()) {
80                    SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
81                    SC_Response_Ex::actionExit();
82                }
83
84                $objAddress->deleteAddress($objFormParam->getValue('other_deliv_id'));
85                break;
86
87            // スマートフォン版のもっと見るボタン用
88            case 'getList':
89                    $arrData = $objFormParam->getHashArray();
90                    //別のお届け先情報
91                    $arrOtherDeliv = $objAddress->getList($customer_id, (($arrData['pageno'] - 1) * SEARCH_PMAX));
92                    //県名をセット
93                    $arrOtherDeliv = $this->setPref($arrOtherDeliv, $this->arrPref);
94                    $arrOtherDeliv['delivCount'] = count($arrOtherDeliv);
95                    $this->arrOtherDeliv = $arrOtherDeliv;
96
97
98                    echo SC_Utils_Ex::jsonEncode($this->arrOtherDeliv);
99                    SC_Response_Ex::actionExit();
100                    break;
101
102            // お届け先の表示
103            default:
104                break;
105        }
106
107        //別のお届け先情報
108        $this->arrOtherDeliv = $objAddress->getList($customer_id);
109
110        //お届け先登録数
111        $this->tpl_linemax = count($this->arrOtherDeliv);
112
113        // 1ページあたりの件数
114        $this->dispNumber = SEARCH_PMAX;
115
116
117    }
118
119    /**
120     * デストラクタ.
121     *
122     * @return void
123     */
124    function destroy()
125    {
126        parent::destroy();
127    }
128
129    /**
130     * フォームパラメータの初期化
131     *
132     * @return SC_FormParam
133     */
134    function lfInitParam(&$objFormParam)
135    {
136        $objFormParam->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
137        $objFormParam->addParam('現在ページ', 'pageno', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'), '', false);
138    }
139
140    /**
141     * 県名をセット
142     *
143     * @param array $arrOtherDeliv
144     * @param array $arrPref
145     * return array
146     */
147    function setPref($arrOtherDeliv, $arrPref)
148    {
149        if (is_array($arrOtherDeliv)) {
150            foreach ($arrOtherDeliv as $key => $arrDeliv) {
151                $arrOtherDeliv[$key]['prefname'] = $arrPref[$arrDeliv['pref']];
152            }
153        }
154
155        return $arrOtherDeliv;
156    }
157}
Note: See TracBrowser for help on using the repository browser.