-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-ds-corona-anwesende.php
114 lines (85 loc) · 2.52 KB
/
page-ds-corona-anwesende.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
<html>
<head>
<style>
body {
background-color: black;
overflow: hidden;
color: #FFF;
}
.background {
background-image: url(<?php echo get_template_directory_uri() ?>/images/_ds-ms-clear.png);
background-size: contain;
background-repeat: no-repeat;
background-position-y: center;
width: 100vw;
height: 100vh;
}
.content {
position: absolute;
bottom: 200px;
left: 120px;
font-size: 100px;
line-height: 120px;
}
</style>
</head>
<body>
<?php
global $wpdb;
$from = (get_datetime()->setTime(0, 0, 0));
$to = (get_datetime()->setTime(23, 59, 59));
$logged_in_sql = "
SELECT count(*) as count FROM (
SELECT
mpl_user_id,
MOD(COUNT(mpl_user_id), 2) as log_count,
MIN(mpl_datetime) as arrived_at,
MAX(mpl_datetime) as leaved_at
FROM `makerspace_presence_logs`
WHERE
mpl_datetime between %s AND %s AND mpl_temp_visitor_id IS NULL
GROUP BY mpl_user_id
) as tmp
WHERE log_count > 0
";
$logged_in_count = $wpdb->get_var($wpdb->prepare(
$logged_in_sql,
$from->format("Y-m-d H:i:s"),
$to->format("Y-m-d H:i:s")
));
$logged_in_sql = "
SELECT count(*) as count FROM (
SELECT
mpl_temp_visitor_id,
MOD(COUNT(mpl_temp_visitor_id), 2) as log_count,
MIN(mpl_datetime) as arrived_at,
MAX(mpl_datetime) as leaved_at
FROM `makerspace_presence_logs`
WHERE
mpl_datetime between %s AND %s AND mpl_temp_visitor_id IS NOT NULL
GROUP BY mpl_temp_visitor_id
) as tmp
WHERE log_count > 0
";
$logged_in_count += $wpdb->get_var($wpdb->prepare(
$logged_in_sql,
$from->format("Y-m-d H:i:s"),
$to->format("Y-m-d H:i:s")
));
?>
<div class="background">
</div>
<div class="content">
<div class="">
Aktuell befinden sich
</div>
<div class="" style="font-size: 150px; line-height: 200px;">
<span><?php echo $logged_in_count ?></span>
<span>Personen</span>
</div>
<div class="">
im Maker Space
</div>
</div>
</body>
</html>