-Misc fixes

-Add all entries CSV
This commit is contained in:
Keith Solomon
2022-12-17 18:17:37 -06:00
parent 9fe9df26bd
commit 119b2ee28c
5 changed files with 194 additions and 57 deletions
+41 -33
View File
@@ -11,47 +11,55 @@ include('functions.php');
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Torn Vault Tracker</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="style.css?v=<?php echo filemtime('style.css'); ?>">
</head>
<body>
<h1>Torn Vault Tracker</h1>
<table>
<thead>
<td>User</td>
<td>Timestamp</td>
<td>Operation</td>
<td>Amount</td>
</thead>
<div class="grid">
<div class="gridLeft">
<h2>Transactions</h2>
<?php
// Sort the multidimensional array
usort($csv, "custom_sort");
<table>
<thead>
<td>User</td>
<td>Timestamp</td>
<td>Operation</td>
<td>Amount</td>
</thead>
// Define the custom sort function
function custom_sort($a, $b) {
return $a[1] > $b[1];
}
<?php
foreach ($csv as $entry) {
if ($entry[2] == 'Vault withdraw') {
$class = 'debit';
} else {
$class = 'credit';
}
foreach ($csv as $entry) {
echo '<tr>';
echo '<td>';
echo $entry[0];
echo '</td>';
echo '<td>';
echo date("d/m/Y", $entry[1]);
echo '</td>';
echo '<td>';
echo $entry[2];
echo '</td>';
echo '<td>';
echo formatMoney($entry[3]);
echo '</td>';
echo '</tr>';
}
?>
</table>
echo '<tr class="' . $class . '">';
echo '<td>';
echo $entry[0];
echo '</td>';
echo '<td>';
echo date("d/m/Y", $entry[1]);
echo '</td>';
echo '<td>';
echo $entry[2];
echo '</td>';
echo '<td>';
echo formatMoney($entry[3]);
echo '</td>';
echo '</tr>';
}
?>
</table>
</div>
<div class="gridRght">
<h2>Balances</h2>
</div>
</div>
</body>
</html>