From e088b412cd831bd669850c690984f1ae6ffc2f9a Mon Sep 17 00:00:00 2001 From: fermin831 Date: Wed, 20 Feb 2019 13:55:21 +0100 Subject: [PATCH] Added preload schecked values into snmp browser treeview Former-commit-id: d8a3317d849263ff732cbf3a7a7714f4b41917d5 --- pandora_console/include/functions_snmp_browser.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 9354d4adfd..4920816c89 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -27,7 +27,7 @@ $nfdump_date_format = 'Y/m/d.H:i:s'; * @param id string Level ID. Do not set, used for recursion. * @param depth string Branch depth. Do not set, used for recursion. */ -function snmp_browser_print_tree($tree, $id=0, $depth=0, $last=0, $last_array=[], $sufix=false) +function snmp_browser_print_tree($tree, $id=0, $depth=0, $last=0, $last_array=[], $sufix=false, $checked=[]) { static $url = false; @@ -108,7 +108,8 @@ function snmp_browser_print_tree($tree, $id=0, $depth=0, $last=0, $last_array=[] $checkbox_name_sufix = ($sufix === true) ? '_'.$level : ''; $checkbox_name = 'create_'.$sub_id.$checkbox_name_sufix; - echo html_print_checkbox($checkbox_name, 0, false, true, false, '').' '.$level.''; + $status = (!empty($checked) && isset($checked[$level])); + echo html_print_checkbox($checkbox_name, 0, $status, true, false, '').' '.$level.''; if (isset($sub_level['__VALUE__'])) { echo ''; } @@ -116,7 +117,7 @@ function snmp_browser_print_tree($tree, $id=0, $depth=0, $last=0, $last_array=[] echo ''; // Recursively print sub levels. - snmp_browser_print_tree($sub_level, $sub_id, ($depth + 1), ($count == $total ? 1 : 0), $last_array, $sufix); + snmp_browser_print_tree($sub_level, $sub_id, ($depth + 1), ($count == $total ? 1 : 0), $last_array, $sufix, $checked); $count++; }