diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 3a4b5eeebf..e8955d2c81 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -161,7 +161,8 @@ function events_get_events_grouped($sql_post, $offset = 0,
(SELECT id_usuario FROM $table WHERE id_evento = MAX(te.id_evento)) id_usuario,
(SELECT id_agente FROM $table WHERE id_evento = MAX(te.id_evento)) id_agente,
(SELECT criticity FROM $table WHERE id_evento = MAX(te.id_evento)) AS criticity,
- (SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp
+ (SELECT ack_utimestamp FROM $table WHERE id_evento = MAX(te.id_evento)) AS ack_utimestamp,
+ (SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = te.id_agentmodule) AS module_name
FROM $table te LEFT JOIN tagent_secondary_group tasg ON te.id_grupo = tasg.id_group
WHERE 1=1 " . $sql_post . "
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra . "
@@ -181,6 +182,12 @@ function events_get_events_grouped($sql_post, $offset = 0,
if ($order=='down')
$sql .= "evento" . " DESC";
break;
+ case 'event_id':
+ if ($order=='up')
+ $sql .= "id_evento" . " ASC";
+ if ($order=='down')
+ $sql .= "id_evento" . " DESC";
+ break;
case 'status':
if ($order=='up')
$sql .= "estado" . " ASC";
@@ -199,6 +206,90 @@ function events_get_events_grouped($sql_post, $offset = 0,
if ($order=='down')
$sql .= "timestamp_rep" . " DESC";
break;
+ case 'user_id':
+ if ($order=='up')
+ $sql .= "id_usuario" . " ASC";
+ if ($order=='down')
+ $sql .= "id_usuario" . " DESC";
+ break;
+ case 'owner':
+ if ($order=='up')
+ $sql .= "owner_user" . " ASC";
+ if ($order=='down')
+ $sql .= "owner_user" . " DESC";
+ break;
+ case 'group_id':
+ if ($order=='up')
+ $sql .= "id_grupo" . " ASC";
+ if ($order=='down')
+ $sql .= "id_grupo" . " DESC";
+ break;
+ case 'module_name':
+ if ($order=='up')
+ $sql .= "module_name" . " ASC";
+ if ($order=='down')
+ $sql .= "module_name" . " DESC";
+ break;
+ case 'event_type':
+ if ($order=='up')
+ $sql .= "event_type" . " ASC";
+ if ($order=='down')
+ $sql .= "event_type" . " DESC";
+ break;
+ case 'alert_id':
+ if ($order=='up')
+ $sql .= "id_alert_am" . " ASC";
+ if ($order=='down')
+ $sql .= "id_alert_am" . " DESC";
+ break;
+ case 'criticity':
+ if ($order=='up')
+ $sql .= "criticity" . " ASC";
+ if ($order=='down')
+ $sql .= "criticity" . " DESC";
+ break;
+ case 'comment':
+ if ($order=='up')
+ $sql .= "user_comment" . " ASC";
+ if ($order=='down')
+ $sql .= "user_comment" . " DESC";
+ break;
+ case 'tags':
+ if ($order=='up')
+ $sql .= "tags" . " ASC";
+ if ($order=='down')
+ $sql .= "tags" . " DESC";
+ break;
+ case 'source':
+ if ($order=='up')
+ $sql .= "source" . " ASC";
+ if ($order=='down')
+ $sql .= "source" . " DESC";
+ break;
+ case 'extra_id':
+ if ($order=='up')
+ $sql .= "id_extra" . " ASC";
+ if ($order=='down')
+ $sql .= "id_extra" . " DESC";
+ break;
+ case 'ack_timestamp':
+ if ($order=='up')
+ $sql .= "ack_utimestamp" . " ASC";
+ if ($order=='down')
+ $sql .= "ack_utimestamp" . " DESC";
+ break;
+ case 'data':
+ if ($order=='up')
+ $sql .= "data" . " ASC";
+ if ($order=='down')
+ $sql .= "data" . " DESC";
+ break;
+ case 'module_status':
+ if ($order=='up')
+ $sql .= "module_status" . " ASC";
+ if ($order=='down')
+ $sql .= "module_status" . " DESC";
+ break;
default:
$sql .= "timestamp_rep" . " DESC";
}
diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php
index 55e6e748ef..ff2c030e80 100644
--- a/pandora_console/operation/events/events.build_table.php
+++ b/pandora_console/operation/events/events.build_table.php
@@ -17,6 +17,9 @@ global $config;
require_once ($config["homedir"] . "/include/functions_ui.php");
+$sort_field = get_parameter("sort_field", "timestamp");
+$sort = get_parameter("sort", "down");
+
$table = new stdClass();
if(!isset($table->width)) {
@@ -130,7 +133,7 @@ else {
//headers
$i = 0;
- $table->head[$i] = __('ID') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
+ $table->head[$i] = __('ID') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
@@ -141,104 +144,104 @@ else {
$i++;
}
if (in_array('estado', $show_fields)) {
- $table->head[$i] = __('Status') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
+ $table->head[$i] = __('Status') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('id_evento', $show_fields)) {
- $table->head[$i] = __('Event ID');
+ $table->head[$i] = __('Event ID') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('evento', $show_fields)) {
- $table->head[$i] = __('Event Name') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
+ $table->head[$i] = __('Event Name') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$table->style[$i] = 'min-width: 200px; max-width: 350px; word-break: break-all;';
$i++;
}
if (in_array('id_agente', $show_fields)) {
- $table->head[$i] = __('Agent name') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
+ $table->head[$i] = __('Agent name') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$table->style[$i] = 'max-width: 350px; word-break: break-all;';
$i++;
}
if (in_array('timestamp', $show_fields)) {
- $table->head[$i] = __('Timestamp') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
+ $table->head[$i] = __('Timestamp') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('id_usuario', $show_fields)) {
- $table->head[$i] = __('User');
+ $table->head[$i] = __('User') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('owner_user', $show_fields)) {
- $table->head[$i] = __('Owner');
+ $table->head[$i] = __('Owner') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('id_grupo', $show_fields)) {
- $table->head[$i] = __('Group');
+ $table->head[$i] = __('Group') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('event_type', $show_fields)) {
- $table->head[$i] = __('Event Type');
+ $table->head[$i] = __('Event Type') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$table->style[$i] = 'min-width: 85px;';
$i++;
}
if (in_array('id_agentmodule', $show_fields)) {
- $table->head[$i] = __('Module Name');
+ $table->head[$i] = __('Module Name') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('id_alert_am', $show_fields)) {
- $table->head[$i] = __('Alert');
+ $table->head[$i] = __('Alert') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('criticity', $show_fields)) {
- $table->head[$i] = __('Severity');
+ $table->head[$i] = __('Severity') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('user_comment', $show_fields)) {
- $table->head[$i] = __('Comment');
+ $table->head[$i] = __('Comment') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('tags', $show_fields)) {
- $table->head[$i] = __('Tags');
+ $table->head[$i] = __('Tags') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('source', $show_fields)) {
- $table->head[$i] = __('Source');
+ $table->head[$i] = __('Source') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('id_extra', $show_fields)) {
- $table->head[$i] = __('Extra ID');
+ $table->head[$i] = __('Extra ID') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('ack_utimestamp', $show_fields)) {
- $table->head[$i] = __('ACK Timestamp');
+ $table->head[$i] = __('ACK Timestamp') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
@@ -250,13 +253,13 @@ else {
$i++;
}
if (in_array('data', $show_fields)) {
- $table->head[$i] = __('Data');
+ $table->head[$i] = __('Data') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';
$table->align[$i] = 'left';
$i++;
}
if (in_array('module_status', $show_fields)) {
- $table->head[$i] = __('Module Status');
+ $table->head[$i] = __('Module Status') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '';;
$table->align[$i] = 'left';
$i++;
@@ -769,7 +772,7 @@ else {
if (!empty ($table->data)) {
if ($allow_pagination) {
- ui_pagination ($total_events, $url, $offset, $pagination);
+ ui_pagination ($total_events, "index.php?sec=eventos&sec2=operation/events/events&sort_field=$sort_field&sort=$sort&disabled=$disabled", $offset, $pagination);
}
if ($allow_action) {