Clean up tables

This commit is contained in:
Ruan 2015-07-08 08:24:25 +02:00
parent e54fdce3a3
commit 2db9e7ec6a
4 changed files with 13 additions and 52 deletions

View File

@ -36,27 +36,8 @@
<div class="row" style="margin-bottom:60px;"> <div class="row" style="margin-bottom:60px;">
<div class="col-lg-12"> <div class="col-lg-12">
<table class="table table-hover table-bordered table-condensed"> <table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th>
<div style="text-align: center;">Name</div>
</th>
<th>
<div style="text-align: center;">Banned By</div>
</th>
<th>
<div style="text-align: center;">Reason</div>
</th>
<th>
<div style="text-align: center;">Banned On</div>
</th>
<th>
<div style="text-align: center;">Banned Until</div>
</th>
</tr>
</thead>
<tbody>
<?php <?php
print_table_headers(array("Name", "Banned By", "Reason", "Banned On", "Banned Until"));
global $table_bans, $conn, $show_inactive_bans; global $table_bans, $conn, $show_inactive_bans;
$result = run_query($table_bans); $result = run_query($table_bans);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
@ -80,7 +61,6 @@
</td> </td>
</tr> </tr>
<?php } ?> <?php } ?>
</tbody>
</table> </table>
</div> </div>
</div> </div>

View File

@ -77,4 +77,14 @@ function clean($text) {
return $text; return $text;
} }
function print_table_headers($headers) {
echo("<thead><tr>");
foreach ($headers as $header) {
echo('<th><div style="text-align: center;">');
echo($header);
echo('</div></th>');
}
echo("<tbody>");
}
?> ?>

View File

@ -13,17 +13,8 @@
<div class="row" style="margin-bottom:60px;"> <div class="row" style="margin-bottom:60px;">
<div class="col-lg-12"> <div class="col-lg-12">
<table class="table table-hover table-bordered table-condensed"> <table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th style="text-align: center;">Name</th>
<th style="text-align: center;">Muted By</th>
<th style="text-align: center;">Reason</th>
<th style="text-align: center;">Muted On</th>
<th style="text-align: center;">Muted Until</th>
</tr>
</thead>
<tbody>
<?php <?php
print_table_headers(array("Name", "Muted By", "Reason", "Muted On", "Muted Until"));
global $table_mutes, $conn, $show_inactive_bans; global $table_mutes, $conn, $show_inactive_bans;
$result = run_query($table_mutes); $result = run_query($table_mutes);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
@ -48,7 +39,6 @@
</tr> </tr>
<?php } <?php }
?> ?>
</tbody>
</table> </table>
</div> </div>
</div> </div>

View File

@ -13,27 +13,8 @@
<div class="row" style="margin-bottom:60px;"> <div class="row" style="margin-bottom:60px;">
<div class="col-lg-12"> <div class="col-lg-12">
<table class="table table-hover table-bordered table-condensed"> <table class="table table-hover table-bordered table-condensed">
<thead>
<tr>
<th>
<div style="text-align: center;">Name</div>
</th>
<th>
<div style="text-align: center;">Warned By</div>
</th>
<th>
<div style="text-align: center;">Reason</div>
</th>
<th>
<div style="text-align: center;">Warned Until</div>
</th>
<th>
<div style="text-align: center;">Received Warning?</div>
</th>
</tr>
</thead>
<tbody>
<?php <?php
print_table_headers(array("Name", "Warned By", "Reason", "Warned Until", "Received Warning?"));
global $table_warnings, $conn, $show_inactive_bans; global $table_warnings, $conn, $show_inactive_bans;
$result = run_query($table_warnings); $result = run_query($table_warnings);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {