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

Revision 22567, 4.5 KB checked in by shutta, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.12.4)
Zend Framework PHP 標準コーディング規約のコーディングスタイルへ準拠。
classおよびfunctionの開始波括弧「{」のスタイルを修正。

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