From 80d6ec2dc616d9b6d90fe65821ee12084496e817 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Wed, 28 Jul 2010 17:44:04 +0000 Subject: [PATCH] 2010-07-28 Sergio Martin * include/functions_html.php: Improved the print_select function to allows agroupation of options git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3076 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ pandora_console/include/functions_html.php | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4ea9bdb037..058090f60a 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2010-07-28 Sergio Martin + + * include/functions_html.php: Improved the print_select function + to allows agroupation of options + 2010-07-28 Ramon Novoa * include/fgraph.php: Async modules are not compressed. Fixed charts diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 73b9c37b0f..ed1bc70784 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -263,7 +263,20 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing = if ($sort !== false) { asort ($fields); } + $lastopttype = ''; foreach ($fields as $value => $label) { + $optlabel = $label; + if(is_array($label)){ + if($label['optgroup'] != $lastopttype) { + if($lastopttype != '') { + $output .= ''; + } + $output .= ''; + $lastopttype = $label['optgroup']; + } + $optlabel = $label['name']; + } + $output .= '"; + $output .= '>'.$optlabel.""; } } + if(is_array($label)){ + $output .= ''; + } } $output .= "";