Fixed pagination and added filter to All events
This commit is contained in:
parent
b8d8f20d64
commit
d3c3304976
|
@ -165,137 +165,8 @@ function events_get_events_grouped($sql_post, $offset = 0,
|
||||||
(SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = te.id_agentmodule) AS module_name
|
(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_agente = tasg.id_agent
|
FROM $table te LEFT JOIN tagent_secondary_group tasg ON te.id_agente = tasg.id_agent
|
||||||
WHERE 1=1 " . $sql_post . "
|
WHERE 1=1 " . $sql_post . "
|
||||||
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra . "
|
GROUP BY estado, evento, id_agente, id_agentmodule" . $groupby_extra;
|
||||||
ORDER BY ";
|
$sql .= " " . events_get_sql_order($sort_field, $order, 2);
|
||||||
|
|
||||||
if (!empty($sort_field)) {
|
|
||||||
switch ($sort_field) {
|
|
||||||
case 'event_id':
|
|
||||||
if ($order=='up')
|
|
||||||
$sql .= "id_evento" . " ASC";
|
|
||||||
if ($order=='down')
|
|
||||||
$sql .= "id_evento" . " DESC";
|
|
||||||
break;
|
|
||||||
case 'event_name':
|
|
||||||
if ($order=='up')
|
|
||||||
$sql .= "evento" . " ASC";
|
|
||||||
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";
|
|
||||||
if ($order=='down')
|
|
||||||
$sql .= "estado" . " DESC";
|
|
||||||
break;
|
|
||||||
case 'agent_id':
|
|
||||||
if ($order=='up')
|
|
||||||
$sql .= "id_agente" . " ASC";
|
|
||||||
if ($order=='down')
|
|
||||||
$sql .= "id_agente" . " DESC";
|
|
||||||
break;
|
|
||||||
case 'timestamp':
|
|
||||||
if ($order=='up')
|
|
||||||
$sql .= "timestamp_rep" . " ASC";
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$sql .= " LIMIT " . $offset . "," . $pagination;
|
$sql .= " LIMIT " . $offset . "," . $pagination;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4328,7 +4199,48 @@ function events_list_events_grouped_agents($sql) {
|
||||||
return html_print_table($table,true);
|
return html_print_table($table,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function events_get_sql_order($sort_field = "timestamp", $sort = "DESC", $group_rep = 0) {
|
||||||
|
$sort_field_translated = $sort_field;
|
||||||
|
switch ($sort_field) {
|
||||||
|
case 'event_id':
|
||||||
|
$sort_field_translated = "id_evento";
|
||||||
|
break;
|
||||||
|
case 'event_name':
|
||||||
|
$sort_field_translated = "evento";
|
||||||
|
break;
|
||||||
|
case 'status':
|
||||||
|
$sort_field_translated = "estado";
|
||||||
|
break;
|
||||||
|
case 'agent_id':
|
||||||
|
$sort_field_translated = "id_agente";
|
||||||
|
break;
|
||||||
|
case 'timestamp':
|
||||||
|
$sort_field_translated = ($group_rep == 0) ? "timestamp" : "timestamp_rep";
|
||||||
|
break;
|
||||||
|
case 'user_id':
|
||||||
|
$sort_field_translated = "id_usuario";
|
||||||
|
break;
|
||||||
|
case 'owner':
|
||||||
|
$sort_field_translated = "owner_user";
|
||||||
|
break;
|
||||||
|
case 'group_id':
|
||||||
|
$sort_field_translated = "id_grupo";
|
||||||
|
break;
|
||||||
|
case 'alert_id':
|
||||||
|
$sort_field_translated = "id_alert_am";
|
||||||
|
break;
|
||||||
|
case 'comment':
|
||||||
|
$sort_field_translated = "user_comment";
|
||||||
|
break;
|
||||||
|
case 'extra_id':
|
||||||
|
$sort_field_translated = "id_extra";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dir = ($sort == "up") ? "ASC" : "DESC";
|
||||||
|
|
||||||
|
return "ORDER BY $sort_field_translated $dir";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -2477,4 +2477,31 @@ function html_print_result_div ($text) {
|
||||||
return $enclose;
|
return $enclose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print order arrows links
|
||||||
|
*
|
||||||
|
* @param array Base tags to build url
|
||||||
|
* @param string Order key to add to URL
|
||||||
|
* @param string Value to sort ascendent
|
||||||
|
* @param string Value to sort descendent
|
||||||
|
*
|
||||||
|
* @return string HTML code to display both arrows.
|
||||||
|
*/
|
||||||
|
function html_print_sort_arrows ($params, $order_tag, $up = 'up', $down = 'down') {
|
||||||
|
// Build the queries
|
||||||
|
$params[$order_tag] = $up;
|
||||||
|
$url_up = "index.php?" . http_build_query($params, '', '&');
|
||||||
|
$params[$order_tag] = $down;
|
||||||
|
$url_down = "index.php?" . http_build_query($params, '', '&');
|
||||||
|
|
||||||
|
// Build the links
|
||||||
|
return ' ' .
|
||||||
|
'<a href="' . $url_up . '">' .
|
||||||
|
html_print_image("images/sort_up.png", true) .
|
||||||
|
'</a>' .
|
||||||
|
'<a href="' . $url_down . '">' .
|
||||||
|
html_print_image("images/sort_down.png", true) .
|
||||||
|
'</a>'
|
||||||
|
;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -81,6 +81,7 @@ switch ($status) {
|
||||||
$events_wi_cdata = db_get_all_rows_sql('SELECT id_evento,custom_data from tevento WHERE custom_data != ""');
|
$events_wi_cdata = db_get_all_rows_sql('SELECT id_evento,custom_data from tevento WHERE custom_data != ""');
|
||||||
$count_events = 0;
|
$count_events = 0;
|
||||||
$events_wi_cdata_id = 'OR id_evento IN (';
|
$events_wi_cdata_id = 'OR id_evento IN (';
|
||||||
|
if ($events_wi_cdata === false) $events_wi_cdata = array();
|
||||||
foreach ($events_wi_cdata as $key => $value) {
|
foreach ($events_wi_cdata as $key => $value) {
|
||||||
$needle = base64_decode($value['custom_data']);
|
$needle = base64_decode($value['custom_data']);
|
||||||
if (($needle != "") && ($search != "")) {
|
if (($needle != "") && ($search != "")) {
|
||||||
|
|
|
@ -20,7 +20,6 @@ require_once ($config["homedir"] . "/include/functions_ui.php");
|
||||||
$sort_field = get_parameter("sort_field", "timestamp");
|
$sort_field = get_parameter("sort_field", "timestamp");
|
||||||
$sort = get_parameter("sort", "down");
|
$sort = get_parameter("sort", "down");
|
||||||
|
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
if(!isset($table->width)) {
|
if(!isset($table->width)) {
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
@ -34,37 +33,54 @@ if(!isset($table->class)) {
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
|
||||||
|
$params = array (
|
||||||
|
// Pandora sections
|
||||||
|
"sec" => "eventos",
|
||||||
|
"sec2" => "operation/events/events",
|
||||||
|
|
||||||
|
// Events query params
|
||||||
|
"search" => io_safe_input($search),
|
||||||
|
"severity" => $severity,
|
||||||
|
"status" => $status,
|
||||||
|
"id_group" => $id_group,
|
||||||
|
"recursion" => $recursion,
|
||||||
|
"refr" => (int)get_parameter("refr", 0),
|
||||||
|
"id_agent_module" => $id_agent_module,
|
||||||
|
"pagination" => $pagination,
|
||||||
|
"group_rep" => $group_rep,
|
||||||
|
"event_view_hr" => $event_view_hr,
|
||||||
|
"id_user_ack" => $id_user_ack,
|
||||||
|
"tag_with" => $tag_with_base64,
|
||||||
|
"tag_without" => $tag_without_base64,
|
||||||
|
"filter_only_alert" => $filter_only_alert,
|
||||||
|
"offset" => $offset,
|
||||||
|
"toogle_filter" => "no",
|
||||||
|
"filter_id" => $filter_id,
|
||||||
|
"id_name" => $id_name,
|
||||||
|
"history" => (int)$history,
|
||||||
|
"section" => $section,
|
||||||
|
"open_filter" => $open_filter,
|
||||||
|
"date_from" => $date_from,
|
||||||
|
"date_to" => $date_to,
|
||||||
|
"pure" => $config["pure"],
|
||||||
|
|
||||||
|
// Display params
|
||||||
|
"offset" => $offset,
|
||||||
|
"disabled" => $disabled,
|
||||||
|
"sort" => $sort,
|
||||||
|
"sort_field" => $sort_field
|
||||||
|
);
|
||||||
|
|
||||||
if ($group_rep == 2) {
|
if ($group_rep == 2) {
|
||||||
$table->class = "databox filters data";
|
$table->class = "databox filters data";
|
||||||
$table->head[1] = __('Agent');
|
$table->head[1] = __('Agent');
|
||||||
$table->head[5] = __('More detail');
|
$table->head[5] = __('More detail');
|
||||||
|
|
||||||
$params = "search=" . io_safe_input($search) .
|
|
||||||
"&severity=" . $severity .
|
|
||||||
"&status=" . $status .
|
|
||||||
"&id_group=" . $id_group .
|
|
||||||
"&recursion=" . $recursion .
|
|
||||||
"&refr=" . (int)get_parameter("refr", 0) .
|
|
||||||
"&id_agent_module=" . $id_agent_module .
|
|
||||||
"&pagination=" . $pagination .
|
|
||||||
"&group_rep=2" .
|
|
||||||
"&event_view_hr=" . $event_view_hr .
|
|
||||||
"&id_user_ack=" . $id_user_ack .
|
|
||||||
"&tag_with=". $tag_with_base64 .
|
|
||||||
"&tag_without=" . $tag_without_base64 .
|
|
||||||
"&filter_only_alert" . $filter_only_alert .
|
|
||||||
"&offset=" . $offset .
|
|
||||||
"&toogle_filter=no" .
|
|
||||||
"&filter_id=" . $filter_id .
|
|
||||||
"&id_name=" . $id_name .
|
|
||||||
"&history=" . (int)$history .
|
|
||||||
"&section=" . $section .
|
|
||||||
"&open_filter=" . $open_filter .
|
|
||||||
"&date_from=" . $date_from .
|
|
||||||
"&date_to=" . $date_to .
|
|
||||||
"&pure=" . $config["pure"];
|
|
||||||
|
|
||||||
$url = "index.php?sec=eventos&sec2=operation/events/events&" . $params;
|
$url = html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'status')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($result as $key => $res) {
|
foreach ($result as $key => $res) {
|
||||||
|
|
||||||
if ($res['event_type'] == 'alert_fired') {
|
if ($res['event_type'] == 'alert_fired') {
|
||||||
|
@ -122,7 +138,6 @@ if ($group_rep == 2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
//fields that the user has selected to show
|
//fields that the user has selected to show
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
$show_fields = events_meta_get_custom_fields_user();
|
$show_fields = events_meta_get_custom_fields_user();
|
||||||
|
@ -133,7 +148,10 @@ else {
|
||||||
|
|
||||||
//headers
|
//headers
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$table->head[$i] = __('ID') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('ID') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'event_id')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
|
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
|
@ -144,104 +162,154 @@ else {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('estado', $show_fields)) {
|
if (in_array('estado', $show_fields)) {
|
||||||
$table->head[$i] = __('Status') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=status&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=status&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Status') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'status')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('id_evento', $show_fields)) {
|
if (in_array('id_evento', $show_fields)) {
|
||||||
$table->head[$i] = __('Event ID') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Event ID') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'event_id')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('evento', $show_fields)) {
|
if (in_array('evento', $show_fields)) {
|
||||||
$table->head[$i] = __('Event Name') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_name&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Event Name') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'event_name')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
$table->style[$i] = 'min-width: 200px; max-width: 350px; word-break: break-all;';
|
$table->style[$i] = 'min-width: 200px; max-width: 350px; word-break: break-all;';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('id_agente', $show_fields)) {
|
if (in_array('id_agente', $show_fields)) {
|
||||||
$table->head[$i] = __('Agent name') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=agent_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=agent_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Agent name') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'agent_id')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
$table->style[$i] = 'max-width: 350px; word-break: break-all;';
|
$table->style[$i] = 'max-width: 350px; word-break: break-all;';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('timestamp', $show_fields)) {
|
if (in_array('timestamp', $show_fields)) {
|
||||||
$table->head[$i] = __('Timestamp') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=timestamp&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=timestamp&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Timestamp') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'timestamp')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('id_usuario', $show_fields)) {
|
if (in_array('id_usuario', $show_fields)) {
|
||||||
$table->head[$i] = __('User') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=user_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=user_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('User') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'user_id')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('owner_user', $show_fields)) {
|
if (in_array('owner_user', $show_fields)) {
|
||||||
$table->head[$i] = __('Owner') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=owner&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=owner&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Owner') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'owner')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('id_grupo', $show_fields)) {
|
if (in_array('id_grupo', $show_fields)) {
|
||||||
$table->head[$i] = __('Group') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=group_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=group_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Group') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'group_id')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('event_type', $show_fields)) {
|
if (in_array('event_type', $show_fields)) {
|
||||||
$table->head[$i] = __('Event Type') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_type&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=event_type&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Event Type') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'event_type')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$table->style[$i] = 'min-width: 85px;';
|
$table->style[$i] = 'min-width: 85px;';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('id_agentmodule', $show_fields)) {
|
if (in_array('id_agentmodule', $show_fields)) {
|
||||||
$table->head[$i] = __('Module Name') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=module_name&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=module_name&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Module Name') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'module_name')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('id_alert_am', $show_fields)) {
|
if (in_array('id_alert_am', $show_fields)) {
|
||||||
$table->head[$i] = __('Alert') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=alert_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=alert_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Alert') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'alert_id')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array('criticity', $show_fields)) {
|
if (in_array('criticity', $show_fields)) {
|
||||||
$table->head[$i] = __('Severity') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=criticity&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=criticity&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Severity') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'criticity')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('user_comment', $show_fields)) {
|
if (in_array('user_comment', $show_fields)) {
|
||||||
$table->head[$i] = __('Comment') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=comment&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=comment&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Comment') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'comment')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('tags', $show_fields)) {
|
if (in_array('tags', $show_fields)) {
|
||||||
$table->head[$i] = __('Tags') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=tags&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=tags&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Tags') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'tags')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('source', $show_fields)) {
|
if (in_array('source', $show_fields)) {
|
||||||
$table->head[$i] = __('Source') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=source&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=source&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Source') . html_print_sort_arrows(
|
||||||
$table->align[$i] = 'left';
|
array_merge($params, array('sort_field' => 'source')),
|
||||||
|
'sort'
|
||||||
|
);$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('id_extra', $show_fields)) {
|
if (in_array('id_extra', $show_fields)) {
|
||||||
$table->head[$i] = __('Extra ID') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=extra_id&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=extra_id&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Extra ID') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'extra_id')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('ack_utimestamp', $show_fields)) {
|
if (in_array('ack_utimestamp', $show_fields)) {
|
||||||
$table->head[$i] = __('ACK Timestamp') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=ack_timestamp&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=ack_utimestamp&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('ACK Timestamp') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'ack_utimestamp')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
@ -253,14 +321,19 @@ else {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('data', $show_fields)) {
|
if (in_array('data', $show_fields)) {
|
||||||
$table->head[$i] = __('Data') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=data&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=data&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
$table->head[$i] = __('Data') . html_print_sort_arrows(
|
||||||
|
array_merge($params, array('sort_field' => 'data')),
|
||||||
|
'sort'
|
||||||
|
);
|
||||||
$table->align[$i] = 'left';
|
$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
if (in_array('module_status', $show_fields)) {
|
if (in_array('module_status', $show_fields)) {
|
||||||
$table->head[$i] = __('Module Status') . ' ' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=module_status&sort=up&disabled='.$disabled.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' . '<a href="index.php?sec=eventos&sec2=operation/events/events&offset='.$offset.'&sort_field=module_status&sort=down&disabled=$disabled">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';;
|
$table->head[$i] = __('Module Status') . html_print_sort_arrows(
|
||||||
$table->align[$i] = 'left';
|
array_merge($params, array('sort_field' => 'module_status')),
|
||||||
|
'sort'
|
||||||
|
);$table->align[$i] = 'left';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -772,7 +845,10 @@ else {
|
||||||
if (!empty ($table->data)) {
|
if (!empty ($table->data)) {
|
||||||
|
|
||||||
if ($allow_pagination) {
|
if ($allow_pagination) {
|
||||||
ui_pagination ($total_events, "index.php?sec=eventos&sec2=operation/events/events&sort_field=$sort_field&sort=$sort&disabled=$disabled", $offset, $pagination);
|
$params_to_paginate = $params;
|
||||||
|
unset($params_to_paginate['offset']);
|
||||||
|
$url_paginate = "index.php?" . http_build_query($params_to_paginate, '', '&');
|
||||||
|
ui_pagination ($total_events, $url_paginate, $offset, $pagination);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($allow_action) {
|
if ($allow_action) {
|
||||||
|
|
|
@ -29,7 +29,6 @@ enterprise_include_once('include/functions_events.php');
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
$sort_field = get_parameter("sort_field", "timestamp");
|
$sort_field = get_parameter("sort_field", "timestamp");
|
||||||
|
|
||||||
$sort_order = get_parameter("sort", "down");
|
$sort_order = get_parameter("sort", "down");
|
||||||
|
|
||||||
$event_a = check_acl ($config['id_user'], 0, "ER");
|
$event_a = check_acl ($config['id_user'], 0, "ER");
|
||||||
|
@ -743,11 +742,13 @@ echo "</div>";
|
||||||
$event_table = events_get_events_table($meta, $history);
|
$event_table = events_get_events_table($meta, $history);
|
||||||
|
|
||||||
if ($group_rep == 0) {
|
if ($group_rep == 0) {
|
||||||
$sql = "SELECT DISTINCT te.*, 1 event_rep
|
$order_sql = events_get_sql_order($sort_field, $sort_order, $group_rep);
|
||||||
|
$sql = "SELECT DISTINCT te.*, 1 event_rep,
|
||||||
|
(SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = te.id_agentmodule) AS module_name
|
||||||
FROM $event_table te LEFT JOIN tagent_secondary_group tasg
|
FROM $event_table te LEFT JOIN tagent_secondary_group tasg
|
||||||
ON te.id_agente = tasg.id_agent
|
ON te.id_agente = tasg.id_agent
|
||||||
WHERE 1=1 " . $sql_post . "
|
WHERE 1=1 " . $sql_post . "
|
||||||
ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination;
|
$order_sql LIMIT ".$offset.",".$pagination;
|
||||||
|
|
||||||
//Extract the events by filter (or not) from db
|
//Extract the events by filter (or not) from db
|
||||||
$result = db_get_all_rows_sql ($sql);
|
$result = db_get_all_rows_sql ($sql);
|
||||||
|
|
Loading…
Reference in New Issue