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

Revision 19783, 5.1 KB checked in by nanasess, 13 years ago (diff)

#748(モバイル/スマートフォンのデザイン管理)

  • r19782 の続き. レイアウトが崩れていたのを修正
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id Revision Date
  • 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-2010 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_PATH . "pages/LC_Page.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 {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = TEMPLATE_DIR .'mypage/delivery.tpl';
47        $this->tpl_title = 'MYページ';
48        $this->tpl_subtitle = 'お届け先追加・変更';
49        $this->tpl_navi = TEMPLATE_DIR . 'mypage/navi.tpl';
50        $this->tpl_mainno = 'mypage';
51        $this->tpl_mypageno = 'delivery';
52        $masterData = new SC_DB_MasterData_Ex();
53        $this->arrPref= $masterData->getMasterData('mtb_pref');
54        $this->httpCacheControl('nocache');
55    }
56
57    /**
58     * Page のプロセス.
59     *
60     * @return void
61     */
62    function process() {
63        parent::process();
64        $this->action();
65        $this->sendResponse();
66    }
67
68    /**
69     * Page のAction.
70     *
71     * @return void
72     */
73    function action() {
74        //$objView = new SC_SiteView();
75        $objCustomer = new SC_Customer();
76       
77        // 退会判定用情報の取得
78        $this->tpl_login = $objCustomer->isLoginSuccess();
79
80        // ポップアップを開けたまま退会された状態でポップアップが閉じた場合のエラー画面の抑止。
81        // コメントアウトした「ログイン判定」は他の「Mypage」内に施した退会時処理で補間。
82       
83        // XXX コメントアウトによる問題が確認された場合はコメントアウトを外し、エラー画面が出る様に戻す。
84        ////ログイン判定
85        // if(!$objCustomer->isLoginSuccess()) {
86        //     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
87        // }else {
88            //マイページトップ顧客情報表示用
89            $this->CustomerName1 = $objCustomer->getvalue('name01');
90            $this->CustomerName2 = $objCustomer->getvalue('name02');
91            $this->CustomerPoint = $objCustomer->getvalue('point');
92        //}
93
94        $mode = isset($_POST['mode']) ? $_POST['mode'] : '';
95        $customerId = $objCustomer->getValue('customer_id');
96
97        switch($mode) {
98
99        // お届け先の削除
100        case 'delete':
101            $objForm = $this->initParam();
102            if ($objForm->checkError()) {
103                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
104                exit;
105            }
106
107            $this->deleteOtherDeliv($customerId, $objForm->getValue('other_deliv_id'));
108            break;
109
110        // お届け先の表示
111        default:
112            break;
113        }
114
115        //別のお届け先情報
116        $this->arrOtherDeliv = $this->getOtherDeliv($customerId);
117
118        //お届け先登録数
119        $this->tpl_linemax = count($this->arrOtherDeliv);;
120
121        //$objView->assignobj($this);
122        //$objView->display(SITE_FRAME);
123    }
124
125    /**
126     * デストラクタ.
127     *
128     * @return void
129     */
130    function destroy() {
131        parent::destroy();
132    }
133
134    /**
135     * フォームパラメータの初期化
136     *
137     * @return SC_FormParam
138     */
139    function initParam() {
140        $objForm = new SC_FormParam();
141        $objForm->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
142        $objForm->setParam($_POST);
143        $objForm->convParam();
144        return $objForm;
145    }
146
147    /**
148     * お届け先の取得
149     *
150     * @param integer $customerId
151     * @return array
152     */
153    function getOtherDeliv($customerId) {
154        $objQuery = new SC_Query;
155        $objQuery->setOrder('other_deliv_id DESC');
156        $arrRet = $objQuery->select('*', 'dtb_other_deliv', 'customer_id = ?', array($customerId));
157        return empty($arrRet) ? array() : $arrRet;
158    }
159
160    /**
161     * お届け先の削除
162     *
163     * @param integer $customerId
164     * @param integer $delivId
165     */
166    function deleteOtherDeliv($customerId, $delivId) {
167        $where = 'customer_id = ? AND other_deliv_id = ?';
168        $objQuery = new SC_Query;
169        $objQuery->delete("dtb_other_deliv", $where, array($customerId, $delivId));
170    }
171}
172?>
Note: See TracBrowser for help on using the repository browser.