".$lang_label["ag_title"]." > ".$lang_label["alert_listing"].""; } $query_gen='SELECT talerta_agente_modulo.* FROM talerta_agente_modulo, tagente_modulo WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente ='.$id_agente; $result_gen=mysql_query($query_gen); if (mysql_num_rows ($result_gen)) { if (!isset($_GET["tab"])) { echo "

".$lang_label["alert_listing"]."

"; } echo ""; echo ""; $color=1; while ($data=mysql_fetch_array($result_gen)){ if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } echo ""; show_alert_show_view ($data, $tdcolor, 0); } // Show combined alerts for this agent $result_com = mysql_query("SELECT * FROM talerta_agente_modulo WHERE id_agent = $id_agente"); if (mysql_num_rows ($result_com)) { echo ""; show_alert_show_view ($data_com, $tdcolor, 1); } echo '
".$lang_label["type"]."".$lang_label["name"]." ".$lang_label["description"]." ".lang_string ("info")." ".$lang_label["min."]." ".$lang_label["max."]." ".$lang_label["time_threshold"]." ".$lang_label["last_fired"]." ".$lang_label["times_fired"]." ".$lang_label["status"]." ".$lang_label["validate"]."
".lang_string("Combined alerts")."
"; } while ($data_com=mysql_fetch_array($result_com)){ if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } echo "
'; } else { echo "
".$lang_label["no_alerts"]."
"; } // Show alert for no defined agent } else { // ------------------------------- // SHOW ALL ALERTS (GENERAL PAGE) // ------------------------------- echo "

".$lang_label["ag_title"]." > "; echo $lang_label["alert_listing"]."

"; $iduser_temp=$_SESSION['id_usuario']; $ag_group = get_parameter ("ag_group", -1); if ($ag_group != -1) echo "
"; else echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; // Display single alerts // ======================= if ($ag_group > 1) $sql='SELECT id_agente, nombre, disabled FROM tagente WHERE id_grupo='.$ag_group.' ORDER BY nombre'; else $sql='SELECT id_agente, nombre, disabled FROM tagente ORDER BY id_grupo, nombre'; $sql = "SELECT id_agente, nombre, disabled FROM tagente WHERE tagente.disabled = 0 "; // Agent group selector if ($ag_group > 1) $sql .=" AND tagente.id_grupo = ".$ag_group; else { // User has explicit permission on group 1 ? $all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."' AND id_grupo = 1"); if ($all_group == 0) $sql .=" AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."')"; } $color=1; $string = ''; $result=mysql_query($sql); if ($result) while ($row=mysql_fetch_array($result)){ //while there are agents $id_agente = $row['id_agente']; $nombre_agente = strtoupper($row["nombre"]); $query_gen='SELECT talerta_agente_modulo.id_alerta, talerta_agente_modulo.descripcion, talerta_agente_modulo.last_fired, talerta_agente_modulo.times_fired, talerta_agente_modulo.id_agente_modulo, tagente_modulo.id_agente_modulo FROM tagente_modulo, talerta_agente_modulo WHERE tagente_modulo.id_agente = '.$id_agente.' AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.disable = 0 '; $result_gen=mysql_query($query_gen); while ($data=mysql_fetch_array($result_gen)){ if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } $string .= ""; $string=$string.""; if ($data["last_fired"] == "0000-00-00 00:00:00") { $string=$string.""; } else { $string=$string.""; } $string=$string.""; } } //end while // Display combined alerts // ======================= $sql = "SELECT id_agente, nombre, disabled FROM tagente WHERE tagente.disabled = 0 "; // Agent group selector if ($ag_group > 1) $sql .=" AND tagente.id_grupo = ".$ag_group; else { // User has explicit permission on group 1 ? $all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."' AND id_grupo = 1"); if ($all_group == 0) $sql .=" AND tagente.id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='".$config["id_user"]."')"; } $result=mysql_query($sql); $color=1; if ($result) while ($row=mysql_fetch_array($result)){ //while there are agents $id_agente = $row['id_agente']; $nombre_agente = strtoupper($row["nombre"]); $query_gen='SELECT talerta_agente_modulo.id_alerta, talerta_agente_modulo.descripcion, talerta_agente_modulo.last_fired, talerta_agente_modulo.times_fired, talerta_agente_modulo.id_agent FROM talerta_agente_modulo WHERE talerta_agente_modulo.id_agent = '.$id_agente.' AND talerta_agente_modulo.disable = 0 '; $result_gen=mysql_query($query_gen); if (mysql_num_rows ($result_gen)) { while ($data=mysql_fetch_array($result_gen)){ if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } if (!isset($string)) { $string=''; } $string = $string.""; $string=$string.""; if ($data["last_fired"] == "0000-00-00 00:00:00") { $string=$string.""; } else { $string=$string.""; } $string=$string.""; } } } //end while if ($string != "") { echo ""; echo "
".$lang_label["group"].""; echo "
".$nombre_agente.""; $string .= ""; if ($data["times_fired"] <> 0) $string .= ""; else $string .= ""; $string = $string."" .dame_nombre_alerta($data["id_alerta"])."". $data["descripcion"]."". $lang_label["never"]."". human_time_comparation($data["last_fired"])."". $data["times_fired"]."
".$nombre_agente." (*)"; $string .= ""; if ($data["times_fired"] <> 0) $string .= ""; else $string .= ""; $string = $string."" .dame_nombre_alerta($data["id_alerta"])."". $data["descripcion"]."". $lang_label["never"]."". human_time_comparation($data["last_fired"])."". $data["times_fired"].""; echo " ".$lang_label["fired"].""; echo " ".$lang_label["not_fired"]; echo "(*) ".lang_string("Combined alert")."
"; echo "
"; echo ""; echo ""; echo $string; //built table of alerts echo "
".$lang_label["agent"]." ".$lang_label["status"]." ".$lang_label["type"]." ".$lang_label["description"]." ".$lang_label["last_fired"]." ".$lang_label["times_fired"]."
"; } else { echo "
". $lang_label["no_alert"]."
"; } } // Main alert view ?>