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

Revision 20490, 3.8 KB checked in by shutta, 13 years ago (diff)

SC_Customerクラスのclass_extends対応

  • 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-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_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    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_subtitle = 'お届け先追加・変更';
47        $this->tpl_mypageno = 'delivery';
48        $masterData         = new SC_DB_MasterData_Ex();
49        $this->arrPref      = $masterData->getMasterData('mtb_pref');
50        $this->httpCacheControl('nocache');
51    }
52
53    /**
54     * Page のプロセス.
55     *
56     * @return void
57     */
58    function process() {
59        parent::process();
60    }
61
62    /**
63     * Page のAction.
64     *
65     * @return void
66     */
67    function action() {
68        $objCustomer    = new SC_Customer_Ex();
69        $customer_id    = $objCustomer->getValue('customer_id');
70        $objFormParam   = new SC_FormParam();
71
72        $this->lfInitParam($objFormParam);
73        $objFormParam->setParam($_POST);
74        $objFormParam->convParam();
75
76        switch($this->getMode()) {
77
78        // お届け先の削除
79        case 'delete':
80            if ($objFormParam->checkError()) {
81                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
82                exit;
83            }
84
85            $this->deleteOtherDeliv($customer_id, $objFormParam->getValue('other_deliv_id'));
86            break;
87
88        // お届け先の表示
89        default:
90            break;
91        }
92
93        //別のお届け先情報
94        $this->arrOtherDeliv = $this->getOtherDeliv($customer_id);
95
96        //お届け先登録数
97        $this->tpl_linemax = count($this->arrOtherDeliv);
98    }
99
100    /**
101     * デストラクタ.
102     *
103     * @return void
104     */
105    function destroy() {
106        parent::destroy();
107    }
108
109    /**
110     * フォームパラメータの初期化
111     *
112     * @return SC_FormParam
113     */
114    function lfInitParam(&$objFormParam) {
115        $objFormParam->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
116    }
117
118    /**
119     * お届け先の取得
120     *
121     * @param integer $customerId
122     * @return array
123     */
124    function getOtherDeliv($customer_id) {
125        $objQuery   =& SC_Query::getSingletonInstance();
126        $objQuery->setOrder('other_deliv_id DESC');
127        return $objQuery->select('*', 'dtb_other_deliv', 'customer_id = ?', array($customer_id));
128    }
129
130    /**
131     * お届け先の削除
132     *
133     * @param integer $customerId
134     * @param integer $delivId
135     */
136    function deleteOtherDeliv($customer_id, $deliv_id) {
137        $where      = 'customer_id = ? AND other_deliv_id = ?';
138        $objQuery   =& SC_Query::getSingletonInstance();
139        $objQuery->delete("dtb_other_deliv", $where, array($customer_id, $deliv_id));
140    }
141}
Note: See TracBrowser for help on using the repository browser.