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

Revision 19713, 5.2 KB checked in by nanasess, 13 years ago (diff)
  • #748(モバイルのデザイン管理機能)
    • dtb_pagelayout, dtb_bloc, dtb_blocposition のデータを追加
    • dtb_blocposition.filename を削除
    • dtb_bloc.filename を device_type_id と filename のユニークキーへ変更
  • #787(スマートフォン対応)
    • data/install.php のモバイル関連の定数を data/class/SC_Initial.php へ移動
    • テンプレート, PHPファイル追加
  • #832 SC_Helper_PageLayout#sfGetPageLayout()) の呼び出しを1ヶ所に集約
  • #820 フラグ, マスタIDの値を定数にする
    • mtb_target の値を定数化
  • 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                            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        parent::process();
66        $this->action();
67        $this->sendResponse();
68    }
69
70    /**
71     * Page のAction.
72     *
73     * @return void
74     */
75    function action() {
76        //$objView = new SC_SiteView();
77        $objCustomer = new SC_Customer();
78       
79        // 退会判定用情報の取得
80        $this->tpl_login = $objCustomer->isLoginSuccess();
81
82        // ポップアップを開けたまま退会された状態でポップアップが閉じた場合のエラー画面の抑止。
83        // コメントアウトした「ログイン判定」は他の「Mypage」内に施した退会時処理で補間。
84       
85        // XXX コメントアウトによる問題が確認された場合はコメントアウトを外し、エラー画面が出る様に戻す。
86        ////ログイン判定
87        // if(!$objCustomer->isLoginSuccess()) {
88        //     SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
89        // }else {
90            //マイページトップ顧客情報表示用
91            $this->CustomerName1 = $objCustomer->getvalue('name01');
92            $this->CustomerName2 = $objCustomer->getvalue('name02');
93            $this->CustomerPoint = $objCustomer->getvalue('point');
94        //}
95
96        $mode = isset($_POST['mode']) ? $_POST['mode'] : '';
97        $customerId = $objCustomer->getValue('customer_id');
98
99        switch($mode) {
100
101        // お届け先の削除
102        case 'delete':
103            $objForm = $this->initParam();
104            if ($objForm->checkError()) {
105                SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR);
106                exit;
107            }
108
109            $this->deleteOtherDeliv($customerId, $objForm->getValue('other_deliv_id'));
110            break;
111
112        // お届け先の表示
113        default:
114            break;
115        }
116
117        //別のお届け先情報
118        $this->arrOtherDeliv = $this->getOtherDeliv($customerId);
119
120        //お届け先登録数
121        $this->tpl_linemax = count($this->arrOtherDeliv);;
122
123        //$objView->assignobj($this);
124        //$objView->display(SITE_FRAME);
125    }
126
127    /**
128     * デストラクタ.
129     *
130     * @return void
131     */
132    function destroy() {
133        parent::destroy();
134    }
135
136    /**
137     * フォームパラメータの初期化
138     *
139     * @return SC_FormParam
140     */
141    function initParam() {
142        $objForm = new SC_FormParam();
143        $objForm->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK'));
144        $objForm->setParam($_POST);
145        $objForm->convParam();
146        return $objForm;
147    }
148
149    /**
150     * お届け先の取得
151     *
152     * @param integer $customerId
153     * @return array
154     */
155    function getOtherDeliv($customerId) {
156        $objQuery = new SC_Query;
157        $objQuery->setOrder('other_deliv_id DESC');
158        $arrRet = $objQuery->select('*', 'dtb_other_deliv', 'customer_id = ?', array($customerId));
159        return empty($arrRet) ? array() : $arrRet;
160    }
161
162    /**
163     * お届け先の削除
164     *
165     * @param integer $customerId
166     * @param integer $delivId
167     */
168    function deleteOtherDeliv($customerId, $delivId) {
169        $where = 'customer_id = ? AND other_deliv_id = ?';
170        $objQuery = new SC_Query;
171        $objQuery->delete("dtb_other_deliv", $where, array($customerId, $delivId));
172    }
173}
174?>
Note: See TracBrowser for help on using the repository browser.