From e9580d079ae6ce503b3a726502848675cdd5bcf5 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 2 Aug 2016 12:44:46 -0600 Subject: [PATCH] Update device_profile_edit.php Build the device profiles vendor functions from the database. --- app/devices/device_profile_edit.php | 271 ++++------------------------ 1 file changed, 38 insertions(+), 233 deletions(-) diff --git a/app/devices/device_profile_edit.php b/app/devices/device_profile_edit.php index c425e84f65..971db61375 100644 --- a/app/devices/device_profile_edit.php +++ b/app/devices/device_profile_edit.php @@ -212,6 +212,17 @@ $device_keys[$x]['device_key_extension'] = ''; $device_keys[$x]['device_key_label'] = ''; +//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); + //show the header require_once "resources/header.php"; $document['title'] = $text['title-profile']; @@ -409,245 +420,39 @@ echo "\n"; echo "\n"; - if (strlen($row['device_key_vendor']) > 0) { - $device_key_vendor = $row['device_key_vendor']; - } - else { - $device_key_vendor = $device_vendor; - } ?> - - - \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) == "polycom" || strlen($device_vendor) == 0) { - if (strlen($device_vendor) == 0) { echo ""; } - ?> - - - - - - - - - - - "; } + if (strlen($row['device_key_vendor']) == 0) { + echo " \n"; } - if (strtolower($device_vendor) == "snom" || strlen($device_vendor) == 0) { - if (strlen($device_vendor) == 0) { echo ""; } - ?> - - - - - - - - - - - - - - - - - - - - - - - "; } - } - if (strtolower($device_vendor) == "yealink" || strlen($device_vendor) == 0) { - if (strlen($device_vendor) == 0) { echo ""; } - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "; } - } - ?> - + echo "\n"; - \n"; echo "\n"; echo "