source: branches/eccube-donation/html/frontparts/bloc/thank_you.php @ 20699

Revision 20699, 4.0 KB checked in by tao, 13 years ago (diff)

#refs fseek() を追加

Line 
1<style type="text/css">
2div#thankyou{border: none;background: #E0ECEF;text-align: center;overflow: auto;margin:12px auto;}
3div#thankyou div#innner{margin:8px;}
4div#thankyou div#innner h2{margin:12px;font-size:18px;text-shadow: -1px -1px 0px #FFF;font-weight: bold;}
5div#thankyou div#innner p{margin:2px 4px;font-size:90%;}
6div#thankyou div#innner dl{margin:12px auto;padding:0;line-height: 1.4em;width:14em;}
7div#thankyou div#innner dl dt{width: 3em;font-weight: bold;color:#666;}
8div#thankyou div#innner dl dd{margin-left: 4em; margin-top:-1.4em;font-weight: bold;}
9</style>
10<?php
11/*
12 * This file is part of EC-CUBE
13 *
14 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
15 *
16 * http://www.lockon.co.jp/
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version 2
21 * of the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
31 *
32 * 2011-03-17 Tao Sasaki (tao@xross-cube.com)
33 *
34 */
35
36// {{{ requires
37if( !defined("CLASS_PATH") ){
38    require_once("../../require.php");
39}
40require_once(CLASS_PATH . "pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php");
41
42// }}}
43// {{{ generate page
44class LC_Page_FrontParts_Bloc_ThankYou extends LC_Page_FrontParts_Bloc {
45
46    // }}}
47    // {{{ functions
48
49    /**
50     * Page を初期化する.
51     *
52     * @return void
53     */
54    function init() {
55        parent::init();
56        $this->tpl_login = false;
57        $this->tpl_disable_logout = false;
58        $this->tpl_error = "";
59    }
60
61    /**
62     * Page のプロセス.
63     *
64     * @return void
65     */
66    function process() {
67        if(!file_exists(DATA_PATH.'downloads/donation_summary.csv')){
68            $objQuery = new SC_Query;
69            $ret = $objQuery->getOne("SELECT php_path FROM dtb_bloc WHERE php_path = 'frontparts/bloc/thank_you.php'");
70            if(!$ret){
71                $objQuery->query("INSERT INTO dtb_bloc (bloc_name,tpl_path,filename,create_date,update_date,php_path,del_flg)
72                 VALUES('東北地方太平洋沖地震ポイント寄付状況','','thank_you',NOW(),NOW(),'frontparts/bloc/thank_you.php',0)");
73                 if(!file_exists(DATA_PATH.'downloads/donation_summary.csv')){
74                     if($fp = fopen(DATA_PATH.'downloads/donation_summary.csv','a+')){
75                        fwrite($fp,'0,0,0');
76                        fclose($fp);
77                     }else{
78                        echo '<p>エラー:ポイントサマリーファイルを作成出来ませんでした。</p>';
79                        exit;
80                     }
81                 }
82            }
83        }
84       
85        //現在の寄付データ取得
86        $summary = file_get_contents(DATA_PATH.'downloads/donation_summary.csv');
87        $this->summary = explode(",",$summary);
88    }
89
90    /**
91     * デストラクタ.
92     *
93     * @return void
94     */
95    function destroy() {
96        parent::destroy();
97    }
98}
99
100$objPage = new LC_Page_FrontParts_Bloc_ThankYou();
101register_shutdown_function(array($objPage, "destroy"));
102$objPage->init();
103$objPage->process();
104
105?>
106<div id="thankyou">
107    <div id="innner">
108        <h2>現在のポイント寄付状況</h2>
109        <p>ご協力ありがとうございます。<br />現在、皆様からお寄せ頂いた東北地方太平洋沖地震へのポイント寄付は以下の通りです。</p>
110        <dl>
111            <dt>件数:</dt>
112            <dd><?php echo number_format($objPage->summary[0]); ?>件</dd>
113            <dt>合計:</dt>
114            <dd><?php echo number_format($objPage->summary[1]); ?>pt</dd>
115        </dl>
116    </div>
117</div>
118
Note: See TracBrowser for help on using the repository browser.