From f036128f3ff35704af5d1ce2bb22892476c77f48 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 2 Aug 2016 19:39:22 -0600 Subject: [PATCH] Update device_dashboard.php Get the vendor functions from the database for the device_key dashboard. --- app/devices/device_dashboard.php | 237 +++++-------------------------- 1 file changed, 38 insertions(+), 199 deletions(-) diff --git a/app/devices/device_dashboard.php b/app/devices/device_dashboard.php index ac975e102d..790e51c9fd 100644 --- a/app/devices/device_dashboard.php +++ b/app/devices/device_dashboard.php @@ -296,6 +296,17 @@ } } +//get the vendor functions + $sql = "SELECT v.name as vendor_name, f.name, f.value "; + $sql .= "FROM v_device_vendors as v, v_device_vendor_functions as f "; + $sql .= "where v.device_vendor_uuid = f.device_vendor_uuid "; + $sql .= "and v.enabled = 'true' "; + $sql .= "and f.enabled = 'true' "; + $sql .= "order by v.name asc, f.name asc "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $vendor_functions = $prep_statement->fetchAll(PDO::FETCH_NAMED); + //add a new key if (permission_exists('device_key_add')) { $device_keys[$x]['device_key_category'] = $device_key_category; @@ -450,213 +461,41 @@ echo "\n"; //echo " \n"; - ?> - - - - - \n"; + echo " \n"; + $previous_vendor = ''; + $i=0; + foreach ($vendor_functions as $function) { + if (strlen($row['device_key_vendor']) == 0 && $function['vendor_name'] != $previous_vendor) { + if ($i > 0) { echo " \n"; } + echo " \n"; + } + $selected = ''; + if ($row['device_key_vendor'] == $function['vendor_name'] && $row['device_key_type'] == $function['value']) { + $selected = "selected='selected'"; + } + if (strlen($row['device_key_vendor']) == 0) { + echo " \n"; + } + if (strlen($row['device_key_vendor']) > 0 && $row['device_key_vendor'] == $function['vendor_name']) { + echo " \n"; + + } + $previous_vendor = $function['vendor_name']; + $i++; + } - if (strtolower($device_vendor) == "cisco" || strlen($vendor_count) > 1) { - if ($vendor_count > 1) { echo ""; } - ?> - - - - 1) { echo ""; } + if (strlen($row['device_key_vendor']) == 0) { + echo " \n"; } - if (strtolower($device_vendor) == "grandstream" || strlen($vendor_count) > 1) { - if ($vendor_count > 1) { echo ""; } - ?> - - - - - - - - - - - - - - - 1) { echo ""; } - } - if (strtolower($device_vendor) == "mitel" || strlen($vendor_count) > 1) { - if ($vendor_count > 1) { echo ""; } - ?> - - - - - - - - - - - - - - - - 1) { echo ""; } - } - if (strtolower($device_vendor) == "polycom" || strlen($vendor_count) > 1) { - if ($vendor_count > 1) { echo ""; } - ?> - - - - - - - - - - - 1) { echo ""; } - } - if (strtolower($device_vendor) == "snom" || strlen($vendor_count) > 1) { - if ($vendor_count > 1) { echo ""; } - ?> - - - - - - - - - - - - - - - - - - - - - - - 1) { echo ""; } - } - if (strtolower($device_vendor) == "yealink" || strlen($vendor_count) > 1) { - if ($vendor_count > 1) { echo ""; } - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1) { echo ""; } - } - ?> - - - \n"; + echo "\n"; + echo "\n"; //echo "\n"; //echo "