This repository was archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
340 lines (331 loc) · 17.3 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<?php
require __DIR__ . '/Common/init_page.php';
include_once __DIR__ . '/Common/head.php';
$bulletin_boards = array();
$query = "SELECT bulletin_board_contents.bulletin_board_id, bulletin_board_contents.datetime, bulletin_boards.title, bulletin_boards.status, CONCAT(profiles.grade, profiles.part, ' ', profiles.last_name, profiles.first_name) as name, (SELECT COUNT(*) FROM bulletin_board_views WHERE bulletin_board_id=bulletin_boards.bulletin_board_id) AS views, (SELECT COUNT(*) FROM bulletin_board_views WHERE bulletin_board_id=bulletin_boards.bulletin_board_id AND user_id=$USER->id) AS user_views, hashtags FROM bulletin_board_contents INNER JOIN (SELECT bulletin_board_id, MAX(datetime) as datetime FROM bulletin_board_contents GROUP BY bulletin_board_id) AS T1 ON T1.bulletin_board_id=bulletin_board_contents.bulletin_board_id AND T1.datetime=bulletin_board_contents.datetime INNER JOIN bulletin_boards ON bulletin_board_contents.bulletin_board_id=bulletin_boards.bulletin_board_id INNER JOIN profiles ON bulletin_boards.user_id=profiles.user_id LEFT OUTER JOIN (SELECT bulletin_board_id, GROUP_CONCAT(hashtag SEPARATOR ' ') AS hashtags FROM bulletin_board_hashtags GROUP BY bulletin_board_id) AS bulletin_board_hastags ON bulletin_board_hastags.bulletin_board_id=bulletin_boards.bulletin_board_id WHERE bulletin_boards.status='RELEASE' ORDER BY bulletin_board_contents.datetime DESC LIMIT 5";
$result = $mysqli->query($query);
if (!$result) {
print('Query Failed : ' . $mysqli->error);
$mysqli->close();
exit();
}
while ($row = $result->fetch_assoc()) {
$bulletin_board = array();
$bulletin_board = $row;
$bulletin_board['datetime'] = date('Y/m/d H:i', strtotime($bulletin_board['datetime']));
$bulletin_board['hashtags'] = explode(" ", $bulletin_board['hashtags']);
if (isset($_GET['hashtag']) && !in_array($_GET['hashtag'], $bulletin_board['hashtags'])) continue;
array_push($bulletin_boards, $bulletin_board);
}
?>
<div class="d-none d-md-block">
<div class="container-fluid">
<div class="row">
<?php
if (isset($_SESSION['mypage_edit_profile'])) {
echo '<div class="col-sm-12">';
echo '<div class="alert alert-info alert-dismissible fade show" role="alert">';
echo 'プロフィールを編集しました。';
echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
echo '</div>';
echo '</div>';
unset($_SESSION['mypage_edit_profile']);
}
if (isset($_SESSION['mypage_password_success'])) {
echo '<div class="col-sm-12">';
echo '<div class="alert alert-info alert-dismissible fade show" role="alert">';
echo 'パスワードを更新しました。';
echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
echo '</div>';
echo '</div>';
unset($_SESSION['mypage_password_success']);
}
?>
<div class="col-xl-3 col-sm-6 mb-3">
<div class="card border-left-primary shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-primary mb-1">個別会計総額</div>
<div class="h5 mb-0 font-weight-bold text-gray-800"><?= $USER->get_individual_accounting_total() ?></div>
</div>
<div class="col-auto">
<i class="fas fa-wallet fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-sm-6 mb-3">
<div class="card border-left-danger shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-danger mb-1">滞納額</div>
<div class="h5 mb-0 font-weight-bold text-gray-800"><?= $USER->get_delinquent() ?></div>
</div>
<div class="col-auto">
<i class="fas fa-yen-sign fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<!--
<div class="col-xl-4 col-sm-6">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">新着記事</h6>
</div>
<div class="card-body p-0">
<div class="list-group list-group-flush">
<?php
$border_top_0 = 'style="border-top: 0;"';
foreach ($bulletin_boards as $bulletin_board) {
$bulletin_board_id = $bulletin_board['bulletin_board_id'];
$title = $bulletin_board['title'];
$name = $bulletin_board['name'];
$datetime = $bulletin_board['datetime'];
$hashtags = $bulletin_board['hashtags'];
$views = $bulletin_board['views'];
$user_views = $bulletin_board['user_views'];
if ($user_views > 0) {
$unread = "";
} else {
$unread = "unread";
}
?>
<a href="./bulletin_board/view/?bulletin_board_id=<?= $bulletin_board_id ?>" class="list-group-item list-group-item-action pt-1 <?= $unread ?>" <?= $border_top_0 ?>>
<div class="text-right mb-2">
<small>
<span class="mr-2 text-nowrap"><i class="fas fa-user mr-1"></i><?= h($name) ?></span>
<span class="text-nowrap"><?= $datetime ?></span>
</small>
</div>
<h5 class="mb-0 text-truncate"><?= h($title) ?></h5>
</a>
<?php
$border_top_0 = '';
}
?>
<a class="list-group-item list-group-item-action text-primary mb-1 text-right" href="./bulletin_board/" style="border-bottom: 0;">記事一覧<i class="fas fa-chevron-right ml-2"></i></a>
</div>
</div>
</div>
</div>
-->
<!-- <div class="col-xl-4 col-sm-6">
<?php
// $query = "SELECT * FROM accounting_records WHERE user_id='$USER->id'";
// $result = $mysqli->query($query);
// if (!$result) {
// print('Query Failed : ' . $mysqli->error);
// $mysqli->close();
// exit();
// }
// $unpaid = 0;
// $paid = 0;
// while ($row = $result->fetch_assoc()) {
// $price = $row['price'];
// $datetime = $row['datetime'];
// if ($datetime == null) {
// $unpaid += $price;
// } else {
// $paid += $price;
// }
// }
?>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">集金記録</h6>
</div>
<div class="card-body">
<div class="chart-pie pt-4">
<div class="chartjs-size-monitor">
<div class="chartjs-size-monitor-expand">
<div class=""></div>
</div>
<div class="chartjs-size-monitor-shrink">
<div class=""></div>
</div>
</div>
<canvas id="myPieChart" width="516" height="506" class="chartjs-render-monitor" style="display: block; height: 253px; width: 258px;"></canvas>
</div>
<div class="mt-4 text-center small">
<span class="mr-2">
<i class="fas fa-circle text-primary"></i> 既納 ¥ <?= number_format($paid) ?>
</span>
<br>
<span class="mr-2">
<i class="fas fa-circle text-danger"></i> 未納 ¥ <?= number_format($unpaid) ?>
</span>
</div>
</div>
</div>
</div> -->
<div class="col-xl-4 col-sm-6">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">開発者募集中</h6>
</div>
<div class="card-body">
<p>
マイページの開発に協力してくれる方を募集しています。<br>Web管理人以外でも大丈夫です。
</p>
<a href="https://github.com/nozomu-y/kleines-mypage" target="_blank"><img class="img-fluid" src="https://gh-card.dev/repos/nozomu-y/kleines-mypage.svg?fullname="></a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="d-block d-md-none">
<div class="container-fluid">
<div class="row">
<?php
if (isset($_SESSION['mypage_edit_profile'])) {
echo '<div class="col-sm-12">';
echo '<div class="alert alert-info alert-dismissible fade show" role="alert">';
echo 'プロフィールを編集しました。';
echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
echo '</div>';
echo '</div>';
unset($_SESSION['mypage_edit_profile']);
}
if (isset($_SESSION['mypage_password_success'])) {
echo '<div class="col-sm-12">';
echo '<div class="alert alert-info alert-dismissible fade show" role="alert">';
echo 'パスワードを更新しました。';
echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>';
echo '</div>';
echo '</div>';
unset($_SESSION['mypage_password_success']);
}
?>
<div class="col-xl-3 col-sm-6 mb-3">
<div class="card border-left-primary shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-primary mb-1">個別会計総額</div>
<div class="h5 mb-0 font-weight-bold text-gray-800"><?= $USER->get_individual_accounting_total() ?></div>
</div>
<div class="col-auto">
<i class="fas fa-wallet fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-sm-6 mb-3">
<div class="card border-left-danger shadow h-100 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-danger mb-1">滞納額</div>
<div class="h5 mb-0 font-weight-bold text-gray-800"><?= $USER->get_delinquent() ?></div>
</div>
<div class="col-auto">
<i class="fas fa-yen-sign fa-2x text-gray-300"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--
<div class="card card-flush shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">新着記事</h6>
</div>
<div class="card-body p-0">
<div class="list-group list-group-flush">
<?php
$bulletin_count = 0;
$border_top_0 = 'style="border-top: 0;"';
foreach ($bulletin_boards as $bulletin_board) {
if ($bulletin_count == 3) break;
$bulletin_board_id = $bulletin_board['bulletin_board_id'];
$title = $bulletin_board['title'];
$name = $bulletin_board['name'];
$datetime = $bulletin_board['datetime'];
$hashtags = $bulletin_board['hashtags'];
$views = $bulletin_board['views'];
$user_views = $bulletin_board['user_views'];
if ($user_views > 0) {
$unread = "";
} else {
$unread = "unread";
}
$bulletin_count++;
?>
<a href="./bulletin_board/view/?bulletin_board_id=<?= $bulletin_board_id ?>" class="list-group-item list-group-item-action pt-1 <?= $unread ?>" <?= $border_top_0 ?>>
<div class="text-right mb-2">
<small>
<span class="mr-2 text-nowrap"><i class="fas fa-user mr-1"></i><?= h($name) ?></span>
<span class="text-nowrap"><?= $datetime ?></span>
</small>
</div>
<h6 class="mb-0 text-truncate"><?= h($title) ?></h6>
</a>
<?php
$border_top_0 = '';
}
?>
<a class="list-group-item list-group-item-action text-primary text-right" href="./bulletin_board/" style="border-bottom: 0;">記事一覧<i class="fas fa-chevron-right ml-2"></i></a>
</div>
</div>
</div>
-->
<div class="card card-flush shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">開発者募集中</h6>
</div>
<div class="card-body">
<p>
マイページの開発に協力してくれる方を募集しています。<br>Web管理人以外でも大丈夫です。
</p>
<a href="https://github.com/nozomu-y/kleines-mypage" target="_blank"><img class="img-fluid" src="https://gh-card.dev/repos/nozomu-y/kleines-mypage.svg?fullname="></a>
</div>
</div>
</div>
<?php
// $script = '<script>';
// $script .= 'Chart.defaults.global.defaultFontFamily = "Noto Sans JP", \'sans-serif\';Chart.defaults.global.defaultFontColor = \'#858796\';';
// $script .= 'var ctx = document.getElementById("myPieChart");';
// $script .= 'var myPieChart = new Chart(ctx, {
// type: \'doughnut\',
// data: {
// labels: ["既納", "未納"],
// datasets: [{
// data: [' . $paid . ', ' . $unpaid . '],
// backgroundColor: [\'#4e73df\', \'#e74a3b\'],
// hoverBackgroundColor: [\'#4e73df\', \'#e74a3b\'],
// hoverBorderColor: "rgba(234, 236, 244, 1)",
// }],
// },
// options: {
// maintainAspectRatio: false,
// tooltips: {
// backgroundColor: "rgb(255,255,255)",
// bodyFontColor: "#858796",
// borderColor: \'#dddfeb\',
// borderWidth: 1,
// xPadding: 15,
// yPadding: 15,
// displayColors: false,
// caretPadding: 10,
// },
// legend: {
// display: false
// },
// cutoutPercentage: 80,
// },
// });';
// $script .= '</script>';
?>
<?php
include_once __DIR__ . '/Common/foot.php';