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

Revision 23124, 4.4 KB checked in by kimoto, 11 years ago (diff)

#2043 typo修正・ソース整形・ソースコメントの改善 for 2.13.0
PHP4的な書き方の修正

  • 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    public $tpl_pageno;
37
38    /**
39     * Page を初期化する.
40     *
41     * @return void
42     */
43    public function init()
44    {
45        parent::init();
46        $this->tpl_mypageno = 'index';
47        if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) {
48            $this->tpl_subtitle = 'MYページ';
49        } else {
50            $this->tpl_subtitle = '購入履歴一覧';
51        }
52        $masterData = new SC_DB_MasterData_Ex();
53        $this->arrCustomerOrderStatus = $masterData->getMasterData('mtb_customer_order_status');
54
55        $this->httpCacheControl('nocache');
56    }
57
58    /**
59     * Page のプロセス.
60     *
61     * @return void
62     */
63    public function process()
64    {
65        parent::process();
66    }
67
68    /**
69     * Page のAction.
70     *
71     * @return void
72     */
73    public function action()
74    {
75        //決済処理中ステータスのロールバック
76        $objPurchase = new SC_Helper_Purchase_Ex();
77        $objPurchase->checkSessionPendingOrder();
78        $objPurchase->checkDbMyPendignOrder();
79        $objPurchase->checkDbAllPendingOrder();
80
81        $objCustomer = new SC_Customer_Ex();
82        $customer_id = $objCustomer->getValue('customer_id');
83
84        //ページ送り用
85        $this->objNavi = new SC_PageNavi_Ex($_REQUEST['pageno'],
86                                            $this->lfGetOrderHistory($customer_id),
87                                            SEARCH_PMAX,
88                                            'eccube.movePage',
89                                            NAVI_PMAX,
90                                            'pageno=#page#',
91                                            SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE);
92
93        $this->arrOrder = $this->lfGetOrderHistory($customer_id, $this->objNavi->start_row);
94
95        switch ($this->getMode()) {
96            case 'getList':
97                echo SC_Utils_Ex::jsonEncode($this->arrOrder);
98                SC_Response_Ex::actionExit();
99                break;
100            default:
101                break;
102        }
103        // 支払い方法の取得
104        $this->arrPayment = SC_Helper_Payment_Ex::getIDValueList();
105        // 1ページあたりの件数
106        $this->dispNumber = SEARCH_PMAX;
107
108        $this->json_payment = SC_Utils::jsonEncode($this->arrPayment);
109        $this->json_customer_order_status = SC_Utils::jsonEncode($this->arrCustomerOrderStatus);
110    }
111
112    /**
113     * 受注履歴を返す
114     *
115     * @param mixed $customer_id
116     * @param mixed $startno     0以上の場合は受注履歴を返却する -1の場合は件数を返す
117     * @access private
118     * @return void
119     */
120    public function lfGetOrderHistory($customer_id, $startno = -1)
121    {
122        $objQuery   = SC_Query_Ex::getSingletonInstance();
123
124        $col        = 'order_id, create_date, payment_id, payment_total, status';
125        $from       = 'dtb_order';
126        $where      = 'del_flg = 0 AND customer_id = ?';
127        $arrWhereVal = array($customer_id);
128        $order      = 'order_id DESC';
129
130        if ($startno == -1) {
131            return $objQuery->count($from, $where, $arrWhereVal);
132        }
133
134        $objQuery->setLimitOffset(SEARCH_PMAX, $startno);
135        // 表示順序
136        $objQuery->setOrder($order);
137
138        //購入履歴の取得
139        return $objQuery->select($col, $from, $where, $arrWhereVal);
140    }
141}
Note: See TracBrowser for help on using the repository browser.