'; $sec = (string) get_parameter ('sec'); $sec2 = (string) get_parameter ('sec2'); $menu_selected = false; $allsec2 = explode('sec2=', $_SERVER['REQUEST_URI']); if (isset($allsec2[1])) { $allsec2 = $allsec2[1]; } else { $allsec2 = $sec2; } //Open list of menu echo '
'; //Invisible UL for adding border-top echo ''; } /** * Get all the data structure of menu. Operation and Godmode * * @return array Menu structure. */ function menu_get_full_sec() { global $menu_operation; global $menu_godmode; if ($menu_godmode == null || $menu_operation == null) { return array(); } else { $menu = $menu_operation + $menu_godmode; } unset($menu['class']); menu_add_extras($menu); return $menu; } /** * Build an extra access pages array and merge it with menu * * @param menu array (pass by reference) * */ function menu_add_extras(&$menu) { global $config; $menu_extra = array(); $menu_extra['gusuarios']['sub']['godmode/users/configure_user']['text'] = __('Configure user'); $menu_extra['gusuarios']['sub']['godmode/users/configure_profile']['text'] = __('Configure profile'); $menu_extra['gservers']['sub']['godmode/servers/manage_recontask_form']['text'] = __('Manage recontask'); $menu_extra['gmodules']['sub']['godmode/modules/manage_network_templates_form']['text'] = __('Module templates management'); $menu_extra['gmodules']['sub']['enterprise/godmode/modules/manage_inventory_modules_form']['text'] = __('Inventory modules management'); $menu_extra['gmodules']['sub']['godmode/tag/edit_tag']['text'] = __('Tags management'); $menu_extra['gagente']['sub']['godmode/agentes/configurar_agente']['text'] = __('Agents management'); $menu_extra['estado']['sub']['operation/agentes/ver_agente']['text'] = __('View agent'); $menu_extra['galertas']['sub']['godmode/alerts/configure_alert_template']['text'] = __('Configure alert template'); $menu_extra['network']['sub']['operation/agentes/networkmap']['text'] = __('Manage network map'); $menu_extra['network']['sub']['operation/visual_console/render_view']['text'] = __('View visual console'); $menu_extra['network']['sub']['godmode/reporting/visual_console_builder']['text'] = __('Builder visual console'); $menu_extra['eventos']['sub']['godmode/events/events']['text'] = __('Administration events'); $menu_extra['reporting']['sub']['operation/reporting/reporting_viewer']['text'] = __('View reporting'); $menu_extra['reporting']['sub']['godmode/reporting/graph_builder']['text'] = __('Manage custom graphs'); $menu_extra['reporting']['sub']['enterprise/dashboard/dashboard_replicate']['text'] = __('Copy dashboard'); if ($config['activate_gis']) $menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps'); $menu_extra['workspace']['sub']['operation/incidents/incident_statistics']['text'] = __('Incidents statistics'); $menu_extra['workspace']['sub']['operation/messages/message_edit']['text'] = __('Manage messages'); $menu_extra['gagente']['sub']['godmode/groups/configure_group']['text'] = __('Manage groups'); $menu_extra['gagente']['sub']['godmode/groups/configure_modu_group']['text'] = __('Manage module groups'); $menu_extra['gagente']['sub']['godmode/agentes/configure_field']['text'] = __('Manage custom field'); $menu_extra['galertas']['sub']['godmode/alerts/configure_alert_action']['text'] = __('Manage alert actions'); $menu_extra['galertas']['sub']['godmode/alerts/configure_alert_command']['text'] = __('Manage commands'); $menu_extra['galertas']['sub']['enterprise/godmode/alerts/alert_events']['text'] = __('Manage event alerts'); $menu_extra['gservers']['sub']['enterprise/godmode/servers/manage_export_form']['text'] = __('Manage export targets'); $menu_extra['estado']['sub']['enterprise/godmode/services/manage_services']['text'] = __('Manage services'); $menu_extra['estado']['sub']['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts'); $menu_extra['estado']['sub']['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters'); $menu_extra['estado']['sub']['enterprise/godmode/snmpconsole/snmp_trap_editor']['text'] = __('SNMP trap editor'); $menu_extra['estado']['sub']['snmpconsole']['sub2']['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator'); $menu_extra['estado']['sub']['snmpconsole']['sub2']['operation/snmpconsole/snmp_view']['text'] = __('SNMP console'); $menu_extra['workspace']['sub']['operation/incidents/incident_detail']['text'] = __('Manage incident'); $menu_extra['reporting']['sub']['godmode/reporting/visual_console_builder']['text'] = __('Manage visual console'); // Duplicate extensions as sec=extension to check it from url foreach ($menu as $k => $m) { if (!isset($m['sub'])) { continue; } foreach ($m['sub'] as $kk => $mm) { if (isset($mm['sec'])) { $menu_extra[$mm['sec']]['sub'][$kk]['text'] = $mm['text']; } } } $menu = array_merge_recursive($menu, $menu_extra); //Remove the duplicate the text entries. foreach ($menu as $k => $m) { if (!empty($m['text'])) { if (is_array($m['text'])) { $menu[$k]['text'] = reset($m['text']); } } } } /** * 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($with_categories = false) { $menu = menu_get_full_sec(); unset($menu['class']); $in_godmode = false; foreach ($menu as $k => $v) { if ($with_categories) { if (!$in_godmode && $k[0] == 'g') { // Hack to dont confuse with gis activated because godmode // sec starts with g (like gismaps) if ($k != 'gismaps') { $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; } /** * 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 get_sec($sec = false) { $menu = menu_get_full_sec(); unset($menu['class']); $in_godmode = false; foreach ($menu as $k => $v) { if (isset($v["sub"][$sec])) return $k; } return false; } /** * Get the pages in a section * * @param string sec code * @param string menu hash. All the menu structure (For example * returned by menu_get_full_sec(), json encoded and after that * base64 encoded. If this value is false this data is obtained from * menu_get_full_sec(); * * @return array Sections list */ function menu_get_sec_pages($sec, $menu_hash = false) { if (!$menu_hash) { $menu = menu_get_full_sec(); } else { $menu = json_decode(base64_decode($menu_hash),true); } $sec2_array = array(); if (isset($sec)) { // Get the sec2 of the main section $sec2_array[$menu[$sec]['sec2']] = $menu[$sec]['text']; // Get the sec2 of the subsections foreach ($menu[$sec]['sub'] as $k => $v) { // Avoid special cases of standalone windows if (preg_match('/^javascript:/', $k) || preg_match('/\.php/', $k)) { continue; } // If this value has various parameters, we only get the first $k = explode('&',$k); $k = $k[0]; $sec2_array[$k] = $v['text']; } } return $sec2_array; } /** * Get the pages in a section2 * * @param string sec code * @param string menu hash. All the menu structure (For example * returned by menu_get_full_sec(), json encoded and after that * base64 encoded. If this value is false this data is obtained from * menu_get_full_sec(); * * @return array Sections list */ function menu_get_sec2_pages($sec, $sec2, $menu_hash = false) { if ($menu_hash === false) { $menu = menu_get_full_sec(); } else { $menu = json_decode(base64_decode($menu_hash),true); } $sec3_array = array(); if (isset($menu[$sec]['sub']) AND isset($menu[$sec]['sub'][$sec2]['sub2'])) { // Get the sec2 of the subsections foreach ($menu[$sec]['sub'][$sec2]['sub2'] as $k => $v) { $sec3_array[$k] = $v['text']; } } return $sec3_array; } /** * Check if a page (sec2) is in a section (sec) * * @param string section (sec) code * @param string page (sec2)code * * @return true if the page is in section, false otherwise */ function menu_sec2_in_sec($sec,$sec2) { $sec2_array = menu_get_sec_pages($sec); // If this value has various parameters, we only get the first $sec2 = explode('&',$sec2); $sec2 = $sec2[0]; if ($sec2_array != null && in_array($sec2,array_keys($sec2_array))) { return true; } return false; } function menu_sec3_in_sec2($sec,$sec2,$sec3) { $sec3_array = menu_get_sec2_pages($sec, $sec2, $menu_hash = false); // If this value has various parameters, we only get the first $sec3 = explode('&',$sec3); $sec3 = $sec3[0]; if ($sec3_array != null && in_array($sec3,array_keys($sec3_array))) { return true; } return false; } ?>