From 57540aacbcd75962c00a6ff4c06b487e23c7fb2d Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 20 Jul 2015 14:03:09 +0100 Subject: [PATCH] Added search and sorting support --- html/includes/table/edit-ports.inc.php | 6 +++++- html/pages/device/edit/ports.inc.php | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/html/includes/table/edit-ports.inc.php b/html/includes/table/edit-ports.inc.php index 5a935b2bff..d53a436d83 100644 --- a/html/includes/table/edit-ports.inc.php +++ b/html/includes/table/edit-ports.inc.php @@ -7,6 +7,10 @@ $device_id = $_POST['device_id']; $sql = 'FROM `ports` WHERE `device_id` = ?'; $param = array($device_id); +if (isset($searchPhrase) && !empty($searchPhrase)) { + $sql .= " AND (`ifName` LIKE '%$searchPhrase%' OR `ifAlias` LIKE '%$searchPhrase%' OR `ifDescr` LIKE '%$searchPhrase%')"; +} + $count_sql = "SELECT COUNT(`port_id`) $sql"; $total = dbFetchCell($count_sql, $param); if (empty($total)) { @@ -53,7 +57,7 @@ foreach (dbFetchRows($sql, $param) as $port) { $response[] = array( 'ifIndex' => $port['ifIndex'], - 'label' => $port['label'], + 'ifName' => $port['label'], 'ifAdminStatus' => $port['ifAdminStatus'], 'ifOperStatus' => ''.$port['ifOperStatus'].'', 'disabled' => ' diff --git a/html/pages/device/edit/ports.inc.php b/html/pages/device/edit/ports.inc.php index 00a2d52c45..037160d087 100644 --- a/html/pages/device/edit/ports.inc.php +++ b/html/pages/device/edit/ports.inc.php @@ -8,11 +8,11 @@ Index - Name + Name Admin Oper - Disable - Ignore + Disable + Ignore Description