From 03f0c47bc2b15d0ea242d1dd8ec2c4e185379f48 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 18 Oct 2017 11:15:51 +0200 Subject: [PATCH] fixed icon with planned downtime --- .../godmode/agentes/modificar_agente.php | 15 ++++++---- .../operation/agentes/estado_agente.php | 22 ++++++++++++-- .../agentes/estado_generalagente.php | 7 ++++- .../operation/search_agents.getdata.php | 2 +- pandora_console/operation/search_agents.php | 30 ++++++++++++++----- 5 files changed, 58 insertions(+), 18 deletions(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 3c5406c46c..3dc4d7eed5 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -540,10 +540,6 @@ if ($agents !== false) { } echo ''; echo ""; - if ($agent['quiet']) { - html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); - echo " "; - } if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { $main_tab = 'main'; @@ -562,8 +558,10 @@ if ($agents !== false) { ""; echo ""; - $in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"])); - + $in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime + INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime + WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . ' AND tplanned_downtime.executed = 1'); + if ($agent["disabled"]) { ui_print_help_tip(__('Disabled')); @@ -571,6 +569,11 @@ if ($agents !== false) { echo ""; } } + + if ($agent['quiet']) { + echo " "; + html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); + } if ($in_planned_downtime) { ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png'); diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 151ae893ec..a458e308b3 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -597,22 +597,38 @@ foreach ($agents as $agent) { $agent["warning_count"], $agent["unknown_count"], $agent["total_count"], $agent["notinit_count"]); + $in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime + INNER JOIN tplanned_downtime_agents + ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime + WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . + ' AND tplanned_downtime.executed = 1'); + $data = array (); $data[0] = '
'; $data[0] .= ''; - if ($agent['quiet']) { - $data[0] .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . " "; - } $data[0] .= ' '.$agent["alias"].''; $data[0] .= ''; + + if ($agent['quiet']) { + $data[0] .= " "; + $data[0] .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")); + } + + if ($in_planned_downtime) { + $data[0] .= ui_print_help_tip (__('Agent in planned downtime'), true, 'images/minireloj-16.png'); + $data[0] .= ""; + } + $data[0] .= '
'; $data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[…]', 'font-size: 6.5pt'); diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 80a891b38e..78f3dd06a4 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -74,7 +74,12 @@ $table_agent->data = array(); $data = array(); $agent_name = ui_print_agent_name($agent["id_agente"], true, 500, "font-size: medium;font-weight:bold", true); -$in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"])); +$in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime + INNER JOIN tplanned_downtime_agents + ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime + WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . + ' AND tplanned_downtime.executed = 1'); + if ($agent['disabled']) { if ($in_planned_downtime) { diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index d605cbaad8..60c7f87ad4 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -168,7 +168,7 @@ if ($searchAgents) { ) "; - $select = "SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias"; + $select = "SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled, t1.alias, t1.quiet"; if ($only_count) { $limit = " ORDER BY " . $order['field'] . " " . $order['order'] . " LIMIT " . $config["block_size"] . " OFFSET 0"; diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php index 5720730787..3282deaa70 100755 --- a/pandora_console/operation/search_agents.php +++ b/pandora_console/operation/search_agents.php @@ -70,13 +70,13 @@ else { $table->align = array (); $table->align[0] = "left"; - $table->align[1] = "center"; - $table->align[2] = "center"; - $table->align[3] = "center"; - $table->align[4] = "center"; - $table->align[5] = "center"; - $table->align[6] = "center"; - $table->align[7] = "right"; + $table->align[1] = "left"; + $table->align[2] = "left"; + $table->align[3] = "left"; + $table->align[4] = "left"; + $table->align[5] = "left"; + $table->align[6] = "left"; + $table->align[7] = "left"; $table->align[8] = "center"; $table->data = array (); @@ -95,6 +95,22 @@ else { ''.$agent["alias"].''; } + if ($agent['quiet']) { + $cellName .= " "; + $cellName .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")); + } + + $in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime + INNER JOIN tplanned_downtime_agents + ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime + WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . + ' AND tplanned_downtime.executed = 1'); + + if ($in_planned_downtime) { + $cellName .= "".ui_print_help_tip (__('Agent in planned downtime'), true, 'images/minireloj-16.png'); + $cellName .= ""; + } + $last_time = strtotime ($agent["ultimo_contacto"]); $now = time (); $diferencia = $now - $last_time;