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

Revision 19788, 5.0 KB checked in by nanasess, 13 years ago (diff)

#881(冗長な tpl_mainpage の削除)

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