From 9b9d2a364734dd0d84ae6309b4720e5076bef85a Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Fri, 3 May 2019 10:39:29 +0200 Subject: [PATCH] fixed errors reporting_builder.item_editor.php Former-commit-id: bef20169ce65e7d78aece4d390bc76f8098864d7 --- .../reporting_builder.item_editor.php | 1998 ++++++++++++----- 1 file changed, 1491 insertions(+), 507 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 85b5ee128d..8c2eea6727 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -1,24 +1,43 @@ $idItem]); $server_name = $item['server_name']; - // Metaconsole db connection + // Metaconsole db connection. if ($meta && $server_name != '') { $connection = metaconsole_get_connection($server_name); if (metaconsole_load_external_db($connection) != NOERR) { - // ui_print_error_message ("Error connecting to ".$server_name); + continue; } } @@ -236,7 +257,7 @@ switch ($action) { $idAgentModule = $item['id_agent_module']; $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); $period = $item['period']; - // 'top_n_value' field will be reused for projection report + // 'top_n_value' field will be reused for projection report. if ($type == 'projection_graph') { $projection_period = $item['top_n_value']; $period_pg = $item['period']; @@ -250,14 +271,15 @@ switch ($action) { $description = $item['description']; $idAgentModule = $item['id_agent_module']; $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); - // 'top_n' field will be reused for prediction_date report + // 'top_n' field will be reused for prediction_date report. $max_interval = $item['top_n']; $min_interval = $item['top_n_value']; $intervals_text = $item['text']; - // Parse intervals text field + // Parse intervals text field. $max_interval = substr($intervals_text, 0, strpos($intervals_text, ';')); $min_interval = substr($intervals_text, (strpos($intervals_text, ';') + 1)); - // 'top_n_value' field will be reused for prediction_date report + // 'top_n_value' field will be reused + // for prediction_date report. $period_pg = $item['period']; break; @@ -286,7 +308,7 @@ switch ($action) { $time_to = $item['time_to']; $show_graph = $item['show_graph']; $priority_mode = isset($style['priority_mode']) ? $style['priority_mode'] : REPORT_PRIORITY_MODE_OK; - // 'top_n' filed will be reused for SLA sort option + // 'top_n' filed will be reused for SLA sort option. $sla_sorted_by = $item['top_n']; $period = $item['period']; break; @@ -295,13 +317,21 @@ switch ($action) { $description = $item['description']; $period = $item['period']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); break; case 'increment': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $period = $item['period']; break; @@ -319,14 +349,18 @@ switch ($action) { $time_from = $item['time_from']; $time_to = $item['time_to']; $show_graph = $item['show_graph']; - // 'top_n' filed will be reused for SLA sort option + // 'top_n' filed will be reused for SLA sort option. $sla_sorted_by = $item['top_n']; break; case 'monitor_report': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $idAgentModule = $item['id_agent_module']; $period = $item['period']; break; @@ -334,7 +368,11 @@ switch ($action) { case 'avg_value': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $idAgentModule = $item['id_agent_module']; $period = $item['period']; $lapse = $item['lapse']; @@ -345,7 +383,11 @@ switch ($action) { case 'max_value': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $idAgentModule = $item['id_agent_module']; $period = $item['period']; $lapse = $item['lapse']; @@ -356,7 +398,11 @@ switch ($action) { case 'min_value': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $idAgentModule = $item['id_agent_module']; $period = $item['period']; $lapse = $item['lapse']; @@ -367,7 +413,11 @@ switch ($action) { case 'sumatory': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $idAgentModule = $item['id_agent_module']; $period = $item['period']; break; @@ -375,7 +425,11 @@ switch ($action) { case 'historical_data': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $idAgentModule = $item['id_agent_module']; $period = $item['period']; break; @@ -406,7 +460,11 @@ switch ($action) { case 'database_serialized': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $header = $item['header_definition']; $field = $item['column_separator']; $line = $item['line_separator']; @@ -416,41 +474,65 @@ switch ($action) { case 'TTRT': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $period = $item['period']; break; case 'TTO': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $period = $item['period']; break; case 'MTBF': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $period = $item['period']; break; case 'MTTR': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $period = $item['period']; break; case 'alert_report_module': $description = $item['description']; $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente_modulo' => $idAgentModule]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente_modulo' => $idAgentModule] + ); $period = $item['period']; break; case 'alert_report_agent': $description = $item['description']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', ['id_agente' => $item['id_agent']]); + $idAgent = db_get_value_filter( + 'id_agente', + 'tagente_modulo', + ['id_agente' => $item['id_agent']] + ); $period = $item['period']; break; @@ -474,11 +556,20 @@ switch ($action) { $idAgent = $item['id_agent']; $idAgentModule = $item['id_agent_module']; - // Added for events items + // Added for events items. $show_summary_group = $style['show_summary_group']; - $filter_event_severity = json_decode($style['filter_event_severity'], true); - $filter_event_status = json_decode($style['filter_event_status'], true); - $filter_event_type = json_decode($style['filter_event_type'], true); + $filter_event_severity = json_decode( + $style['filter_event_severity'], + true + ); + $filter_event_status = json_decode( + $style['filter_event_status'], + true + ); + $filter_event_type = json_decode( + $style['filter_event_type'], + true + ); $event_graph_by_agent = $style['event_graph_by_agent']; $event_graph_by_user_validator = $style['event_graph_by_user_validator']; @@ -504,7 +595,7 @@ switch ($action) { $order_uptodown = $item['order_uptodown']; $show_resume = $item['show_resume']; // HACK it is saved in show_graph field. - // Show interfaces instead the modules + // Show interfaces instead the modules. $show_address_agent = $item['show_graph']; $monday = $item['monday']; $tuesday = $item['tuesday']; @@ -557,21 +648,7 @@ switch ($action) { $description = $item['description']; $period = $item['period']; $exception_condition = $item['exception_condition']; - - switch ($config['dbtype']) { - case 'mysql': - case 'postgresql': - $exception_condition_value = $item['exception_condition_value']; - break; - - case 'oracle': - $exception_condition_value = oracle_format_float_to_php( - $item['exception_condition_value'] - ); - break; - } - - + $exception_condition_value = $item['exception_condition_value']; $show_resume = $item['show_resume']; $show_graph = $item['show_graph']; $order_uptodown = $item['order_uptodown']; @@ -643,6 +720,10 @@ switch ($action) { $description = $item['description']; $top_n_value = $item['top_n_value']; break; + + default: + // It's not possible. + break; } switch ($type) { @@ -677,7 +758,7 @@ switch ($action) { break; } - // Restore db connection + // Restore db connection. if ($meta && $server_name != '') { metaconsole_restore_db(); } @@ -713,18 +794,12 @@ $class = 'databox filters'; '.html_print_image('images/tip.png', true, ['title' => $text]).''; ?> - - + @@ -757,11 +831,21 @@ $class = 'databox filters'; @@ -782,20 +870,20 @@ $class = 'databox filters'; ?> - + - - + + - + @@ -806,26 +894,30 @@ $class = 'databox filters'; ?> - + "; + echo ""; ?> - + @@ -841,12 +933,14 @@ $class = 'databox filters'; ?> - + @@ -862,7 +956,7 @@ $class = 'databox filters'; ?> - + - + - + + + @@ -982,24 +1104,49 @@ $class = 'databox filters'; - + + + - + + + - - + @@ -1024,7 +1171,12 @@ $class = 'databox filters'; ); } - echo '   '.__('Recursion').html_print_checkbox('recursion', 1, $recursion, true); + echo '   '.__('Recursion').html_print_checkbox( + 'recursion', + 1, + $recursion, + true + ); ?> @@ -1037,9 +1189,10 @@ $class = 'databox filters'; $agents = []; } - $sql_log = 'SELECT source AS k, source AS v - FROM tagente,tagent_module_log - WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0'; + $sql_log = 'SELECT source AS k, source AS v + FROM tagente,tagent_module_log + WHERE tagente.id_agente = tagent_module_log.id_agent + AND tagente.disabled = 0'; if (!empty($agents)) { $index = 0; @@ -1056,7 +1209,17 @@ $class = 'databox filters'; $sql_log .= ')'; } - html_print_select_from_sql($sql_log, 'source', $source, 'onselect=source_change_agents();', __('All'), '', false, false, false); + html_print_select_from_sql( + $sql_log, + 'source', + $source, + 'onselect=source_change_agents();', + __('All'), + '', + false, + false, + false + ); ?> @@ -1074,7 +1237,7 @@ $class = 'databox filters'; ?> - + @@ -1084,15 +1247,19 @@ $class = 'databox filters'; $agent_name = ''; if (metaconsole_load_external_db($connection) == NOERR) { - $agent_name = db_get_value_filter('nombre', 'tagente', ['id_agente' => $idAgent]); + $agent_name = db_get_value_filter( + 'nombre', + 'tagente', + ['id_agente' => $idAgent] + ); } - // Append server name + // Append server name. if (!empty($agent_name)) { $agent_name .= ' ('.$server_name.')'; } - // Restore db connection + // Restore db connection. metaconsole_restore_db(); } else { $agent_name = agents_get_alias($idAgent); @@ -1103,9 +1270,7 @@ $class = 'databox filters'; html_print_input_hidden('server_id', $server_name); html_print_input_hidden('id_server', ''); - - $params = []; - + $params = []; $params['show_helptip'] = false; $params['input_name'] = 'agent'; $params['value'] = $agent_name; @@ -1116,13 +1281,11 @@ $class = 'databox filters'; $params['use_hidden_input_idagent'] = true; $params['hidden_input_idagent_id'] = 'hidden-id_agent'; if ($meta) { - // $params['input_id'] = 'agent_autocomplete'; $params['use_input_id_server'] = true; $params['input_id_server_id'] = 'hidden-server_id'; $params['metaconsole_enabled'] = true; $params['input_id'] = 'agent_autocomplete_events'; $params['javascript_page'] = 'include/ajax/agent'; - // 'enterprise/meta/include/ajax/events.ajax'; $params['input_name'] = 'agent_text'; } @@ -1130,7 +1293,7 @@ $class = 'databox filters'; ?> - + $value) { @@ -1215,12 +1397,28 @@ $class = 'databox filters'; } } - html_print_select($agents2, 'id_agents3[]', $agents_select, $script = '', '', 0, false, true, true, '', false, 'min-width: 180px'); - echo "'; + html_print_select( + $agents2, + 'id_agents3[]', + $agents_select, + $script = '', + '', + 0, + false, + true, + true, + '', + false, + 'min-width: 180px' + ); + echo "'; ?> - + @@ -1230,12 +1428,11 @@ $class = 'databox filters'; $agents2[$value['id_agente']] = $value['alias']; } - // $agents = agents_get_group_agents($group); if ((empty($agents2)) || $agents2 == -1) { $agents = []; } - $agents_select = []; + $agents_select = []; if (is_array($id_agents) || is_object($id_agents)) { foreach ($id_agents as $id) { foreach ($agents2 as $key => $a) { @@ -1246,7 +1443,20 @@ $class = 'databox filters'; } } - html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', '', 0, false, true, true, '', false, 'min-width: 180px'); + html_print_select( + $agents2, + 'id_agents2[]', + $agents_select, + $script = '', + '', + 0, + false, + true, + true, + '', + false, + 'min-width: 180px' + ); ?> @@ -1259,11 +1469,25 @@ $class = 'databox filters'; 0 => __('Show common modules'), 1 => __('Show all modules'), ]; - html_print_select($selection, 'selection_agent_module', $selection_a_m, $script = '', '', 0, false, false, true, '', false, 'min-width: 180px'); + + html_print_select( + $selection, + 'selection_agent_module', + $selection_a_m, + $script = '', + '', + 0, + false, + false, + true, + '', + false, + 'min-width: 180px' + ); ?> - + @@ -1272,8 +1496,10 @@ $class = 'databox filters'; $all_modules = ''; } else { $all_modules = db_get_all_rows_sql( - 'SELECT DISTINCT nombre, id_agente_modulo FROM - tagente_modulo WHERE id_agente IN ('.implode(',', array_values($id_agents)).')' + 'SELECT DISTINCT nombre, id_agente_modulo + FROM tagente_modulo + WHERE id_agente + IN ('.implode(',', array_values($id_agents)).')' ); } @@ -1297,53 +1523,98 @@ $class = 'databox filters'; $all_modules_structured[$a['id_agente_modulo']] = $a['nombre']; } - html_print_select($all_modules_structured, 'module[]', $modules_select, $script = '', __('None'), 0, false, true, true, '', false, 'min-width: 180px'); + html_print_select( + $all_modules_structured, + 'module[]', + $modules_select, + $script = '', + __('None'), + 0, + false, + true, + true, + '', + false, + 'min-width: 180px' + ); ?> - + - + 0]; } - $array_inventory_modules = implode(',', $inventory_modules); + $array_inventory_modules = implode(',', $inventory_modules); - html_print_input_hidden( - 'inventory_modules_selected', - $array_inventory_modules - ); - ?> + html_print_input_hidden( + 'inventory_modules_selected', + $array_inventory_modules + ); + ?> - + @@ -1361,12 +1632,25 @@ $class = 'databox filters'; $dates = []; } - html_print_select($dates, 'date', '', '', __('Last'), 0, false, false, false, '', false, 'min-width: 180px'); + html_print_select( + $dates, + 'date', + '', + '', + __('Last'), + 0, + false, + false, + false, + '', + false, + 'min-width: 180px' + ); html_print_input_hidden('date_selected', $date); ?> - + @@ -1375,9 +1659,21 @@ $class = 'databox filters'; $graphs = []; $graphs = metaconsole_get_custom_graphs(); $value_selected = $idCustomGraph.'|'.$server_name; - html_print_select($graphs, 'id_custom_graph', $value_selected, 'change_custom_graph();', __('None'), 0); + html_print_select( + $graphs, + 'id_custom_graph', + $value_selected, + 'change_custom_graph();', + __('None'), + 0 + ); } else { - $list_custom_graphs = custom_graphs_get_user($config['id_user'], false, true, 'RR'); + $list_custom_graphs = custom_graphs_get_user( + $config['id_user'], + false, + true, + 'RR' + ); $graphs = []; foreach ($list_custom_graphs as $custom_graph) { @@ -1399,9 +1695,11 @@ $class = 'databox filters'; if (empty($idCustomGraph)) { $style_button_create_custom_graph = ''; $style_button_edit_custom_graph = 'style="display: none;"'; - // Select the target server + // Select the target server. if ($meta) { - $metaconsole_connections = enterprise_hook('metaconsole_get_connection_names'); + $metaconsole_connections = enterprise_hook( + 'metaconsole_get_connection_names' + ); if ($metaconsole_connections === false) { $metaconsole_connections = []; } @@ -1415,14 +1713,15 @@ $class = 'databox filters'; $result_servers[$connection_data['server_name']] = $connection_data['server_name']; } - // Print select combo with metaconsole servers + // Print select combo with metaconsole servers. if (!empty($result_servers)) { echo ''; } else { - // If there are not metaconsole servers don't allow to create new custom graphs + // If there are not metaconsole servers + // don't allow to create new custom graphs. $style_button_create_custom_graph = 'style="display: none;"'; } } @@ -1447,19 +1746,41 @@ $class = 'databox filters'; ?> - + - + + + - - - + - - + + + + + + - + @@ -1467,7 +1788,7 @@ $class = 'databox filters'; html_print_textarea('sql', 5, 25, $sql_query_report); ?> - + @@ -1479,7 +1800,7 @@ $class = 'databox filters'; - + @@ -1487,34 +1808,114 @@ $class = 'databox filters'; - + - - + + + + + + - + - + + + - - + + + + + + - - + + + + + + - - + + + + + + @@ -1544,36 +1945,79 @@ $class = 'databox filters'; ?> - + - + + + - + - + + + - + - + + + @@ -1581,9 +2025,12 @@ $class = 'databox filters'; - + @@ -1622,15 +2069,26 @@ $class = 'databox filters'; REPORT_EXCEPTION_CONDITION_OK => __('OK'), REPORT_EXCEPTION_CONDITION_NOT_OK => __('Not OK'), ]; - html_print_select($list_exception_condition, 'exception_condition', $exception_condition); + html_print_select( + $list_exception_condition, + 'exception_condition', + $exception_condition + ); ?> - + - - + + + @@ -1668,7 +2126,11 @@ $class = 'databox filters';

@@ -1676,7 +2138,11 @@ $class = 'databox filters';

@@ -1691,11 +2157,14 @@ $class = 'databox filters'; - + @@ -1708,10 +2177,16 @@ $class = 'databox filters'; ?> - - + - + + +

@@ -1781,7 +2260,7 @@ $class = 'databox filters'; html_print_checkbox('agent_max_value', 1, $agent_max_value); ?>

- +

- + + + @@ -1857,7 +2344,7 @@ $class = 'databox filters'; ?> - + @@ -1886,10 +2373,18 @@ $class = 'databox filters'; - + + + @@ -1900,34 +2395,53 @@ $class = 'databox filters'; - + @@ -1938,31 +2452,76 @@ $class = 'databox filters'; - - + + + + + + - + - - + + + + + + - + - + + + - + + + '; - html_print_radio_button( - 'priority_mode', - REPORT_PRIORITY_MODE_OK, - '', - $priority_mode == REPORT_PRIORITY_MODE_OK, - '' - ); + echo __('Priority ok mode'); + echo ''; + html_print_radio_button( + 'priority_mode', + REPORT_PRIORITY_MODE_OK, + '', + $priority_mode == REPORT_PRIORITY_MODE_OK, + '' + ); - echo ''; + echo ''; - echo __('Priority unknown mode').''; - html_print_radio_button( - 'priority_mode', - REPORT_PRIORITY_MODE_UNKNOWN, - '', - $priority_mode == REPORT_PRIORITY_MODE_UNKNOWN, - '' - ); - ?> + echo __('Priority unknown mode'); + echo ''; + html_print_radio_button( + 'priority_mode', + REPORT_PRIORITY_MODE_UNKNOWN, + '', + $priority_mode == REPORT_PRIORITY_MODE_UNKNOWN, + '' + ); + ?> @@ -2011,17 +2576,7 @@ $class = 'databox filters'; ?> - - - - - + @@ -2032,7 +2587,7 @@ $class = 'databox filters'; ?> - + - + '; - html_print_radio_button('visual_format', 1, '', $visual_format_table, '', !$lapse_calc); + echo __('Table only'); + echo ''; + html_print_radio_button( + 'visual_format', + 1, + '', + $visual_format_table, + '', + !$lapse_calc + ); echo ''; - echo __('Graph only').''; - html_print_radio_button('visual_format', 2, '', $visual_format_graph, '', !$lapse_calc); + echo __('Graph only'); + echo ''; + html_print_radio_button( + 'visual_format', + 2, + '', + $visual_format_graph, + '', + !$lapse_calc + ); echo ''; - echo __('Graph and table').''; - html_print_radio_button('visual_format', 3, '', $visual_format_both, '', !$lapse_calc); + echo __('Graph and table'); + echo ''; + html_print_radio_button( + 'visual_format', + 3, + '', + $visual_format_both, + '', + !$lapse_calc + ); ?> - - - - + @@ -2103,9 +2679,19 @@ print_SLA_list('100%', $action, $idItem); print_General_list('100%', $action, $idItem, $type); echo '

'; if ($action == 'new') { - html_print_submit_button(__('Create item'), 'create_item', false, 'class="sub wand"'); + html_print_submit_button( + __('Create item'), + 'create_item', + false, + 'class="sub wand"' + ); } else { - html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"'); + html_print_submit_button( + __('Update item'), + 'edit_item', + false, + 'class="sub upd"' + ); } echo '
'; @@ -2119,12 +2705,21 @@ if ($enterpriseEnable) { reporting_enterprise_text_box(); } -// Restore db connection +// Restore db connection. if ($meta) { metaconsole_restore_db(); } +/** + * Function for return html. + * + * @param integer $width Size. + * @param string $action Type. + * @param integer $idItem Id Item. + * + * @return mixed Return html row tables for SLA. + */ function print_SLA_list($width, $action, $idItem=null) { global $config; @@ -2140,13 +2735,41 @@ function print_SLA_list($width, $action, $idItem=null) - - - - - - - + + + + + + + - + '; - echo ''; - echo ''; + echo ''; + echo ''; - if (enterprise_installed() && $report_item_type == 'SLA_services') { - enterprise_include_once('include/functions_services.php'); - $nameService = enterprise_hook('services_get_name', [$item['id_agent_module']]); - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; if ($meta) { - // Restore db connection + // Restore db connection. metaconsole_restore_db(); } } @@ -2247,20 +2885,29 @@ function print_SLA_list($width, $action, $idItem=null) '; } ?> - + - + + '.html_print_select($services, 'id_service', false, '', '', '', true, false, false).''; + echo ''; } ?> - - - - + + + @@ -2317,15 +3019,28 @@ function print_SLA_list($width, $action, $idItem=null) break; default: + // It's not possible. break; } ?>
+ + + + + + + + + + + + + +
+ +
'.printSmallFont($nameAgent).$server_name_element.''.printSmallFont($nameModule).''; + echo printSmallFont($nameAgent).$server_name_element; + echo ''; + echo printSmallFont($nameModule); + echo ''.printSmallFont($nameService).''; + if (enterprise_installed() + && $report_item_type == 'SLA_services' + ) { + enterprise_include_once( + 'include/functions_services.php' + ); + $nameService = enterprise_hook( + 'services_get_name', + [$item['id_agent_module']] + ); + echo ''; + echo printSmallFont($nameService); + echo ''; } - switch ($config['dbtype']) { - case 'mysql': - case 'postgresql': - $item_sla_min = $item['sla_min']; - $item_sla_max = $item['sla_max']; - $item_sla_limit = $item['sla_limit']; - break; + $item_sla_min = $item['sla_min']; + $item_sla_max = $item['sla_max']; + $item_sla_limit = $item['sla_limit']; - case 'oracle': - $item_sla_min = oracle_format_float_to_php($item['sla_min']); - $item_sla_max = oracle_format_float_to_php($item['sla_max']); - $item_sla_limit = oracle_format_float_to_php($item['sla_limit']); - break; - } - - echo ''.$item_sla_min.''.$item_sla_max.''.$item_sla_limit.' - '.html_print_image('images/cross.png', true).' - '; + echo $item_sla_min; + echo ''; + echo $item_sla_max; + echo ''; + echo $item_sla_limit; + echo ''; + echo ''; + echo html_print_image('images/cross.png', true); + echo ''; + echo '
- + + +
@@ -2284,32 +2931,87 @@ function print_SLA_list($width, $action, $idItem=null) ui_print_agent_autocomplete_input($params); ?> - + + '; + echo html_print_select( + $services, + 'id_service', + false, + '', + '', + '', + true, + false, + false + ); + echo ' + + + + + + - + + +
- + - - - + + + + + + + + + - - - - - + + + + + + + + + + + @@ -2398,11 +3129,12 @@ function print_General_list($width, $action, $idItem=null, $type='general') foreach ($itemsGeneral as $item) { $server_name = $item['server_name']; - // Metaconsole db connection + // Metaconsole db connection. if ($meta && $server_name != '') { - $connection = metaconsole_get_connection($server_name); + $connection = metaconsole_get_connection( + $server_name + ); if (metaconsole_load_external_db($connection) != NOERR) { - // ui_print_error_message ("Error connecting to ".$server_name); continue; } } @@ -2414,7 +3146,11 @@ function print_General_list($width, $action, $idItem=null, $type='general') ); $nameAgent = agents_get_alias($idAgent); - $nameModule = db_get_value_filter('nombre', 'tagente_modulo', ['id_agente_modulo' => $item['id_agent_module']]); + $nameModule = db_get_value_filter( + 'nombre', + 'tagente_modulo', + ['id_agente_modulo' => $item['id_agent_module']] + ); $server_name_element = ''; if ($meta && $server_name != '') { @@ -2441,14 +3177,14 @@ function print_General_list($width, $action, $idItem=null, $type='general') } if ($meta) { - // Restore db connection + // Restore db connection. metaconsole_restore_db(); } } echo ''; ?> - + @@ -2460,10 +3196,19 @@ function print_General_list($width, $action, $idItem=null, $type='general') - + + + + + - + @@ -2490,7 +3235,11 @@ function print_General_list($width, $action, $idItem=null, $type='general') - + + + + + - - +