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

Revision 22926, 4.3 KB checked in by Seasoft, 11 years ago (diff)

#2287 (環境によりデストラクタが正しく動作しないケースがある)
#2288 (リクエスト単位で実行されるべきログ出力がブロックにも適用されている)
#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 不明確な仕様にコメントを残した。
  • 親デストラクタを呼ぶだけの記述は可読性が悪くなると考え削除した。(上述のチケットで OS の仕様に依存したデストラクタとなるため、敢えてアプリケーション側で記述しておく意義は薄れたという認識のもと。)
  • 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                    echo SC_Utils_Ex::jsonEncode($this->arrOtherDeliv);
98                    SC_Response_Ex::actionExit();
99                    break;
100
101            // お届け先の表示
102            default:
103                break;
104        }
105
106        //別のお届け先情報
107        $this->arrOtherDeliv = $objAddress->getList($customer_id);
108
109        //お届け先登録数
110        $this->tpl_linemax = count($this->arrOtherDeliv);
111
112        // 1ページあたりの件数
113        $this->dispNumber = SEARCH_PMAX;
114    }
115
116    /**
117     * フォームパラメータの初期化
118     *
119     * @return SC_FormParam
120     */
121    function lfInitParam(&$objFormParam)
122    {
123        $objFormParam->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
124        $objFormParam->addParam('現在ページ', 'pageno', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'), '', false);
125    }
126
127    /**
128     * 県名をセット
129     *
130     * @param array $arrOtherDeliv
131     * @param array $arrPref
132     * return array
133     */
134    function setPref($arrOtherDeliv, $arrPref)
135    {
136        if (is_array($arrOtherDeliv)) {
137            foreach ($arrOtherDeliv as $key => $arrDeliv) {
138                $arrOtherDeliv[$key]['prefname'] = $arrPref[$arrDeliv['pref']];
139            }
140        }
141
142        return $arrOtherDeliv;
143    }
144}
Note: See TracBrowser for help on using the repository browser.