source: branches/version-2_13-dev/data/class/pages/mypage/LC_Page_Mypage.php @ 22856

Revision 22856, 4.3 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。もう少し整えたいが、一旦現状コミット。
  • 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-2013 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
24require_once CLASS_EX_REALDIR . 'page_extends/mypage/LC_Page_AbstractMypage_Ex.php';
25
26/**
27 * MyPage のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
33class LC_Page_MyPage extends LC_Page_AbstractMypage_Ex
34{
35    /** ページナンバー */
36    var $tpl_pageno;
37
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init()
45    {
46        parent::init();
47        $this->tpl_mypageno = 'index';
48        if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
49            $this->tpl_subtitle = 'MYページ';
50        } else {
51            $this->tpl_subtitle = '購入履歴一覧';
52        }
53        $masterData = new SC_DB_MasterData_Ex();
54        $this->arrCustomerOrderStatus = $masterData->getMasterData('mtb_customer_order_status');
55
56        $this->httpCacheControl('nocache');
57    }
58
59    /**
60     * Page のプロセス.
61     *
62     * @return void
63     */
64    function process()
65    {
66        parent::process();
67    }
68
69    /**
70     * Page のAction.
71     *
72     * @return void
73     */
74    function action()
75    {
76        $objCustomer = new SC_Customer_Ex();
77        $customer_id = $objCustomer->getvalue('customer_id');
78
79        //ページ送り用
80        $this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'],
81                                            $this->lfGetOrderHistory($customer_id),
82                                            SEARCH_PMAX,
83                                            'fnNaviPage',
84                                            NAVI_PMAX,
85                                            'pageno=#page#',
86                                            SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
87
88        $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row);
89
90        switch ($this->getMode()) {
91            case 'getList':
92                echo SC_Utils_Ex::jsonEncode($this->arrOrder);
93                SC_Response_Ex::actionExit();
94                break;
95            default:
96                break;
97        }
98        // 支払い方法の取得
99        $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
100        // 1ページあたりの件数
101        $this->dispNumber = SEARCH_PMAX;
102
103        $this->json_payment = SC_Utils::jsonEncode($this->arrPayment);
104        $this->json_customer_order_status = SC_Utils::jsonEncode($this->arrCustomerOrderStatus);
105    }
106
107    /**
108     * デストラクタ.
109     *
110     * @return void
111     */
112    function destroy()
113    {
114        parent::destroy();
115    }
116
117    /**
118     * 受注履歴を返す
119     *
120     * @param mixed $customer_id
121     * @param mixed $startno 0以上の場合は受注履歴を返却する -1の場合は件数を返す
122     * @access private
123     * @return void
124     */
125    function lfGetOrderHistory($customer_id, $startno = -1)
126    {
127        $objQuery   = SC_Query_Ex::getSingletonInstance();
128
129        $col        = 'order_id, create_date, payment_id, payment_total, status';
130        $from       = 'dtb_order';
131        $where      = 'del_flg = 0 AND customer_id = ?';
132        $arrWhereVal = array($customer_id);
133        $order      = 'order_id DESC';
134
135        if ($startno == -1) {
136            return $objQuery->count($from, $where, $arrWhereVal);
137        }
138
139        $objQuery->setLimitOffset(SEARCH_PMAX, $startno);
140        // 表示順序
141        $objQuery->setOrder($order);
142
143        //購入履歴の取得
144        return $objQuery->select($col, $from, $where, $arrWhereVal);
145    }
146}
Note: See TracBrowser for help on using the repository browser.