table per player

This commit is contained in:
Lanta 2023-11-15 15:45:50 +01:00
parent af434e8f01
commit 496db0559b

View file

@ -68,19 +68,6 @@ $lastMatches = array_slice($allMatches, 0, 8);
$matchinfo = $jsonData['data']['attributes'];
$matchdata = $jsonData['data'];
$directory = 'data/killstats/';
$prefix = $matchdata['id'];
$files = glob($directory . $prefix . '*');
foreach ($files as $file) {
echo $file . "\n";
}
foreach($files as $file){
$jsonData_individual_player = json_decode(file_get_contents($file), true);
echo $jsonData_individual_player['stats']['humankills'];
echo $jsonData_individual_player['stats']['kills'];
}
echo "<table class='sortable'><tr><th>matchType</th><th>gameMode</th><th>duration</th><th>mapName</th><th>createdAt</th><th>id</th></tr>";
echo "<tr>";
@ -94,6 +81,31 @@ $lastMatches = array_slice($allMatches, 0, 8);
echo "</table>";
echo "<table class='sortable'>";
echo "<tr>
<th>Player Name</th>
<th>Kills</th>
<th>humankills</th>
</tr>";
$directory = 'data/killstats/';
$prefix = $matchdata['id'];
$files = glob($directory . $prefix . '*');
foreach ($files as $file) {
$jsonData_individual_player = json_decode(file_get_contents($file), true);
echo "<tr>";
echo "<td>" . htmlspecialchars($jsonData_individual_player['stats']['playername']) . "</td>";
echo "<td>" . htmlspecialchars($jsonData_individual_player['stats']['humankills']) . "</td>";
echo "<td>" . htmlspecialchars($jsonData_individual_player['stats']['kills']) . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<table class='sortable'>";
echo "<tr>
<th>Player Name</th>
@ -107,7 +119,6 @@ $lastMatches = array_slice($allMatches, 0, 8);
<th>Headshot Kills</th>
<th>Assists</th>
</tr>";
foreach ($jsonData['included'] as $includedItem) {
if ($includedItem['type'] == "participant") {
$playerStats = $includedItem['attributes']['stats'];