Skip to content

Commit

Permalink
Making sure traffic table names are displayed in right order
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermarston committed Nov 18, 2016
1 parent ee39a8d commit 3db2ce0
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,74 +202,74 @@ function drawMonthlyChart() {

<div id="tabNav" class="container">
<ul class="nav nav-tabs">
<li class="active"><a href="#daily" data-toggle="tab">Daily</a></li>
<li><a href="#hourly" data-toggle="tab">Hourly</a></li>
<li class="active"><a href="#hourly" data-toggle="tab">Hourly</a></li>
<li><a href="#daily" data-toggle="tab">Daily</a></li>
<li><a href="#monthly" data-toggle="tab">Monthly</a></li>
<li><a href="#top10" data-toggle="tab">Top 10</a></li>
</ul>

<div class="tab-content">
<div class="tab-pane active" id="daily">
<div class="tab-pane" id="hourly">
<table class="table table-bordered">
<thead>
<tr>
<th>Day</th>
<th>Hour</th>
<th>Received</th>
<th>Sent</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php
$daily = get_vnstat_data($vnstat_bin_dir, "daily", $thisInterface);
$hourly = get_vnstat_data($vnstat_bin_dir, "hourly", $thisInterface);

for ($i = 0; $i < count($daily); $i++) {
if ($daily[$i]['act'] == 1) {
$day = $daily[$i]['label'];
$totalReceived = $daily[$i]['rx'];
$totalSent = $daily[$i]['tx'];
$totalTraffic = $daily[$i]['total'];
?>
<tr>
<td><?php echo $day; ?></td>
<td><?php echo $totalReceived; ?></td>
<td><?php echo $totalSent; ?></td>
<td><?php echo $totalTraffic; ?></td>
</tr>
for ($i = 0; $i < count($hourly); $i++) {
$hour = $hourly[$i]['label'];
$totalReceived = $hourly[$i]['rx'];
$totalSent = $hourly[$i]['tx'];
$totalTraffic = $hourly[$i]['total'];
?>
<tr>
<td><?php echo $hour; ?></td>
<td><?php echo $totalReceived; ?></td>
<td><?php echo $totalSent; ?></td>
<td><?php echo $totalTraffic; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<div class="tab-pane" id="hourly">
<div class="tab-pane active" id="daily">
<table class="table table-bordered">
<thead>
<tr>
<th>Hour</th>
<th>Day</th>
<th>Received</th>
<th>Sent</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php
$hourly = get_vnstat_data($vnstat_bin_dir, "hourly", $thisInterface);
$daily = get_vnstat_data($vnstat_bin_dir, "daily", $thisInterface);

for ($i = 0; $i < count($hourly); $i++) {
$hour = $hourly[$i]['label'];
$totalReceived = $hourly[$i]['rx'];
$totalSent = $hourly[$i]['tx'];
$totalTraffic = $hourly[$i]['total'];
?>
<tr>
<td><?php echo $hour; ?></td>
<td><?php echo $totalReceived; ?></td>
<td><?php echo $totalSent; ?></td>
<td><?php echo $totalTraffic; ?></td>
</tr>
for ($i = 0; $i < count($daily); $i++) {
if ($daily[$i]['act'] == 1) {
$day = $daily[$i]['label'];
$totalReceived = $daily[$i]['rx'];
$totalSent = $daily[$i]['tx'];
$totalTraffic = $daily[$i]['total'];
?>
<tr>
<td><?php echo $day; ?></td>
<td><?php echo $totalReceived; ?></td>
<td><?php echo $totalSent; ?></td>
<td><?php echo $totalTraffic; ?></td>
</tr>
<?php
}
}
?>
</tbody>
Expand Down

0 comments on commit 3db2ce0

Please sign in to comment.