table per player
This commit is contained in:
parent
af434e8f01
commit
496db0559b
1 changed files with 26 additions and 15 deletions
|
|
@ -59,7 +59,7 @@ $lastMatches = array_slice($allMatches, 0, 8);
|
||||||
if (isset($_GET['matchid'])) {
|
if (isset($_GET['matchid'])) {
|
||||||
$matchId = $_GET['matchid'];
|
$matchId = $_GET['matchid'];
|
||||||
$filename = "data/matches/" . $matchId . ".json";
|
$filename = "data/matches/" . $matchId . ".json";
|
||||||
|
|
||||||
|
|
||||||
// Check if the JSON file for the given match ID exists
|
// Check if the JSON file for the given match ID exists
|
||||||
if (file_exists($filename)) {
|
if (file_exists($filename)) {
|
||||||
|
|
@ -67,20 +67,7 @@ $lastMatches = array_slice($allMatches, 0, 8);
|
||||||
$jsonData = json_decode(file_get_contents($filename), true);
|
$jsonData = json_decode(file_get_contents($filename), true);
|
||||||
$matchinfo = $jsonData['data']['attributes'];
|
$matchinfo = $jsonData['data']['attributes'];
|
||||||
$matchdata = $jsonData['data'];
|
$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 "<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>";
|
echo "<tr>";
|
||||||
|
|
@ -94,6 +81,31 @@ $lastMatches = array_slice($allMatches, 0, 8);
|
||||||
echo "</table>";
|
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 "<table class='sortable'>";
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<th>Player Name</th>
|
<th>Player Name</th>
|
||||||
|
|
@ -107,7 +119,6 @@ $lastMatches = array_slice($allMatches, 0, 8);
|
||||||
<th>Headshot Kills</th>
|
<th>Headshot Kills</th>
|
||||||
<th>Assists</th>
|
<th>Assists</th>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
foreach ($jsonData['included'] as $includedItem) {
|
foreach ($jsonData['included'] as $includedItem) {
|
||||||
if ($includedItem['type'] == "participant") {
|
if ($includedItem['type'] == "participant") {
|
||||||
$playerStats = $includedItem['attributes']['stats'];
|
$playerStats = $includedItem['attributes']['stats'];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue