diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 042e7eeac3..195574040e 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -258,7 +258,7 @@ if (!$new_agent && $alias != '') { $table_qr_code .= '
'.__('QR Code Agent view').'
'; $table_qr_code .= ''; if ($id_agente) { - $table_qr_code .= ""; + $table_qr_code .= ""; } // Add Custom id div. diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index c86e1bdc38..d30bc6b812 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2554,20 +2554,35 @@ function truncate_negatives(&$element) /** - * Print a pie graph with events data of agent or all agents (if id_agent = false) + * Print a pie graph with events + * data of agent or all agents (if id_agent = false). * - * @param integer id_agent Agent ID - * @param integer width pie graph width - * @param integer height pie graph height - * @param bool return or echo flag - * @param bool show_not_init flag + * @param integer $id_agent Agent ID. + * @param integer $width Pie graph width. + * @param integer $height Pie graph height. + * @param boolean $return Flag. + * @param boolean $show_not_init Flag. + * @param array $data_agents Data. + * @param boolean $donut_narrow_graph Flag type graph. + * + * @return string Html chart. */ -function graph_agent_status($id_agent=false, $width=300, $height=200, $return=false, $show_not_init=false, $data_agents=false, $donut_narrow_graph=false) -{ +function graph_agent_status( + $id_agent=false, + $width=300, + $height=200, + $return=false, + $show_not_init=false, + $data_agents=false, + $donut_narrow_graph=false +) { global $config; if ($data_agents == false) { - $groups = implode(',', array_keys(users_get_groups(false, 'AR', false))); + $groups = implode( + ',', + array_keys(users_get_groups(false, 'AR', false)) + ); $p_table = 'tagente'; $s_table = 'tagent_secondary_group'; if (is_metaconsole()) { @@ -2575,10 +2590,8 @@ function graph_agent_status($id_agent=false, $width=300, $height=200, $return=fa $s_table = 'tmetaconsole_agent_secondary_group'; } - $data = db_get_row_sql( - sprintf( - 'SELECT - SUM(critical_count) AS Critical, + $sql = sprintf( + 'SELECT SUM(critical_count) AS Critical, SUM(warning_count) AS Warning, SUM(normal_count) AS Normal, SUM(unknown_count) AS Unknown @@ -2589,19 +2602,20 @@ function graph_agent_status($id_agent=false, $width=300, $height=200, $return=fa ta.disabled = 0 AND %s (ta.id_grupo IN (%s) OR tasg.id_group IN (%s))', - $show_not_init ? ', SUM(notinit_count) "Not init"' : '', - $p_table, - $s_table, - empty($id_agent) ? '' : "ta.id_agente = $id_agent AND", - $groups, - $groups - ) + $show_not_init ? ', SUM(notinit_count) "Not init"' : '', + $p_table, + $s_table, + (empty($id_agent) === true) ? '' : 'ta.id_agente = '.$id_agent.' AND', + $groups, + $groups ); + + $data = db_get_row_sql($sql); } else { $data = $data_agents; } - if (empty($data)) { + if (empty($data) === true) { $data = []; } @@ -2610,11 +2624,15 @@ function graph_agent_status($id_agent=false, $width=300, $height=200, $return=fa if ($config['fixed_graph'] == false) { $water_mark = [ 'file' => $config['homedir'].'/images/logo_vertical_water.png', - 'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false), + 'url' => ui_get_full_url( + 'images/logo_vertical_water.png', + false, + false, + false + ), ]; } - // $colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN); $colors['Critical'] = COL_CRITICAL; $colors['Warning'] = COL_WARNING; $colors['Normal'] = COL_NORMAL; diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 6499cc876c..4b0bde1408 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -39,7 +39,6 @@ function include_javascript_dependencies_flot_graph($return=false, $mobile=false // NOTE: jquery.flot.threshold is not te original file. Is patched to allow multiple thresholds and filled area $output .= ' - @@ -79,7 +78,7 @@ function include_javascript_dependencies_flot_graph($return=false, $mobile=false percent = parseFloat(obj.series.percent).toFixed(2); alert(''+obj.series.label+': '+obj.series.data[0][1]+' ('+percent+'%)'); } - "; + "; if (!$return) { echo $output; diff --git a/pandora_console/mobile/include/ui.class.php b/pandora_console/mobile/include/ui.class.php index 87954cf96e..1992268990 100755 --- a/pandora_console/mobile/include/ui.class.php +++ b/pandora_console/mobile/include/ui.class.php @@ -779,6 +779,7 @@ class Ui echo " \n"; echo " \n"; + echo include_javascript_dependencies_flot_graph(false, false); echo "