-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanmeldungen.php
229 lines (219 loc) · 8.54 KB
/
anmeldungen.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
<?php
session_start();
require_once dirname(__FILE__) . "/config/config.php";
$loggedIn = false;
if(isset($_POST['password']) && password_verify($_POST['password'], OVERVIEW_HASH)){
$loggedIn = true;
// logged id
require_once dirname(__FILE__) . "/backend/guestdb.php";
require_once dirname(__FILE__) . "/backend/clandb.php";
require_once dirname(__FILE__) . "/backend/paymentdb.php";
$guestdb = new GuestDB();
$clandb = new ClanDB();
$paymentdb = new PaymentDB();
}
?>
<html lang="de">
<head>
<meta charset="utf-8">
<title><?php echo EVENT_NAME ?> - Übersicht</title>
<!-- FavIcon -->
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- Angular.js -->
<script src="scripts/angular.min.js"></script>
<script src="scripts/angular-animate.min.js"></script>
</head>
<body id="page-top" class="container">
<h1><?php echo EVENT_NAME ?> Übersicht</h1>
<?php
if(!$loggedIn) {
?>
<form action="anmeldungen.php" class="form-inline" method="post" name="login">
<input class="form-control" type="password" placeholder="Password" name="password">
<button type="submit" class="btn btn-primary" ><span class="fa fa-user-secret"></span> Anmelden</button>
</form>
<?php
} else {
?>
<div ng-app="overviewApp" ng-controller="overviewCtrl">
<h2>Gäste <span class="badge">{{guests.length}}</span></h2>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>Nachname</th>
<th>Vorname</th>
<th>E-Mail</th>
<th>Geburtstag</th>
<th>Bezahldatum</th>
<th>Clan</th>
<th>PayPalToken</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="guest in guests">
<td>{{guest.Lastname}}</td>
<td>{{guest.Firstname}}</td>
<td>{{guest.Mail}}</td>
<td>{{guest.Birthday}}</td>
<td>{{getPayDate(guest.PayPalToken)}}</td>
<td>{{getClan(guest.ClanID)}}</td>
<td>{{guest.PayPalToken}}</td>
</tr>
</tbody>
</table>
<h2>Clans <span class="badge">{{clans.length}}</span></h2>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Erstelldatum</th>
<th>Mitglieder</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="clan in clans">
<td>{{clan.name}}</td>
<td>{{clan.creationtime}}</td>
<td>{{getClanMember(clan.id)}}</td>
</tr>
</tbody>
</table>
<h2>Bezahlvorgänge <span class="badge">{{payments.length}}</span></h2>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>PayPalToken</th>
<th>Clan</th>
<th>Erstelldatum</th>
<th>Bezahldatum</th>
<th>Personen</th>
<th>Bezahldetails</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="payment in payments" ng-click="showPayment($index)">
<td>{{payment.Token}}</td>
<td>{{getClan(payment.ClanID)}}</td>
<td>{{payment.CreationTime}}</td>
<td>{{payment.SuccessTime}}</td>
<td><span title="{{payment.Persons}}">{{shorten(payment.Persons)}}</span></td>
<td><span title="{{payment.SuccessPayment}}">{{shorten(payment.SuccessPayment)}}</span></td>
</tr>
</tbody>
</table>
<h3>Bezahlvorgang im Detail:</h3>
<div class="row">
<div class="col-xs-6 col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong class="panel-title">Token</strong></div>
<div class="panel-body">{{payments[paymentDetail].Token}}</div>
</div>
</div>
<div class="col-xs-6 col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong class="panel-title">Clan</strong></div>
<div class="panel-body">{{getClan(payments[paymentDetail].ClanID)}}</div>
</div>
</div>
<div class="col-xs-6 col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong class="panel-title">Erstelldatum</strong></div>
<div class="panel-body">{{payments[paymentDetail].CreationTime}}</div>
</div>
</div>
<div class="col-xs-6 col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><strong class="panel-title">Bezahldatum</strong></div>
<div class="panel-body">{{payments[paymentDetail].SuccessTime}}</div>
</div>
</div>
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-heading"><strong class="panel-title">Personen</strong></div>
<div class="panel-body">{{payments[paymentDetail].Persons}}</div>
</div>
</div>
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-heading"><strong class="panel-title">Bezahldetails</strong></div>
<div class="panel-body">{{payments[paymentDetail].SuccessPayment}}</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<!-- jQuery -->
<script src="scripts/jquery-2.2.1.min.js"></script>
<!-- Bootstrap Core Javascript -->
<script src="scripts/bootstrap.min.js"></script>
<!-- UI Bootstrap -->
<script src="scripts/ui-bootstrap-custom-1.3.2.js"></script>
<script src="scripts/ui-bootstrap-custom-tpls-1.3.2.js"></script>
<?php
if($loggedIn) {
?>
<!-- Custom JavaScript -->
<script>
var overviewApp = angular.module('overviewApp', []);
overviewApp.controller('overviewCtrl', ['$scope', function($scope) {
$scope.password = '213';
$scope.guests = <?php echo json_encode($guestdb->listGuests()); ?>;
$scope.clans = <?php echo json_encode($clandb->listClans()); ?>;
$scope.payments = <?php echo json_encode($paymentdb->listPayments()); ?>;
$scope.paymentDetail = 0;
$scope.shorten = function(input) {
if(input == null) {
return " ";
}
str = input.toString();
if(str.length > 30) {
return str.substr(0, 30);
}
return input
}
$scope.getClan = function(ClanID) {
if(ClanID == null) {
return "kein Clan";
}
for(var i=0; i<$scope.clans.length; i++) {
if($scope.clans[i].id == ClanID) {
return $scope.clans[i].name;
}
}
}
$scope.getPayDate = function(Token) {
if(!Token.startsWith('EC')) {
return '--';
}
for(var i=0; i<$scope.payments.length; i++) {
if($scope.payments[i].Token == Token) {
return $scope.payments[i].SuccessTime;
}
}
return '??';
}
$scope.getClanMember = function(ClanID) {
var cnt = 0;
for(var i=0; i<$scope.guests.length; i++) {
if($scope.guests[i].ClanID == ClanID) {
cnt++;
}
}
return cnt;
}
$scope.showPayment = function(index) {
$scope.paymentDetail = index;
}
}]);
</script>
<?php
}
?>
</body>
</html>