function write_data_table($caption, $tab) { print "<table width=\"100%\" cellspacing=\"0\">\n"; print "<caption>{$caption}</caption>\n"; print "<tr>"; print "<th class=\"label\" style=\"width:120px;\"> </th>"; print "<th class=\"label\">" . T('In') . "</th>"; print "<th class=\"label\">" . T('Out') . "</th>"; print "<th class=\"label\">" . T('Total') . "</th>"; print "</tr>\n"; for ($i = 0; $i < count($tab); $i++) { if ($tab[$i]['act'] == 1) { $t = $tab[$i]['label']; $rx = kbytes_to_string($tab[$i]['rx']); $tx = kbytes_to_string($tab[$i]['tx']); $total = kbytes_to_string($tab[$i]['rx'] + $tab[$i]['tx']); $id = $i & 1 ? 'odd' : 'even'; print "<tr>"; print "<td class=\"label_{$id}\">{$t}</td>"; print "<td class=\"numeric_{$id}\">{$rx}</td>"; print "<td class=\"numeric_{$id}\">{$tx}</td>"; print "<td class=\"numeric_{$id}\">{$total}</td>"; print "</tr>\n"; } } print "</table>\n"; }
function write_data_table_t($caption, $tab) { print "<table class=\"table table-hover table-default nomargin\" width=\"100%\" cellspacing=\"0\">"; print "<thead>"; print "<tr>"; print "<th class=\"text-right\" style=\"width:25%;\">{$caption}</th>"; print "<th class=\"text-right\" style=\"width:24.5%;\">" . T('In') . "</th>"; print "<th class=\"text-right\" style=\"width:24.5%;\">" . T('Out') . "</th>"; print "<th class=\"text-right\" style=\"width:24.5%;\">" . T('Total') . "</th>"; print "</tr>"; print "</thead>"; print "<tbody>\n"; for ($i = 0; $i < count($tab); $i++) { if ($tab[$i]['act'] == 1) { $t = $tab[$i]['label']; $rx = kbytes_to_string($tab[$i]['rx']); $tx = kbytes_to_string($tab[$i]['tx']); $total = kbytes_to_string($tab[$i]['rx'] + $tab[$i]['tx']); $id = $i & 1 ? 'odd' : 'even'; print "<tr>"; print "<td class=\"label_{$id}\" style=\"font-size:12px;;text-align:right\"><b>{$t}</b></td>"; print "<td class=\"numeric_{$id}\" style=\"font-size:12px;text-align:right\">{$rx}</td>"; print "<td class=\"numeric_{$id}\" style=\"font-size:12px;;text-align:right\">{$tx}</td>"; print "<td class=\"numeric_{$id}\" style=\"font-size:12px;;text-align:right\">{$total}</td>"; print "</tr>\n"; } } print "</tbody>"; print "</table>"; }
echo '<span id="mem_used"><div class="meter"><div class="bar" style="width: ' . $swap_used_ptg . '%;"></div><div class="text">' . $swap_used_ptg . '%</div></div>' . kbytes_to_string($swap_used) . '</span> '; echo '</div>'; echo '</fieldset>'; echo '<br />'; echo '<fieldset>'; echo '<legend>Storage</legend>'; $df = explode("\n", trim(shell_exec("df | grep -v \"Filesystem\""))); for ($i = 0; $i < count($df); $i++) { $df_name = exec("df | grep -v \"Filesystem\" | grep \"" . $df[$i] . "\" | awk '{ print \$1}'"); $df_mount = exec("df | grep -v \"Filesystem\" | grep \"" . $df[$i] . "\" | awk '{ print \$6}'"); $df_total = exec("df | grep -v \"Filesystem\" | grep \"" . $df[$i] . "\" | awk '{ print \$2}'"); $df_used = exec("df | grep -v \"Filesystem\" | grep \"" . $df[$i] . "\" | awk '{ print \$3}'"); $df_used_ptg = exec("df | grep -v \"Filesystem\" | grep \"" . $df[$i] . "\" | awk '{ print \$5}'"); echo '<div class="setting">'; echo '<div class="label">' . $df_name . ' [' . $df_mount . ']</div>'; echo '<span id="df_used"><div class="meter"><div class="bar" style="width: ' . $df_used_ptg . ';"></div><div class="text">' . $df_used_ptg . '</div></div>' . kbytes_to_string($df_used) . '/' . kbytes_to_string($df_total) . '</span> '; echo '</div>'; } echo '</fieldset>'; echo '<br />'; echo '<fieldset>'; echo '<legend>DHCP Clients</legend>'; $dhcp_clients = explode("\n", trim(shell_exec("cat /tmp/dhcp.leases"))); $count = 0; for ($i = 0; $i < count($dhcp_clients); $i++) { if ($dhcp_clients[$i] != "") { $count++; $dhcp_client = explode(" ", $dhcp_clients[$i]); $mac_address = $dhcp_client[1]; $ip_address = $dhcp_client[2]; $hostname = $dhcp_client[3];
function write_data_table_t($caption, $tab) { //print "<div class=\"panel panel-inverse\">"; //print "<div class=\"panel-heading\">"; //print "<h4 class=\"panel-title\">$caption</h4>"; //print "</div>"; print "<div class=\"panel-body text-center\" style=\"padding: 0px 0px 2px;\">"; print "<table class=\"table table-bordered table-inverse table-hover table-striped-col table-default nomargin\" width=\"100%\" cellspacing=\"0\">"; print "<thead>"; print "<tr>"; print "<th class=\"text-right\" style=\"width:auto;\">{$caption}</th>"; print "<th class=\"text-right\">" . T('In') . "</th>"; print "<th class=\"text-right\">" . T('Out') . "</th>"; print "<th class=\"text-right\">" . T('Total') . "</th>"; print "</tr>"; print "</thead>"; print "<tbody>\n"; for ($i = 0; $i < count($tab); $i++) { if ($tab[$i]['act'] == 1) { $t = $tab[$i]['label']; $rx = kbytes_to_string($tab[$i]['rx']); $tx = kbytes_to_string($tab[$i]['tx']); $total = kbytes_to_string($tab[$i]['rx'] + $tab[$i]['tx']); $id = $i & 1 ? 'odd' : 'even'; print "<tr>"; print "<td class=\"label_{$id}\" style=\"font-size:12px;\"><b>{$t}</b></td>"; print "<td class=\"numeric_{$id}\" style=\"font-size:12px;\" style=\"font-size:12px;\" style=\"font-size:12px;\">{$rx}</td>"; print "<td class=\"numeric_{$id}\" style=\"font-size:12px;\" style=\"font-size:12px;\">{$tx}</td>"; print "<td class=\"numeric_{$id}\" style=\"font-size:12px;\">{$total}</td>"; print "</tr>\n"; } } print "</tbody>"; print "</table>"; //print "</div>"; print "</div>\n"; }