source: branches/comu-ver2/data/class/pages/mypage/LC_Page_Mypage_Delivery.php @ 18234

Revision 18234, 4.6 KB checked in by Seasoft, 15 years ago (diff)

#528(改行コードが混在している)

  • SVN属性の変更。ただし、以下は除外。
    • /data/module
    • /data/pdf
    • /html/test
  • 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-2007 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                            array("pref_id", "pref_name", "rank"));
55        $this->tpl_column_num = 1;
56        $this->httpCacheControl('nocache');
57    }
58
59    /**
60     * Page のプロセス.
61     *
62     * @return void
63     */
64    function process() {
65        $objView = new SC_SiteView();
66        $objCustomer = new SC_Customer();
67
68        //ログイン判定
69        if(!$objCustomer->isLoginSuccess()) {
70            SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
71        }else {
72            //マイページトップ顧客情報表示用
73            $this->CustomerName1 = $objCustomer->getvalue('name01');
74            $this->CustomerName2 = $objCustomer->getvalue('name02');
75            $this->CustomerPoint = $objCustomer->getvalue('point');
76        }
77
78        // レイアウトデザインを取得
79        $objLayout = new SC_Helper_PageLayout_Ex();
80        $objLayout->sfGetPageLayout($this, false, "mypage/index.php");
81
82        $mode = isset($_POST['mode']) ? $_POST['mode'] : '';
83        $customerId = $objCustomer->getValue('customer_id');
84
85        switch($mode) {
86
87        // お届け先の削除
88        case 'delete':
89            $objForm = $this->initParam();
90            if ($objForm->checkError()) {
91                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
92                exit;
93            }
94
95            $this->deleteOtherDeliv($customerId, $objForm->getValue('other_deliv_id'));
96            break;
97
98        // お届け先の表示
99        default:
100            break;
101        }
102
103        //別のお届け先情報
104        $this->arrOtherDeliv = $this->getOtherDeliv($customerId);
105
106        //お届け先登録数
107        $this->tpl_linemax = count($this->arrOtherDeliv);;
108
109        $objView->assignobj($this);
110        $objView->display(SITE_FRAME);
111    }
112
113    /**
114     * デストラクタ.
115     *
116     * @return void
117     */
118    function destroy() {
119        parent::destroy();
120    }
121
122    /**
123     * フォームパラメータの初期化
124     *
125     * @return SC_FormParam
126     */
127    function initParam() {
128        $objForm = new SC_FormParam();
129        $objForm->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
130        $objForm->setParam($_POST);
131        $objForm->convParam();
132        return $objForm;
133    }
134
135    /**
136     * お届け先の取得
137     *
138     * @param integer $customerId
139     * @return array
140     */
141    function getOtherDeliv($customerId) {
142        $objQuery = new SC_Query;
143        $objQuery->setorder('other_deliv_id DESC');
144        $arrRet = $objQuery->select('*', 'dtb_other_deliv', 'customer_id = ?', array($customerId));
145        return empty($arrRet) ? array() : $arrRet;
146    }
147
148    /**
149     * お届け先の削除
150     *
151     * @param integer $customerId
152     * @param integer $delivId
153     */
154    function deleteOtherDeliv($customerId, $delivId) {
155        $where = 'customer_id = ? AND other_deliv_id = ?';
156        $objQuery = new SC_Query;
157        $objQuery->delete("dtb_other_deliv", $where, array($customerId, $delivId));
158    }
159}
160?>
Note: See TracBrowser for help on using the repository browser.