2013-01-28 14:14:27 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2015-06-30 17:05:58 +02:00
|
|
|
$table = new stdClass();
|
2013-06-11 17:51:28 +02:00
|
|
|
if(!isset($table->width)) {
|
|
|
|
$table->width = '100%';
|
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
$table->id = "eventtable";
|
|
|
|
$table->cellpadding = 4;
|
|
|
|
$table->cellspacing = 4;
|
2013-05-20 10:42:02 +02:00
|
|
|
if(!isset($table->class)) {
|
2015-07-01 11:27:37 +02:00
|
|
|
$table->class = "databox data";
|
2013-05-20 10:42:02 +02:00
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
$table->head = array ();
|
|
|
|
$table->data = array ();
|
|
|
|
|
|
|
|
//fields that the user has selected to show
|
2013-04-29 16:09:01 +02:00
|
|
|
if ($meta) {
|
|
|
|
$show_fields = events_meta_get_custom_fields_user();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$show_fields = explode (',', $config['event_fields']);
|
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
|
|
|
|
//headers
|
|
|
|
$i = 0;
|
|
|
|
$table->head[$i] = __('ID');
|
2015-06-12 15:50:46 +02:00
|
|
|
|
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
if (in_array('server_name', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Server');
|
2013-05-30 17:48:22 +02:00
|
|
|
$table->align[$i] = 'left';
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('estado', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Status');
|
|
|
|
$table->align[$i] = 'center';
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('id_evento', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Event ID');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('evento', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Event Name');
|
2013-03-06 18:53:17 +01:00
|
|
|
$table->align[$i] = 'left';
|
2013-06-10 18:15:36 +02:00
|
|
|
$table->style[$i] = 'min-width: 200px; max-width: 350px; word-break: break-all;';
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('id_agente', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Agent name');
|
2013-05-30 17:48:22 +02:00
|
|
|
$table->align[$i] = 'left';
|
2013-05-29 15:11:40 +02:00
|
|
|
$table->style[$i] = 'max-width: 350px; word-break: break-all;';
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('timestamp', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Timestamp');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('id_usuario', $show_fields)) {
|
|
|
|
$table->head[$i] = __('User');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('owner_user', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Owner');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('id_grupo', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Group');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('event_type', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Event type');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-06-10 18:15:36 +02:00
|
|
|
$table->style[$i] = 'min-width: 85px;';
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('id_agentmodule', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Agent Module');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('id_alert_am', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Alert');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('criticity', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Severity');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('user_comment', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Comment');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('tags', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Tags');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('source', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Source');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('id_extra', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Extra ID');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('ack_utimestamp', $show_fields)) {
|
|
|
|
$table->head[$i] = __('ACK Timestamp');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
2013-03-06 18:53:17 +01:00
|
|
|
if (in_array('instructions', $show_fields)) {
|
|
|
|
$table->head[$i] = __('Instructions');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
2013-03-06 18:53:17 +01:00
|
|
|
$i++;
|
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
if ($i != 0 && $allow_action) {
|
|
|
|
$table->head[$i] = __('Action');
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
|
|
|
|
|
|
|
$table->size[$i] = '90px';
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
2013-06-13 17:03:07 +02:00
|
|
|
if (check_acl ($config["id_user"], 0, "EW") == 1 && !$readonly) {
|
2013-01-28 14:14:27 +01:00
|
|
|
$table->head[$i] = html_print_checkbox ("all_validate_box", "1", false, true);
|
2015-06-12 15:50:46 +02:00
|
|
|
$table->align[$i] = 'left';
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-05 16:23:27 +02:00
|
|
|
if ($meta) {
|
2013-01-28 14:14:27 +01:00
|
|
|
// Get info of the all servers to use it on hash auth
|
|
|
|
$servers_url_hash = metaconsole_get_servers_url_hash();
|
|
|
|
$servers = metaconsole_get_servers();
|
|
|
|
}
|
|
|
|
|
2015-03-12 12:18:01 +01:00
|
|
|
$show_delete_button = false;
|
|
|
|
$show_validate_button = false;
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$idx = 0;
|
|
|
|
//Arrange data. We already did ACL's in the query
|
|
|
|
foreach ($result as $event) {
|
|
|
|
$data = array ();
|
|
|
|
|
2013-02-25 17:21:11 +01:00
|
|
|
if ($meta) {
|
2013-01-28 14:14:27 +01:00
|
|
|
$event['server_url_hash'] = $servers_url_hash[$event['server_id']];
|
|
|
|
$event['server_url'] = $servers[$event['server_id']]['server_url'];
|
|
|
|
$event['server_name'] = $servers[$event['server_id']]['server_name'];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clean url from events and store in array
|
|
|
|
$event['clean_tags'] = events_clean_tags($event['tags']);
|
2013-02-25 17:21:11 +01:00
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
//First pass along the class of this row
|
|
|
|
$myclass = get_priority_class ($event["criticity"]);
|
|
|
|
|
|
|
|
//print status
|
|
|
|
$estado = $event["estado"];
|
|
|
|
|
|
|
|
// Colored box
|
|
|
|
switch($estado) {
|
2013-08-05 16:23:27 +02:00
|
|
|
case EVENT_NEW:
|
2013-01-28 14:14:27 +01:00
|
|
|
$img_st = "images/star.png";
|
|
|
|
$title_st = __('New event');
|
|
|
|
break;
|
2013-08-05 16:23:27 +02:00
|
|
|
case EVENT_VALIDATE:
|
2013-01-28 14:14:27 +01:00
|
|
|
$img_st = "images/tick.png";
|
|
|
|
$title_st = __('Event validated');
|
|
|
|
break;
|
2013-08-05 16:23:27 +02:00
|
|
|
case EVENT_PROCESS:
|
2013-01-28 14:14:27 +01:00
|
|
|
$img_st = "images/hourglass.png";
|
|
|
|
$title_st = __('Event in process');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
$data[$i] = "#".$event["id_evento"];
|
2013-05-30 17:48:22 +02:00
|
|
|
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3; color: #111 !important;';
|
2013-08-05 16:23:27 +02:00
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
// Pass grouped values in hidden fields to use it from modal window
|
2013-03-20 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/include/ui.class.php,
mobile/index.php: added first version of events section.
* include/functions_incidents.php, include/functions_users.php,
include/functions.php, include/functions_groups.php,
include/functions_events.php, include/functions_html.php,
operation/events/events.build_table.php,
operation/events/events.build_query.php,
operation/events/events_list.php: some changes for interact with
mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7872 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-20 13:29:33 +01:00
|
|
|
if ($group_rep) {
|
2013-01-28 14:14:27 +01:00
|
|
|
$similar_ids = $event['similar_ids'];
|
|
|
|
$timestamp_first = $event['timestamp_rep_min'];
|
|
|
|
$timestamp_last = $event['timestamp_rep'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$similar_ids = $event["id_evento"];
|
|
|
|
$timestamp_first = $event['utimestamp'];
|
|
|
|
$timestamp_last = $event['utimestamp'];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Store group data to show in extended view
|
|
|
|
$data[$i] .= html_print_input_hidden('similar_ids_' . $event["id_evento"], $similar_ids, true);
|
|
|
|
$data[$i] .= html_print_input_hidden('timestamp_first_' . $event["id_evento"], $timestamp_first, true);
|
|
|
|
$data[$i] .= html_print_input_hidden('timestamp_last_' . $event["id_evento"], $timestamp_last, true);
|
2014-11-18 11:27:04 +01:00
|
|
|
$data[$i] .= html_print_input_hidden('childrens_ids', json_encode($childrens_ids), true);
|
2013-02-25 17:21:11 +01:00
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
// Store server id if is metaconsole. 0 otherwise
|
2013-02-25 17:21:11 +01:00
|
|
|
if ($meta) {
|
2013-01-28 14:14:27 +01:00
|
|
|
$server_id = $event['server_id'];
|
|
|
|
|
|
|
|
// If meta activated, propagate the id of the event on node (source id)
|
|
|
|
$data[$i] .= html_print_input_hidden('source_id_' . $event["id_evento"], $event['id_source_event'], true);
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-02-25 17:21:11 +01:00
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
else {
|
|
|
|
$server_id = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[$i] .= html_print_input_hidden('server_id_' . $event["id_evento"], $server_id, true);
|
2013-02-25 17:21:11 +01:00
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
if (empty($event['event_rep'])) {
|
|
|
|
$event['event_rep'] = 0;
|
|
|
|
}
|
|
|
|
$data[$i] .= html_print_input_hidden('event_rep_'.$event["id_evento"], $event['event_rep'], true);
|
|
|
|
// Store concat comments to show in extended view
|
|
|
|
$data[$i] .= html_print_input_hidden('user_comment_'.$event["id_evento"], base64_encode($event['user_comment']), true);
|
|
|
|
|
|
|
|
$i++;
|
|
|
|
|
|
|
|
if (in_array('server_name',$show_fields)) {
|
2013-03-20 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/include/ui.class.php,
mobile/index.php: added first version of events section.
* include/functions_incidents.php, include/functions_users.php,
include/functions.php, include/functions_groups.php,
include/functions_events.php, include/functions_html.php,
operation/events/events.build_table.php,
operation/events/events.build_query.php,
operation/events/events_list.php: some changes for interact with
mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7872 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-20 13:29:33 +01:00
|
|
|
if ($meta) {
|
2013-06-06 15:54:39 +02:00
|
|
|
if (can_user_access_node ()) {
|
|
|
|
$data[$i] = "<a href='" . $event["server_url"] . "/index.php?sec=estado&sec2=operation/agentes/group_view" . $event['server_url_hash'] . "'>" . $event["server_name"] . "</a>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] = $event["server_name"];
|
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] = db_get_value('name','tserver');
|
|
|
|
}
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('estado',$show_fields)) {
|
|
|
|
$data[$i] = html_print_image ($img_st, true,
|
|
|
|
array ("class" => "image_status",
|
|
|
|
"title" => $title_st,
|
|
|
|
"id" => 'status_img_'.$event["id_evento"]));
|
2013-05-30 17:48:22 +02:00
|
|
|
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;';
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if (in_array('id_evento',$show_fields)) {
|
|
|
|
$data[$i] = $event["id_evento"];
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($event["criticity"]) {
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
$img_sev = "images/status_sets/default/severity_maintenance.png";
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
$img_sev = "images/status_sets/default/severity_informational.png";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$img_sev = "images/status_sets/default/severity_normal.png";
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$img_sev = "images/status_sets/default/severity_warning.png";
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
$img_sev = "images/status_sets/default/severity_critical.png";
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
$img_sev = "images/status_sets/default/severity_minor.png";
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
$img_sev = "images/status_sets/default/severity_major.png";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('evento', $show_fields)) {
|
|
|
|
// Event description
|
|
|
|
$data[$i] = '<span title="'.$event["evento"].'" class="f9">';
|
|
|
|
if($allow_action) {
|
|
|
|
$data[$i] .= '<a href="javascript:" onclick="show_event_dialog(' . $event["id_evento"] . ', '.$group_rep.');">';
|
|
|
|
}
|
|
|
|
$data[$i] .= '<span class="'.$myclass.'" style="font-size: 7.5pt;">' . ui_print_truncate_text (io_safe_output($event["evento"]), 160) . '</span>';
|
|
|
|
if($allow_action) {
|
|
|
|
$data[$i] .= '</a>';
|
|
|
|
}
|
|
|
|
$data[$i] .= '</span>';
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('id_agente', $show_fields)) {
|
|
|
|
$data[$i] = '<span class="'.$myclass.'">';
|
|
|
|
|
|
|
|
if ($event["id_agente"] > 0) {
|
|
|
|
// Agent name
|
2013-03-20 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/include/ui.class.php,
mobile/index.php: added first version of events section.
* include/functions_incidents.php, include/functions_users.php,
include/functions.php, include/functions_groups.php,
include/functions_events.php, include/functions_html.php,
operation/events/events.build_table.php,
operation/events/events.build_query.php,
operation/events/events_list.php: some changes for interact with
mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7872 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-20 13:29:33 +01:00
|
|
|
if ($meta) {
|
2013-05-30 17:48:22 +02:00
|
|
|
$agent_link = '<a href="'.$event["server_url"].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $event["id_agente"] . $event["server_url_hash"] . '">';
|
|
|
|
if (can_user_access_node ()) {
|
|
|
|
$data[$i] = '<b>' . $agent_link . $event["agent_name"] . '</a></b>';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] = $event["agent_name"];
|
|
|
|
}
|
2013-01-30 14:53:02 +01:00
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
else {
|
|
|
|
$data[$i] .= ui_print_agent_name ($event["id_agente"], true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] .= '';
|
|
|
|
}
|
|
|
|
$data[$i] .= '</span>';
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('timestamp', $show_fields)) {
|
|
|
|
//Time
|
|
|
|
$data[$i] = '<span class="'.$myclass.'">';
|
|
|
|
if ($group_rep == 1) {
|
|
|
|
$data[$i] .= ui_print_timestamp ($event['timestamp_rep'], true);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] .= ui_print_timestamp ($event["timestamp"], true);
|
|
|
|
}
|
|
|
|
$data[$i] .= '</span>';
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('id_usuario',$show_fields)) {
|
|
|
|
$user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']);
|
2013-03-07 10:46:35 +01:00
|
|
|
if(empty($user_name)) {
|
|
|
|
$user_name = $event['id_usuario'];
|
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
$data[$i] = $user_name;
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
2013-03-07 10:46:35 +01:00
|
|
|
if (in_array('owner_user',$show_fields)) {
|
|
|
|
$owner_name = db_get_value('fullname', 'tusuario', 'id_user', $event['owner_user']);
|
|
|
|
if(empty($owner_name)) {
|
|
|
|
$owner_name = $event['owner_user'];
|
|
|
|
}
|
|
|
|
$data[$i] = $owner_name;
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-03-07 10:46:35 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
if (in_array('id_grupo',$show_fields)) {
|
2013-03-20 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/include/ui.class.php,
mobile/index.php: added first version of events section.
* include/functions_incidents.php, include/functions_users.php,
include/functions.php, include/functions_groups.php,
include/functions_events.php, include/functions_html.php,
operation/events/events.build_table.php,
operation/events/events.build_query.php,
operation/events/events_list.php: some changes for interact with
mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7872 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-20 13:29:33 +01:00
|
|
|
if ($meta) {
|
2013-01-28 14:14:27 +01:00
|
|
|
$data[$i] = $event['group_name'];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$id_group = $event["id_grupo"];
|
|
|
|
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
|
|
|
if ($id_group == 0) {
|
|
|
|
$group_name = __('All');
|
|
|
|
}
|
|
|
|
$data[$i] = $group_name;
|
|
|
|
}
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('event_type',$show_fields)) {
|
|
|
|
$data[$i] = events_print_type_description($event["event_type"], true);
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('id_agentmodule',$show_fields)) {
|
2013-03-20 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/include/ui.class.php,
mobile/index.php: added first version of events section.
* include/functions_incidents.php, include/functions_users.php,
include/functions.php, include/functions_groups.php,
include/functions_events.php, include/functions_html.php,
operation/events/events.build_table.php,
operation/events/events.build_query.php,
operation/events/events_list.php: some changes for interact with
mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7872 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-20 13:29:33 +01:00
|
|
|
if ($meta) {
|
2013-05-30 17:48:22 +02:00
|
|
|
$module_link = '<a href="'.$event["server_url"].'/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $event["id_agente"] . $event["server_url_hash"] . '">';
|
|
|
|
if (can_user_access_node ()) {
|
|
|
|
$data[$i] = '<b>' . $module_link . $event["module_name"] . '</a></b>';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] = $event["module_name"];
|
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-11-12 16:04:46 +01:00
|
|
|
$module_name = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $event["id_agentmodule"]);
|
|
|
|
$data[$i] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&status_text_monitor=' . io_safe_output($module_name) . '#monitors">'
|
|
|
|
. $module_name . '</a>';
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('id_alert_am',$show_fields)) {
|
|
|
|
if($meta) {
|
|
|
|
$data[$i] = $event["alert_template_name"];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($event["id_alert_am"] != 0) {
|
|
|
|
$sql = 'SELECT name
|
|
|
|
FROM talert_templates
|
|
|
|
WHERE id IN (SELECT id_alert_template
|
2013-03-20 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/include/ui.class.php,
mobile/index.php: added first version of events section.
* include/functions_incidents.php, include/functions_users.php,
include/functions.php, include/functions_groups.php,
include/functions_events.php, include/functions_html.php,
operation/events/events.build_table.php,
operation/events/events.build_query.php,
operation/events/events_list.php: some changes for interact with
mobile version.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7872 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-20 13:29:33 +01:00
|
|
|
FROM talert_template_modules
|
|
|
|
WHERE id = ' . $event["id_alert_am"] . ');';
|
2013-01-28 14:14:27 +01:00
|
|
|
|
|
|
|
$templateName = db_get_sql($sql);
|
|
|
|
$data[$i] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$event["id_agente"].'&tab=alert">'.$templateName.'</a>';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] = '';
|
|
|
|
}
|
|
|
|
}
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('criticity',$show_fields)) {
|
|
|
|
$data[$i] = get_priority_name ($event["criticity"]);
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('user_comment',$show_fields)) {
|
2014-10-02 18:38:14 +02:00
|
|
|
$safe_event_user_comment = strip_tags(io_safe_output($event["user_comment"]));
|
2014-10-02 19:37:18 +02:00
|
|
|
$line_breaks = array("\r\n", "\n", "\r");
|
|
|
|
$safe_event_user_comment = str_replace($line_breaks, '<br>', $safe_event_user_comment);
|
2014-10-02 18:38:14 +02:00
|
|
|
$event_user_comments = json_decode($safe_event_user_comment, true);
|
|
|
|
$event_user_comment_str = "";
|
2014-10-02 19:37:18 +02:00
|
|
|
|
2014-10-02 18:38:14 +02:00
|
|
|
if (!empty($event_user_comments)) {
|
|
|
|
$last_key = key(array_slice($event_user_comments, -1, 1, true));
|
|
|
|
$date_format = $config['date_format'];
|
2015-05-22 13:22:12 +02:00
|
|
|
|
2014-10-02 18:38:14 +02:00
|
|
|
foreach ($event_user_comments as $key => $event_user_comment) {
|
|
|
|
$event_user_comment_str .= sprintf('%s: %s<br>%s: %s<br>%s: %s<br>',
|
|
|
|
__('Date'), date($date_format, $event_user_comment['utimestamp']),
|
|
|
|
__('User'), $event_user_comment['id_user'],
|
|
|
|
__('Comment'), $event_user_comment['comment']);
|
|
|
|
if ($key != $last_key) {
|
|
|
|
$event_user_comment_str .= '<br>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$comments_help_tip = "";
|
|
|
|
if (!empty($event_user_comment_str)) {
|
|
|
|
$comments_help_tip = ui_print_help_tip($event_user_comment_str, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[$i] = '<span id="comment_header_' . $event['id_evento'] . '">' . $comments_help_tip . '</span>';
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('tags',$show_fields)) {
|
|
|
|
$data[$i] = tags_get_tags_formatted($event['tags']);
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('source',$show_fields)) {
|
|
|
|
$data[$i] = $event["source"];
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('id_extra',$show_fields)) {
|
|
|
|
$data[$i] = $event["id_extra"];
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_array('ack_utimestamp',$show_fields)) {
|
2015-06-08 11:05:19 +02:00
|
|
|
if ($event["ack_utimestamp"] == 0) {
|
2013-01-28 14:14:27 +01:00
|
|
|
$data[$i] = '';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] = date ($config["date_format"], $event['ack_utimestamp']);
|
|
|
|
}
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
2013-03-06 18:53:17 +01:00
|
|
|
if (in_array('instructions',$show_fields)) {
|
|
|
|
switch($event['event_type']) {
|
|
|
|
case 'going_unknown':
|
2013-03-07 17:35:37 +01:00
|
|
|
if(!empty($event["unknown_instructions"])) {
|
|
|
|
$data[$i] = html_print_image('images/page_white_text.png', true, array('title' => str_replace("\n","<br>", io_safe_output($event["unknown_instructions"]))));
|
|
|
|
}
|
2013-03-06 18:53:17 +01:00
|
|
|
break;
|
|
|
|
case 'going_up_critical':
|
|
|
|
case 'going_down_critical':
|
2013-03-07 17:35:37 +01:00
|
|
|
if(!empty($event["critical_instructions"])) {
|
|
|
|
$data[$i] = html_print_image('images/page_white_text.png', true, array('title' => str_replace("\n","<br>", io_safe_output($event["critical_instructions"]))));
|
|
|
|
}
|
2013-03-06 18:53:17 +01:00
|
|
|
break;
|
|
|
|
case 'going_down_warning':
|
2013-03-07 17:35:37 +01:00
|
|
|
if(!empty($event["warning_instructions"])) {
|
|
|
|
$data[$i] = html_print_image('images/page_white_text.png', true, array('title' => str_replace("\n","<br>", io_safe_output($event["warning_instructions"]))));
|
|
|
|
}
|
2013-03-06 18:53:17 +01:00
|
|
|
break;
|
|
|
|
}
|
2013-03-07 17:35:37 +01:00
|
|
|
|
2013-08-05 16:23:27 +02:00
|
|
|
if (!isset($data[$i])) {
|
2013-03-07 17:35:37 +01:00
|
|
|
$data[$i] = '';
|
|
|
|
}
|
2013-08-05 16:23:27 +02:00
|
|
|
|
2013-04-10 09:57:54 +02:00
|
|
|
$table->cellclass[count($table->data)][$i] = $myclass;
|
2013-03-06 18:53:17 +01:00
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
if ($i != 0 && $allow_action) {
|
|
|
|
//Actions
|
|
|
|
$data[$i] = '';
|
2013-02-25 17:21:11 +01:00
|
|
|
|
2013-04-16 12:10:44 +02:00
|
|
|
if(!$readonly) {
|
|
|
|
// Validate event
|
2014-11-18 11:27:04 +01:00
|
|
|
if (($event["estado"] != 1) && (tags_checks_event_acl ($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'], $childrens_ids))) {
|
2015-03-12 12:18:01 +01:00
|
|
|
$show_validate_button = true;
|
2013-04-16 12:10:44 +02:00
|
|
|
$data[$i] .= '<a href="javascript:validate_event_advanced('.$event["id_evento"].', 1)" id="validate-'.$event["id_evento"].'">';
|
|
|
|
$data[$i] .= html_print_image ("images/ok.png", true,
|
|
|
|
array ("title" => __('Validate event')));
|
2013-04-10 09:57:54 +02:00
|
|
|
$data[$i] .= '</a>';
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
2015-05-22 13:22:12 +02:00
|
|
|
|
2013-04-16 12:10:44 +02:00
|
|
|
// Delete event
|
2014-11-18 11:27:04 +01:00
|
|
|
if ((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'],$childrens_ids) == 1)) {
|
2013-04-16 12:10:44 +02:00
|
|
|
if($event['estado'] != 2) {
|
2015-03-12 12:18:01 +01:00
|
|
|
$show_delete_button = true;
|
2013-04-16 12:10:44 +02:00
|
|
|
$data[$i] .= '<a class="delete_event" href="javascript:" id="delete-'.$event['id_evento'].'">';
|
|
|
|
$data[$i] .= html_print_image ("images/cross.png", true,
|
|
|
|
array ("title" => __('Delete event'), "id" => 'delete_cross_' . $event['id_evento']));
|
|
|
|
$data[$i] .= '</a>';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$data[$i] .= html_print_image ("images/cross.disabled.png", true,
|
|
|
|
array ("title" => __('Is not allowed delete events in process'))).' ';
|
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[$i] .= '<a href="javascript:" onclick="show_event_dialog(' . $event["id_evento"] . ', '.$group_rep.');">';
|
|
|
|
$data[$i] .= html_print_input_hidden('event_title_'.$event["id_evento"], "#".$event["id_evento"]." - ".$event["evento"], true);
|
|
|
|
$data[$i] .= html_print_image ("images/eye.png", true,
|
2013-08-05 16:23:27 +02:00
|
|
|
array ("title" => __('Show more')));
|
2013-04-10 09:57:54 +02:00
|
|
|
$data[$i] .= '</a>';
|
2013-05-30 17:48:22 +02:00
|
|
|
|
|
|
|
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;';
|
2013-08-05 16:23:27 +02:00
|
|
|
|
2013-01-28 14:14:27 +01:00
|
|
|
$i++;
|
|
|
|
|
2013-06-13 17:03:07 +02:00
|
|
|
if(!$readonly) {
|
2014-11-18 11:27:04 +01:00
|
|
|
if (tags_checks_event_acl ($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids) == 1) {
|
2013-06-13 17:03:07 +02:00
|
|
|
//Checkbox
|
|
|
|
// Class 'candeleted' must be the fist class to be parsed from javascript. Dont change
|
|
|
|
$data[$i] = html_print_checkbox_extended ("validate_ids[]", $event['id_evento'], false, false, false, 'class="candeleted chk_val"', true);
|
|
|
|
}
|
2014-11-18 11:27:04 +01:00
|
|
|
else if (tags_checks_event_acl ($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'], $childrens_ids) == 1) {
|
2013-06-13 17:03:07 +02:00
|
|
|
//Checkbox
|
|
|
|
$data[$i] = html_print_checkbox_extended ("validate_ids[]", $event['id_evento'], false, false, false, 'class="chk_val"', true);
|
|
|
|
}
|
|
|
|
else if (isset($table->header[$i]) || true) {
|
|
|
|
$data[$i] = '';
|
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
2013-06-13 17:03:07 +02:00
|
|
|
|
2013-05-30 17:48:22 +02:00
|
|
|
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;';
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
array_push ($table->data, $data);
|
|
|
|
|
|
|
|
$idx++;
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '<div id="events_list">';
|
|
|
|
if (!empty ($table->data)) {
|
2015-06-12 15:50:46 +02:00
|
|
|
|
2013-02-25 17:21:11 +01:00
|
|
|
if ($allow_pagination) {
|
2013-01-28 14:14:27 +01:00
|
|
|
ui_pagination ($total_events, $url, $offset, $pagination);
|
|
|
|
}
|
|
|
|
|
2013-02-25 17:21:11 +01:00
|
|
|
if ($allow_action) {
|
2015-06-08 13:13:09 +02:00
|
|
|
echo '<form method="post" id="form_events" action="'.$url.'">';
|
2013-01-28 14:14:27 +01:00
|
|
|
echo "<input type='hidden' name='delete' id='hidden_delete_events' value='0' />";
|
|
|
|
}
|
2013-02-25 17:21:11 +01:00
|
|
|
|
2015-03-09 16:33:27 +01:00
|
|
|
if (defined("METACONSOLE"))
|
|
|
|
echo '<div style="width: ' . $table->width . ';">';
|
|
|
|
else
|
|
|
|
echo '<div style="width: ' . $table->width . '; overflow-x: auto;">';
|
2013-01-28 14:14:27 +01:00
|
|
|
html_print_table ($table);
|
2013-06-10 18:15:36 +02:00
|
|
|
echo '</div>';
|
2013-01-28 14:14:27 +01:00
|
|
|
|
2013-02-25 17:21:11 +01:00
|
|
|
if ($allow_action) {
|
2015-03-11 11:31:46 +01:00
|
|
|
|
|
|
|
echo '<div style="width:' . $table->width . ';" class="action-buttons">';
|
2015-03-12 12:18:01 +01:00
|
|
|
//~ if (!$readonly && tags_check_acl ($config["id_user"], 0, "EW", $event['clean_tags']) == 1) {
|
|
|
|
if (!$readonly && $show_validate_button) {
|
2013-01-28 14:14:27 +01:00
|
|
|
html_print_button(__('Validate selected'), 'validate_button', false, 'validate_selected();', 'class="sub ok"');
|
2014-04-24 09:56:06 +02:00
|
|
|
// Fix: validated_selected JS function has to be included with the proper user ACLs
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function validate_selected() {
|
|
|
|
$(".chk_val").each(function() {
|
|
|
|
if($(this).is(":checked")) {
|
|
|
|
validate_event_advanced($(this).val(),1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
2015-05-22 13:22:12 +02:00
|
|
|
<?php
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
2015-03-12 12:18:01 +01:00
|
|
|
//~ if (!$readonly && tags_check_acl ($config["id_user"], 0,"EM", $event['clean_tags']) == 1) {
|
|
|
|
if (!$readonly && ($show_delete_button)) {
|
2013-01-28 14:14:27 +01:00
|
|
|
html_print_button(__('Delete selected'), 'delete_button', false, 'delete_selected();', 'class="sub delete"');
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
2014-04-24 09:56:06 +02:00
|
|
|
function delete_selected() {
|
|
|
|
if(confirm('<?php echo __('Are you sure?'); ?>')) {
|
|
|
|
$("#hidden_delete_events").val(1);
|
|
|
|
$("#form_events").submit();
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
2014-04-24 09:56:06 +02:00
|
|
|
}
|
2013-01-28 14:14:27 +01:00
|
|
|
</script>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
echo '</div>';
|
|
|
|
echo '</form>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2013-08-05 16:23:27 +02:00
|
|
|
echo '<div class="nf">' . __('No events') . '</div>';
|
2013-01-28 14:14:27 +01:00
|
|
|
}
|
|
|
|
echo '</div>';
|
|
|
|
|
|
|
|
?>
|