forked from TheGamesDB/TheGamesDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tab_stats.php
315 lines (263 loc) · 13.7 KB
/
tab_stats.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
<div id="gameHead">
<h1 style="text-align: center;">Database Completion Overview</h1>
<?php
// Get Total Number Of Games
$totalGamesQuery = mysql_query("SELECT `id` from `games`");
$totalGamesCount = mysql_num_rows($totalGamesQuery);
// Get Number of Games Having Front Boxart
$frontBoxartQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE EXISTS (SELECT keyvalue FROM banners WHERE banners.keyvalue = games.id AND banners.filename LIKE '%front%') AND games.Platform = platforms.id ");
$frontBoxartCount = mysql_num_rows($frontBoxartQuery);
// Get Number of Games Having Rear Boxart
$rearBoxartQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE EXISTS (SELECT keyvalue FROM banners WHERE banners.keyvalue = games.id AND banners.filename LIKE '%back%') AND games.Platform = platforms.id ");
$rearBoxartCount = mysql_num_rows($rearBoxartQuery);
// Get Number of Games Having Fanart
$fanartQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE EXISTS (SELECT keyvalue FROM banners WHERE banners.keyvalue = games.id AND banners.keytype = 'fanart') AND games.Platform = platforms.id ");
$fanartCount = mysql_num_rows($fanartQuery);
// Get Number of Games Having ClearLOGOs
$clearLogoQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE EXISTS (SELECT keyvalue FROM banners WHERE banners.keyvalue = games.id AND banners.keytype = 'clearlogo') AND games.Platform = platforms.id ");
$clearLogoCount = mysql_num_rows($clearLogoQuery);
// Get Number of Games Having Banners
$bannersQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE EXISTS (SELECT keyvalue FROM banners WHERE banners.keyvalue = games.id AND banners.keytype = 'series') AND games.Platform = platforms.id ");
$bannersCount = mysql_num_rows($bannersQuery);
// Get Number of Games Having Screenshots
$screenshotsQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE EXISTS (SELECT keyvalue FROM banners WHERE banners.keyvalue = games.id AND banners.keytype = 'screenshot') AND games.Platform = platforms.id ");
$screenshotsCount = mysql_num_rows($screenshotsQuery);
// Get Number of Games Having Overviews
$overviewQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE games.Platform = platforms.id AND games.Overview IS NOT NULL ");
$overviewCount = mysql_num_rows($overviewQuery);
// Get Number of Games Having Genres
$genresQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE games.Platform = platforms.id AND games.Genre IS NOT NULL ");
$genresCount = mysql_num_rows($genresQuery);
// Get Number of Games Having Trailers
$trailersQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE (games.Youtube IS NOT NULL OR games.Youtube != '') AND games.Platform = platforms.id ");
$trailersCount = mysql_num_rows($trailersQuery);
// Get Number of Games Release Date
$releaseDateQuery = mysql_query(" SELECT games.id FROM games, platforms WHERE (games.ReleaseDate IS NOT NULL OR games.ReleaseDate != '') AND games.Platform = platforms.id ");
$releaseDateCount = mysql_num_rows($releaseDateQuery);
// Calculate Front Boxart Completeness Percentage
$ratioFrontBoxart = round(($frontBoxartCount / $totalGamesCount) * 100);
// Calculate Front Boxart Completeness Percentage
$ratioRearBoxart = round(($rearBoxartCount / $totalGamesCount) * 100);
// Calculate Front Boxart Completeness Percentage
$ratioFanart = round(($fanartCount / $totalGamesCount) * 100);
// Calculate ClearLOGOs Completeness Percentage
$ratioClearLogos = round(($clearLogoCount / $totalGamesCount) * 100);
// Calculate Banners Completeness Percentage
$ratioBanners = round(($bannersCount / $totalGamesCount) * 100);
// Calculate Screenshots Completeness Percentage
$ratioScreenshots = round(($screenshotsCount / $totalGamesCount) * 100);
// Calculate Overviews Completeness Percentage
$ratioOverview = round(($overviewCount / $totalGamesCount) * 100);
// Calculate Genres Completeness Percentage
$ratioGenres = round(($genresCount / $totalGamesCount) * 100);
// Calculate Trailers Completeness Percentage
$ratioTrailers = round(($trailersCount / $totalGamesCount) * 100);
// Calculate Release Date Completeness Percentage
$ratioReleaseDate = round(($releaseDateCount / $totalGamesCount) * 100);
?>
<div id="completionGauges">
<p style="text-align: center;">
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=overview" id="gaugeOverview" style="width: 230px; height: 184px; display: inline-block; text-decoration: none;"></a>
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=frontboxart" id="gaugeBoxartFront" style="width: 230px; height: 184px; display: inline-block; text-decoration: none;"></a>
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=fanart" id="gaugeFanart" style="width: 230px; height: 184px; display: inline-block; text-decoration: none;"></a>
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=releasedate" id="gaugeReleaseDate" style="width: 230px; height: 184px; display: inline-block; text-decoration: none;"></a>
</p>
<p style="text-align: center; font-size: 1.3em; color: #bdbdbd; margin: 0px; padding: 0px;"><span style="margin: 0px 50px;">↑</span><span style="margin: 0px 50px;">↑</span><span style="margin: 0px 50px;">↑</span><span style="margin: 0px 50px;">↑</span><span style="margin: 0px 50px;">↑</span></p>
<p style="text-align: center; font-size: 1.3em; color: #bdbdbd; margin: 0px; padding: 4px;">Click on a Gauge To See Some Random Items Requiring Infomation</p>
<p style="text-align: center; font-size: 1.3em; color: #bdbdbd; margin: 0px; padding: 0px;"><span style="margin: 0px 50px;">↓</span><span style="margin: 0px 50px;">↓</span><span style="margin: 0px 50px;">↓</span><span style="margin: 0px 50px;">↓</span><span style="margin: 0px 50px;">↓</span></p>
<p style="text-align: center;">
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=genres" id="gaugeGenres" style="width: 150px; height: 120px; display: inline-block; text-decoration: none;"></a>
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=rearboxart" id="gaugeBoxartRear" style="width: 150px; height: 120px; display: inline-block; text-decoration: none;"></a>
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=clearlogo" id="gaugeClearLogo" style="width: 150px; height: 120px; display: inline-block; text-decoration: none;"></a>
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=banner" id="gaugeBanner" style="width: 150px; height: 120px; display: inline-block; text-decoration: none;"></a>
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=screenshot" id="gaugeScreenshot" style="width: 150px; height: 120px; display: inline-block; text-decoration: none;"></a>
<a href="<?php echo $baseurl; ?>/missingitems/?itemtype=trailer" id="gaugeTrailer" style="width: 150px; height: 120px; display: inline-block; text-decoration: none;"></a>
</p>
<p style="text-align: center;">
</p>
<script type="text/javascript">
var gBoxartFront = new JustGage({
id: "gaugeBoxartFront",
value: <?php echo $ratioFrontBoxart; ?>,
min: 0,
max: 100,
title: "Games Front Boxart",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gBoxartRear = new JustGage({
id: "gaugeBoxartRear",
value: <?php echo $ratioRearBoxart; ?>,
min: 0,
max: 100,
title: "Games Rear Boxart",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gFanart = new JustGage({
id: "gaugeFanart",
value: <?php echo $ratioFanart; ?>,
min: 0,
max: 100,
title: "Games Fanart",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gClearLogo = new JustGage({
id: "gaugeClearLogo",
value: <?php echo $ratioClearLogos; ?>,
min: 0,
max: 100,
title: "Games ClearLOGOs",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gBanner = new JustGage({
id: "gaugeBanner",
value: <?php echo $ratioBanners; ?>,
min: 0,
max: 100,
title: "Games Banners",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gScreenshot = new JustGage({
id: "gaugeScreenshot",
value: <?php echo $ratioScreenshots; ?>,
min: 0,
max: 100,
title: "Games Screenshots",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gOverview = new JustGage({
id: "gaugeOverview",
value: <?php echo $ratioOverview; ?>,
min: 0,
max: 100,
title: "Games Overviews",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gGenres = new JustGage({
id: "gaugeGenres",
value: <?php echo $ratioGenres; ?>,
min: 0,
max: 100,
title: "Games Genres",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gTrailers = new JustGage({
id: "gaugeTrailer",
value: <?php echo $ratioTrailers; ?>,
min: 0,
max: 100,
title: "Games Trailers",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
var gReleaseDate = new JustGage({
id: "gaugeReleaseDate",
value: <?php echo $ratioReleaseDate; ?>,
min: 0,
max: 100,
title: "Games Release Date",
label: "% Complete",
titleFontColor: "#FFA500",
valueFontColor: "#cfcfcf",
startAnimationTime: 1800,
startAnimationType: "<>",
levelColors: [ "#EB1C1C", "#FFA500", "#00E300" ]
});
</script>
</div>
<hr />
<div class="links">
<!-- Start Admin Only Stats & Reports -->
<?php
if ($adminuserlevel == 'ADMINISTRATOR') {
?>
<div style="text-align: center;">
<h1>Admin Reports & Statistics</h1>
<p><a href="?tab=userlist">User List</a></p>
<p><a href="?tab=adminstats&statstype=missingplatform">Games Missing Platform Data</a></p>
<p><a href="?tab=adminstats&statstype=morefront">Games With 2 or More Front Boxart</a></p>
<p><a href="?tab=adminstats&statstype=multipleplatform">Games With Multiple Platforms</a></p>
<p><a href="?tab=adminstats&statstype=locked">Locked Games</a></p>
<p><a href="?tab=adminstats&statstype=newgametitles">New Games Titles</a></p>
</div>
<hr />
<?php
}
?>
<!-- End Admin Only Stats & Reports -->
<p> </p>
<h1 style="text-align: center;">Site Reports and Statistics</h1>
<div style="text-align: center;">
<p> </p>
<div style="width: 300px; float: left; margin-right: 30px; text-align: center;">
<h3>Most Recent</h3>
<p><a href="?tab=recentbanners&bannertype=boxart">50 Most Recent Boxart Images</a></p>
<p><a href="?tab=recentbanners&bannertype=fanart">20 Most Recent Fanart Images</a></p>
<p><a href="?tab=recentbanners&bannertype=clearlogo">50 Most Recent ClearLOGOs</a></p>
<p><a href="?tab=recentbanners&bannertype=series">50 Most Recent Game Banners</a></p>
</div>
<div style="width: 300px; float: left; text-align: center;">
<h3>Missing</h3>
<p><a href="?tab=adminstats&statstype=missingoverview">Games Missing Overview</a></p>
<p><a href="?tab=adminstats&statstype=missinggenre">Games Missing Genre Data</a></p>
<p><a href="?tab=adminstats&statstype=missingfront">Games Missing Front Boxart</a></p>
<p><a href="?tab=adminstats&statstype=missingback">Games Missing Back Boxart</a></p>
<p><a href="?tab=adminstats&statstype=missingfanart">Games Missing Fanart</a></p>
<p><a href="?tab=adminstats&statstype=missingbanner">Games Missing Banners</a></p>
<p><a href="?tab=adminstats&statstype=missingclearlogo">Games Missing ClearLogo's</a></p>
<p><a href="?tab=adminstats&statstype=missingscreenshot">Games Missing Screenshots</a></p>
<p><a href="?tab=adminstats&statstype=missingyoutube">Games Missing Youtube Trailers</a></p>
</div>
<div style="width: 300px; float: left; margin-right: 30px; text-align: center;">
<h3>Top Rated</h3>
<p><a href="?tab=adminstats&statstype=topratedgames">Top Rated Games</a></p>
<p><a href="?tab=adminstats&statstype=topratedfanart">Top Rated Fanart</a></p>
<p><a href="?tab=bannerartists">Top 50 Art Contributors</a></p>
</div>
<div style="clear: both;"></div>
</div>
</div>
</div>