From 2ebddadd868f69ebc031a7940a4552f8ab2aa486 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 18 Jun 2012 16:51:32 +0000 Subject: [PATCH] 2012-06-18 Sergio Martin * include/functions_menu.php: Added categories in the combo of sections (Operation and Administration) Merged from 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6582 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++++ pandora_console/include/functions_menu.php | 25 ++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) 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;