diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1a714ed62f..c090a03e6b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2012-06-18 Sergio Martin + + * include/functions_menu.php: Added categories in the + combo of sections (Operation and Administration) + Merged from 4.0.2 + 2012-06-18 Dario Rodriguez * operation/tree.php: Fixed a bug which shows groups diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 857a3bbaed..2391638368 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -337,14 +337,35 @@ function menu_get_full_sec() { /** * Get the sec list built in menu * + * @param bool If true, the array returned will have the structure + * to combo categories (optgroup) + * * @return array Sections list */ -function menu_get_sec() { +function menu_get_sec($with_categories = false) { $menu = menu_get_full_sec(); unset($menu['class']); + $in_godmode = false; foreach($menu as $k => $v) { - $sec_array[$k] = $v['text']; + if($with_categories) { + if(!$in_godmode && $k[0] == 'g') { + $in_godmode = true; + } + + if($in_godmode) { + $category = __('Administration'); + } + else { + $category = __('Operation'); + } + + $sec_array[$k]['optgroup'] = $category; + $sec_array[$k]['name'] = $v['text']; + } + else { + $sec_array[$k] = $v['text']; + } } return $sec_array;