-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatestmatches.php
More file actions
100 lines (78 loc) · 4.6 KB
/
latestmatches.php
File metadata and controls
100 lines (78 loc) · 4.6 KB
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
<?php
$ogDescription = "Dive into the detailed match stats of DTCH Clan in PUBG. Explore recent matches, various game modes, and match types. View individual performance metrics like kills, damage dealt, and survival time for each clan member. Stay updated with the latest match stats and follow the clan's journey in PUBG.";
?>
<!DOCTYPE html>
<html lang="en">
<?php include './includes/head.php'; ?>
<body>
<?php
include './includes/navigation.php';
include './includes/header.php';
?>
<main>
<section>
<h2>Match Stats</h2>
<?php
include './config/config.php';
$players_matches = json_decode(file_get_contents('./data/cached_matches.json'), true);
$players = json_decode(file_get_contents('./config/clanmembers.json'), true);
// Display buttons for each player
echo "<form method='get' action=''>";
foreach ($players['clanMembers'] as $player) {
echo "<button type='submit' name='selected_player' value='$player' class='btn'>$player</button>";
}
echo "</form><br>";
$selected_player = $_GET['selected_player'] ?? $players['clanMembers'][0];
echo "<form method='get' action=''>
<input type='submit' name='filter_by_match_type' value='all' class='btn'>
<input type='submit' name='filter_by_match_type' value='airoyale' class='btn'>
<input type='submit' name='filter_by_match_type' value='official' class='btn'>
<input type='submit' name='filter_by_match_type' value='custom' class='btn'>
<input type='submit' name='filter_by_match_type' value='event' class='btn'>
<input type='submit' name='filter_by_match_type' value='competitive' class='btn'>
<input type='hidden' name='selected_player' value='$selected_player'>
</form><br>";
include './includes/mapsmap.php';
// Display the player's match stats
echo "<h2>Recent Matches for $selected_player</h2>";
echo "<table border='1' class='sortable'>";
echo "<tr><th>Match Date</th><th>Game Mode</th><th>Match Type</th><th>Map</th><th>Kills</th><th>Damage Dealt</th><th>Time Survived</th><th>win Place</th></tr>";
foreach ($players_matches as $match) {
// print_r($match['stats']);
foreach ($match['stats'] as $stats) {
if ($stats['name'] === $selected_player) {
if (isset($_GET['filter_by_match_type'])) {
if ($_GET['filter_by_match_type'] !== 'all' && $match['matchType'] !== $_GET['filter_by_match_type']) {
continue;
}
}
$date = new DateTime($match['createdAt']);
$date->modify('+1 hours');
$formattedDate = $date->format('m-d H:i:s');
$matchType = $match['matchType'];
$gameMode = $match['gameMode'];
$mapName = isset($mapNames[$match['mapName']]) ? $mapNames[$match['mapName']] : $match['mapName'];
$kills = $stats['kills'];
$damage = number_format($stats['damageDealt'], 0, '.', '');
$timeSurvived = $stats['timeSurvived'];
$winPlace = $stats['winPlace'];
echo "<tr>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $formattedDate . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $gameMode . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $matchType . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $mapName . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $kills . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $damage . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $timeSurvived . "</a></td>
<td><a href='matchinfo.php?matchid=" . $match['id'] . "'>" . $winPlace . "</a></td>
</tr>";
}
}
}
echo "</table><br>";
?>
</section>
</main>
<?php include './includes/footer.php'; ?>
</body>
</html>