source: branches/version-2_13_0/data/class/pages/mypage/LC_Page_Mypage_Delivery.php @ 23126

Revision 23126, 4.5 KB checked in by m_uehara, 11 years ago (diff)

#2348 r23116 - r23125 をマージ

  • 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    public 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->arrCountry   = $masterData->getMasterData('mtb_country');
48        $this->httpCacheControl('nocache');
49    }
50
51    /**
52     * Page のプロセス.
53     *
54     * @return void
55     */
56    public function process()
57    {
58        parent::process();
59    }
60
61    /**
62     * Page のAction.
63     *
64     * @return void
65     */
66    public function action()
67    {
68        $objCustomer    = new SC_Customer_Ex();
69        $customer_id    = $objCustomer->getValue('customer_id');
70        $objAddress     = new SC_Helper_Address_Ex();
71        $objFormParam   = new SC_FormParam_Ex();
72
73        $this->lfInitParam($objFormParam);
74        $objFormParam->setParam($_POST);
75        $objFormParam->convParam();
76
77        switch ($this->getMode()) {
78            // お届け先の削除
79            case 'delete':
80                if ($objFormParam->checkError()) {
81                    SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
82                    SC_Response_Ex::actionExit();
83                }
84
85                $objAddress->deleteAddress($objFormParam->getValue('other_deliv_id'));
86                break;
87
88            // スマートフォン版のもっと見るボタン用
89            case 'getList':
90                    $arrData = $objFormParam->getHashArray();
91                    //別のお届け先情報
92                    $arrOtherDeliv = $objAddress->getList($customer_id, (($arrData['pageno'] - 1) * SEARCH_PMAX));
93                    //県名をセット
94                    $arrOtherDeliv = $this->setPref($arrOtherDeliv, $this->arrPref);
95                    $arrOtherDeliv['delivCount'] = count($arrOtherDeliv);
96                    $this->arrOtherDeliv = $arrOtherDeliv;
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     * @return SC_FormParam
121     */
122    public function lfInitParam(&$objFormParam)
123    {
124        $objFormParam->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
125        $objFormParam->addParam('現在ページ', 'pageno', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'), '', false);
126    }
127
128    /**
129     * 県名をセット
130     *
131     * @param array $arrOtherDeliv
132     * @param array $arrPref
133     * return array
134     */
135    public function setPref($arrOtherDeliv, $arrPref)
136    {
137        if (is_array($arrOtherDeliv)) {
138            foreach ($arrOtherDeliv as $key => $arrDeliv) {
139                $arrOtherDeliv[$key]['prefname'] = $arrPref[$arrDeliv['pref']];
140            }
141        }
142
143        return $arrOtherDeliv;
144    }
145}
Note: See TracBrowser for help on using the repository browser.