source: branches/eccube-donation/html/frontparts/bloc/index.php @ 20622

Revision 20622, 3.4 KB checked in by tao, 13 years ago (diff)

現状をコミット

  • Property svn:executable set to *
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// html/admin/require.php を require
25if( !defined("CLASS_PATH") ){
26    require_once("../../admin/require.php");
27}
28
29
30// 管理画面認証
31SC_Utils_Ex::sfIsSuccess(new SC_Session());
32
33// 定数
34define('DONATION_TITLE', 'EC-CUBE Donation');
35define('DONATION_DATA', DATA_PATH . 'downloads/donation.csv');
36define('DONATION_VERSION', '0.0.1');
37
38$objQuery = new SC_Query();
39// 全顧客取得
40$arrCustomerTemp = $objQuery->getAll('SELECT customer_id, name01, name02, point FROM dtb_customer WHERE del_flg = 0');
41
42// ポイント合計
43$arrPoints = $objQuery->getAll('SELECT SUM(point) FROM dtb_customer WHERE del_flg = 0');
44$total_point = 0;
45if (!is_null($arrPoints[0])) {
46    $total_point = $total_point[0];
47
48}
49// 顧客IDごとの配列
50$arrCustomers = array();
51
52foreach ($arrCustomerTemp as $customer) {
53    $arrCustomers[$customer['customer_id']] = $customer;
54}
55
56// 寄付一覧
57$arrDnTemp = file(DONATION_DATA);
58$arrDonations = array();
59$correct_point = 0;
60foreach ($arrDnTemp as $dn) {
61    $arrDn = explode(",", $dn);
62    $arrDonations[] = $arrDn;
63    $correct_point += $arrDn[2];
64}
65
66?>
67<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
68<head>
69<title><?php echo DONATION_TITLE; ?> <?php echo DONATION_VERSION; ?></title>
70<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHAR_CODE; ?>" />
71<meta http-equiv="content-script-type" content="text/javascript" />
72<meta http-equiv="content-style-type" content="text/css" />
73<meta name="robots" content="noindex,nofollow" />
74<link rel="stylesheet" href="./dn.css" type="text/css" media="all" />
75</head>
76<body>
77<div id="container">
78<div id="contents">
79<h1><?php echo DONATION_TITLE; ?></h1>
80<h2>現在のステータス</h2>
81<table>
82  <tr>
83    <th>集まったポイント</th><td><?php printf('%d', $correct_point); ?>pt</td>
84  </tr>
85  <tr>
86    <th>義援金総額</th><td><?php printf('%d', $correct_point * POINT_VALUE); ?>円</td>
87  </tr>
88  <tr>
89    <th>顧客の保持ポイント合計</th><td><?php printf('%d', $total_point); ?>pt</td>
90  </tr>
91</table>
92
93<p>集まった義援金総額を, 義援金として日本赤十字社などにお贈り下さい</p>
94
95<h2>寄付いただいた顧客一覧</h2>
96<table>
97  <tr>
98    <th>寄付日時</th><th>顧客ID</th><th>お名前</th><th>寄付ポイント</th>
99  </tr>
100  <?php foreach ($arrDonations as $donation) { ?>
101  <tr>
102    <td><?php echo $donation[0]; ?></td>
103    <td><?php echo $donation[1]; ?></td>
104    <td><?php echo $arrCustomers[$donation[1]]['name01']; ?> <?php echo $arrCustomers[$donation[1]]['name02']; ?></td>
105    <td><?php echo $donation[2]; ?>pt</td>
106  </tr>
107  <?php } ?>
108</table>
109</div>
110</div>
111</body>
112</html>
Note: See TracBrowser for help on using the repository browser.