mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-23 08:29:06 +00:00
Simplify table header printing
This commit is contained in:
parent
a862212326
commit
ac801e1543
2
bans.php
2
bans.php
@ -6,14 +6,12 @@ use PDO;
|
||||
require_once './includes/page.php';
|
||||
$page = new Page("bans");
|
||||
$page->print_title();
|
||||
$headers = array("Name", "Banned By", "Reason", "Banned On", "Banned Until");
|
||||
|
||||
$page->print_page_header();
|
||||
|
||||
$page->print_check_form();
|
||||
|
||||
$page->table_begin();
|
||||
$page->table_print_headers($headers);
|
||||
|
||||
$result = $page->run_query();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
@ -114,7 +114,6 @@ try {
|
||||
|
||||
if (!empty($all)) {
|
||||
$page->table_begin();
|
||||
$page->table_print_headers(array("Type", "Player", "Moderator", "Reason", "Date", "Expires"));
|
||||
|
||||
$offset = 0;
|
||||
$limit = $page->settings->limit_per_page;
|
||||
|
@ -49,6 +49,7 @@ class Page {
|
||||
$this->header = $h;
|
||||
$h->print_header();
|
||||
}
|
||||
$this->table_headers_printed = false;
|
||||
}
|
||||
|
||||
public function type_info($type) {
|
||||
@ -264,7 +265,12 @@ class Page {
|
||||
echo "<title>$title - $name</title>";
|
||||
}
|
||||
|
||||
function print_table_rows($row, $array) {
|
||||
function print_table_rows($row, $array, $print_headers = true) {
|
||||
if ($print_headers && !$this->table_headers_printed) {
|
||||
$headers = array_keys($array);
|
||||
$this->table_print_headers($headers);
|
||||
$this->table_headers_printed = true;
|
||||
}
|
||||
if ($this->settings->debug_mode > 0) {
|
||||
var_dump($row);
|
||||
}
|
||||
@ -275,6 +281,9 @@ class Page {
|
||||
$style = "";
|
||||
if ($header === "Reason") {
|
||||
$style = "style=\"width: 30%;\"";
|
||||
if ($text === "") {
|
||||
$text = "-";
|
||||
}
|
||||
}
|
||||
$a = "a";
|
||||
if ($header === "Received Warning") {
|
||||
|
@ -6,14 +6,12 @@ use PDO;
|
||||
require_once './includes/page.php';
|
||||
$page = new Page("kicks");
|
||||
$page->print_title();
|
||||
$headers = array("Name", "Kicked By", "Reason", "Date");
|
||||
|
||||
$page->print_page_header();
|
||||
|
||||
$page->print_check_form();
|
||||
|
||||
$page->table_begin();
|
||||
$page->table_print_headers($headers);
|
||||
|
||||
$result = $page->run_query();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
@ -6,14 +6,12 @@ use PDO;
|
||||
require_once './includes/page.php';
|
||||
$page = new Page("mutes");
|
||||
$page->print_title();
|
||||
$headers = array("Name", "Muted By", "Reason", "Muted On", "Muted Until");
|
||||
|
||||
$page->print_page_header();
|
||||
|
||||
$page->print_check_form();
|
||||
|
||||
$page->table_begin();
|
||||
$page->table_print_headers($headers);
|
||||
|
||||
$result = $page->run_query();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
@ -6,14 +6,12 @@ use PDO;
|
||||
require_once './includes/page.php';
|
||||
$page = new Page("warnings");
|
||||
$page->print_title();
|
||||
$headers = array("Name", "Warned By", "Reason", "Warned Until", "Received Warning");
|
||||
|
||||
$page->print_page_header();
|
||||
|
||||
$page->print_check_form();
|
||||
|
||||
$page->table_begin();
|
||||
$page->table_print_headers($headers);
|
||||
|
||||
$result = $page->run_query();
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user