Destinations/Extensions/Voicemails: Better sorting ability.

This commit is contained in:
reliberate
2016-03-28 15:21:05 -06:00
parent 6fe526a22b
commit 5793de2851
4 changed files with 29 additions and 15 deletions
+13 -5
View File
@@ -40,10 +40,8 @@ else {
//get the http values and set them as variables
$search = check_str($_GET["search"]);
if (isset($_GET["order_by"])) {
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
}
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//includes and title
require_once "resources/header.php";
@@ -113,7 +111,17 @@ else {
$sql .= " or destination_description like '%".$search."%' ";
$sql .= ") ";
}
if (strlen($order_by) > 0) { $sql .= "order by $order_by $order "; }
if (strlen($order_by) > 0) {
if ($order_by == 'destination_type') {
$sql .= "order by destination_type ".$order.", destination_number asc ";
}
else {
$sql .= "order by ".$order_by." ".$order." ";
}
}
else {
$sql .= "order by destination_type asc, destination_number asc ";
}
$sql .= "limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();