Add a search to Extensions and Destinations

This commit is contained in:
Mark Crane
2014-05-02 08:22:27 +00:00
parent 509788da94
commit cc68c60cdb
2 changed files with 37 additions and 6 deletions
+21 -4
View File
@@ -45,9 +45,12 @@ $page["title"] = $text['title-destinations'];
require_once "resources/paging.php";
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//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"]);
}
//show the content
echo "<div align='center'>";
@@ -75,7 +78,14 @@ require_once "resources/paging.php";
//prepare to page the results
$sql = " select count(*) as num_rows from v_destinations ";
$sql .= " where domain_uuid = '$domain_uuid' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and (";
$sql .= " destination_type = '".$search."' ";
$sql .= " or destination_number = '".$search."' ";
$sql .= " or destination_context = '".$search."' ";
$sql .= " or destination_enabled = '".$search."' ";
$sql .= " or destination_description = '".$search."' ";
$sql .= ") ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
@@ -100,6 +110,13 @@ require_once "resources/paging.php";
//get the list
$sql = "select * from v_destinations ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and (";
$sql .= " destination_type = '".$search."' ";
$sql .= " or destination_number = '".$search."' ";
$sql .= " or destination_context = '".$search."' ";
$sql .= " or destination_enabled = '".$search."' ";
$sql .= " or destination_description = '".$search."' ";
$sql .= ") ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$sql .= "limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));