Rename vars sb to sort, o to order, p to page. This makes the code easier to understand and brings consistency

This commit is contained in:
johnnyq
2023-07-08 12:34:28 -04:00
parent 8213ef1e24
commit e7572c9e8f
48 changed files with 443 additions and 443 deletions

View File

@@ -1,13 +1,13 @@
<?php
// Default Column Sortby/Order Filter
$sb = "client_accessed_at";
$o = "DESC";
$sort = "client_accessed_at";
$order = "DESC";
require_once("inc_all.php");
//Rebuild URL
$url_query_strings_sb = http_build_query(array_merge($_GET, array('sb' => $sb, 'o' => $o)));
$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order)));
$sql = mysqli_query(
$mysqli,
@@ -26,7 +26,7 @@ $sql = mysqli_query(
AND clients.client_archived_at IS NULL
AND DATE(clients.client_created_at) BETWEEN '$dtf' AND '$dtt'
GROUP BY clients.client_id
ORDER BY $sb $o
ORDER BY $sort $order
LIMIT $record_from, $record_to
");
@@ -100,9 +100,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<table class="table table-striped table-hover table-borderless">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=client_name&o=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=location_city&o=<?php echo $disp; ?>">Primary address </a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Primary contact</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=location_city&order=<?php echo $disp; ?>">Primary address </a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">Primary contact</a></th>
<?php if ($session_user_role == 3 || $session_user_role == 1 && $config_module_enable_accounting == 1) { ?> <th class="text-right">Billing</th> <?php } ?>
<?php if ($session_user_role == 3) { ?> <th class="text-center">Action</th> <?php } ?>
</tr>