2013-03-15 15:50:47 +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.
class Events {
private $correct_acl = false ;
2013-03-26 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php, include/functions_groups.php:
changes for to use in the calls in mobile version.
* mobile/index.php, mobile/operation/events.php,
mobile/operation/modules.php, mobile/operation/events,
mobile/operation/events/events.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/alerts.php,
mobile/include/style/main.css, mobile/include/ui.class.php,
mobile/include/user.class.php: changes and improves in the code
of mobile.
* mobile/operation/agents/*, mobile/operation/servers/*: removed
the old files from version pandora mobile 4.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7891 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-26 18:24:10 +01:00
private $acl = " ER " ;
2013-03-15 15:50:47 +01:00
private $default = true ;
2013-07-08 12:15:49 +02:00
private $default_filters = array ();
2013-03-15 15:50:47 +01:00
private $free_search = '' ;
private $hours_old = 8 ;
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
private $status = 3 ;
2013-11-19 14:28:35 +01:00
private $type = " all " ;
2013-03-15 15:50:47 +01:00
private $severity = - 1 ;
private $filter = 0 ;
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
private $group = 0 ;
2013-04-09 11:29:03 +02:00
private $id_agent = 0 ;
private $all_events = false ;
private $columns = null ;
private $readOnly = false ;
2013-03-15 15:50:47 +01:00
function __construct () {
$system = System :: getInstance ();
2013-04-09 11:29:03 +02:00
$this -> columns = array ( 'agent' => 1 );
2013-03-26 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php, include/functions_groups.php:
changes for to use in the calls in mobile version.
* mobile/index.php, mobile/operation/events.php,
mobile/operation/modules.php, mobile/operation/events,
mobile/operation/events/events.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/alerts.php,
mobile/include/style/main.css, mobile/include/ui.class.php,
mobile/include/user.class.php: changes and improves in the code
of mobile.
* mobile/operation/agents/*, mobile/operation/servers/*: removed
the old files from version pandora mobile 4.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7891 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-26 18:24:10 +01:00
if ( $system -> checkACL ( $this -> acl )) {
2013-03-15 15:50:47 +01:00
$this -> correct_acl = true ;
}
else {
$this -> correct_acl = false ;
}
}
2013-04-09 11:29:03 +02:00
public function setReadOnly () {
$this -> readOnly = true ;
}
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
public function ajax ( $parameter2 = false ) {
$system = System :: getInstance ();
if ( ! $this -> correct_acl ) {
return ;
}
else {
switch ( $parameter2 ) {
case 'get_events' :
2014-01-31 11:50:55 +01:00
if ( $system -> getRequest ( 'agent_events' , '0' ) == 1 ) {
$this -> disabledColumns ( array ( 'agent' ));
$filters = array ( 'id_agent' => $system -> getRequest ( 'id_agent' , 0 ));
$this -> setFilters ( $filters );
$this -> setReadOnly ();
$this -> eventsGetFilters ();
}
else {
$this -> eventsGetFilters ();
}
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
$page = $system -> getRequest ( 'page' , 0 );
$system = System :: getInstance ();
$listEvents = $this -> getListEvents ( $page );
$events_db = $listEvents [ 'events' ];
$total_events = $listEvents [ 'total' ];
$events = array ();
$end = 1 ;
2016-09-28 16:56:05 +02:00
2013-12-13 12:50:20 +01:00
foreach ( $events_db as $event ) {
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
$end = 0 ;
2013-11-26 14:08:27 +01:00
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
switch ( $event [ 'estado' ]) {
case 0 :
2013-11-27 17:54:53 +01:00
$img_st = " images/star_white.png " ;
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
break ;
case 1 :
2013-11-27 17:54:53 +01:00
$img_st = " images/tick_white.png " ;
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
break ;
case 2 :
2013-11-27 17:54:53 +01:00
$img_st = " images/hourglass_white.png " ;
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
break ;
}
2013-11-26 14:08:27 +01:00
2014-02-11 11:37:30 +01:00
if ( $event [ 'criticity' ] == EVENT_CRIT_WARNING ||
$event [ 'criticity' ] == EVENT_CRIT_MAINTENANCE ||
$event [ 'criticity' ] == EVENT_CRIT_MINOR ) {
2013-11-27 17:54:53 +01:00
$img_st = str_replace ( " white.png " , " dark.png " , $img_st );
}
2013-12-13 12:50:20 +01:00
2016-09-28 16:56:05 +02:00
$status_icon = html_print_image ( $img_st , true , false , false , false , false , true );
2013-11-27 17:54:53 +01:00
$row = array ();
2017-02-13 16:06:17 +01:00
$row [] = '<b class="ui-table-cell-label">' . __ ( 'Event Name' ) . '</b><a href="javascript: openDetails(' . $event [ 'id_evento' ] . ')"><div class="event_name">' . io_safe_output ( str_replace ( array ( ' ' , '' ), ' ' , $event [ 'evento' ])) . '</div></a>' ;
2013-12-13 12:50:20 +01:00
2013-07-05 16:29:35 +02:00
if ( $event [ " id_agente " ] == 0 ) {
$agent_name = __ ( 'System' );
}
else {
2013-11-27 17:54:53 +01:00
$agent_name = '<span class="nobold">' . ui_print_agent_name ( $event [ " id_agente " ], true , 'agent_small' , '' , false , '' , '' , false , false ) . '</span>' ;
2013-07-05 16:29:35 +02:00
}
2013-12-13 12:50:20 +01:00
2014-02-10 15:16:04 +01:00
$row_1 = '<span class="events_agent">' . $agent_name . '</span>' ;
2017-02-13 16:06:17 +01:00
$row_1 .= '<span class="events_timestamp">' . ui_print_timestamp ( $event [ 'timestamp_rep' ], true , array ( 'units' => 'tiny' )) . $status_icon . '</span>' ;
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
2013-11-27 17:54:53 +01:00
$row [] = $row_1 ;
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
2013-11-22 14:24:28 +01:00
$row [] = get_priority_class ( $event [ " criticity " ]);
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
$events [ $event [ 'id_evento' ]] = $row ;
}
echo json_encode ( array ( 'end' => $end , 'events' => $events ));
2013-03-21 19:47:28 +01:00
break ;
case 'get_detail_event' :
2013-03-22 15:31:54 +01:00
$system = System :: getInstance ();
2013-03-21 19:47:28 +01:00
$id_event = $system -> getRequest ( 'id_event' , 0 );
2016-09-28 16:56:05 +02:00
$meta = false ;
if ( $system -> getConfig ( 'metaconsole' ))
$meta = true ;
$event = events_get_event ( $id_event , false , $meta );
2013-03-21 19:47:28 +01:00
if ( $event ) {
2013-04-05 15:07:03 +02:00
//Check if it is a event from module.
if ( $event [ 'id_agentmodule' ] > 0 ) {
$event [ 'module_graph_link' ] =
'<a data-ajax="false" href="index.php?page=module_graph&id=' . $event [ 'id_agentmodule' ] . '">' .
2016-09-28 16:56:05 +02:00
html_print_image ( 'images/chart_curve.png' , true , array ( " style " => 'vertical-align: middle;' ), false , false , false , true ) .
2013-04-05 15:07:03 +02:00
'</a>' ;
}
2014-01-30 11:44:54 +01:00
else {
$event [ 'module_graph_link' ] = '<i>' . __ ( 'N/A' ) . '</i>' ;
}
2013-04-05 15:07:03 +02:00
2013-07-08 12:15:49 +02:00
if ( $event [ 'id_agente' ] > 0 ) {
$event [ 'agent' ] = " <a style='color: black;' " .
" href='index.php?page=agent&id= " .
$event [ 'id_agente' ] . " '> " .
agents_get_name ( $event [ 'id_agente' ]) .
" </a> " ;
}
2014-01-30 11:44:54 +01:00
else {
$event [ 'agent' ] = '<i>' . __ ( 'N/A' ) . '</i>' ;
}
2013-04-05 15:07:03 +02:00
2013-03-21 19:47:28 +01:00
$event [ 'evento' ] = io_safe_output ( $event [ 'evento' ]);
$event [ 'clean_tags' ] = events_clean_tags ( $event [ 'tags' ]);
$event [ " timestamp " ] = date ( $system -> getConfig ( " date_format " ), strtotime ( $event [ " timestamp " ]));
2013-07-08 12:15:49 +02:00
if ( empty ( $event [ " owner_user " ])) {
$event [ " owner_user " ] = '<i>' . __ ( 'N/A' ) . '</i>' ;
2013-03-21 19:47:28 +01:00
}
else {
$user_owner = db_get_value ( 'fullname' , 'tusuario' , 'id_user' , $event [ " owner_user " ]);
if ( empty ( $user_owner )) {
$user_owner = $event [ 'owner_user' ];
}
$event [ " owner_user " ] = $user_owner ;
}
2014-01-30 11:44:54 +01:00
$event [ " event_type " ] = events_print_type_description ( $event [ " event_type " ], true );
$event [ " event_type " ] .= ' ' ;
$event [ " event_type " ] .= events_print_type_img ( $event [ " event_type " ], true );
2013-03-21 19:47:28 +01:00
if ( ! isset ( $group_rep ))
$group_rep = 0 ;
if ( $group_rep != 0 ) {
2013-07-08 12:15:49 +02:00
if ( $event [ " event_rep " ] <= 1 ) {
$event [ " event_repeated " ] = '<i>' . __ ( 'No' ) . '</i>' ;
2013-03-21 19:47:28 +01:00
}
else {
$event [ " event_repeated " ] = sprintf ( " %d Times " , $event [ " event_rep " ]);
}
}
else {
2013-07-08 12:15:49 +02:00
$event [ " event_repeated " ] = '<i>' . __ ( 'No' ) . '</i>' ;
2013-03-21 19:47:28 +01:00
}
$event_criticity = get_priority_name ( $event [ " criticity " ]);
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 ;
}
2014-01-30 11:44:54 +01:00
$event [ " criticity " ] = ' ' . $event_criticity ;
$event [ " criticity " ] .= html_print_image ( $img_sev , true ,
2013-03-21 19:47:28 +01:00
array ( " class " => " image_status " ,
" width " => 12 ,
" height " => 12 ,
2016-09-28 16:56:05 +02:00
" title " => $event_criticity ), false , false , false , true );
2013-03-21 19:47:28 +01:00
if ( $event [ 'estado' ] == 1 ) {
$user_ack = db_get_value ( 'fullname' , 'tusuario' , 'id_user' , $event [ 'id_usuario' ]);
2013-04-22 17:51:37 +02:00
if ( empty ( $user_ack )) {
2013-03-21 19:47:28 +01:00
$user_ack = $event [ 'id_usuario' ];
}
2013-03-22 15:31:54 +01:00
$date_ack = date ( $system -> getConfig ( " date_format " ), $event [ 'ack_utimestamp' ]);
2013-04-22 17:51:37 +02:00
$event [ " acknowledged_by " ] = $user_ack .
' (' . $date_ack . ')' ;
2013-03-21 19:47:28 +01:00
}
else {
2013-07-08 12:15:49 +02:00
$event [ " acknowledged_by " ] = '<i>' . __ ( 'N/A' ) . '</i>' ;
2013-03-21 19:47:28 +01:00
}
// Get Status
2013-07-08 12:15:49 +02:00
switch ( $event [ 'estado' ]) {
2013-03-21 19:47:28 +01:00
case 0 :
2014-01-30 11:44:54 +01:00
$img_st = " images/star_dark.png " ;
2013-03-21 19:47:28 +01:00
$title_st = __ ( 'New event' );
break ;
case 1 :
$img_st = " images/tick.png " ;
$title_st = __ ( 'Event validated' );
break ;
case 2 :
$img_st = " images/hourglass.png " ;
$title_st = __ ( 'Event in process' );
break ;
}
2014-01-30 11:44:54 +01:00
$event [ " status " ] = $title_st ;
$event [ " status " ] .= ' ' ;
2016-09-28 16:56:05 +02:00
$event [ " status " ] .= html_print_image ( $img_st , true , false , false , false , false , true );
2013-03-21 19:47:28 +01:00
2014-01-30 11:44:54 +01:00
$event [ " group " ] = groups_get_name ( $event [ " id_grupo " ], true );
$event [ " group " ] .= ui_print_group_icon ( $event [ " id_grupo " ], true );
2013-03-21 19:47:28 +01:00
$event [ " tags " ] = tags_get_tags_formatted ( $event [ " tags " ]);
if ( empty ( $event [ " tags " ])) {
$event [ " tags " ] = '<i>' . __ ( 'N/A' ) . '</i>' ;
}
2014-08-13 03:57:55 +02:00
$event_comments = db_get_value ( 'user_comment' , 'tevento' , 'id_evento' , $id_event );
$event_comments_array = array ();
$event_comments_array = json_decode ( $event_comments , true );
// Support for new format only.
if ( empty ( $event_comments_array )) {
$comment = '<i>' . __ ( 'N/A' ) . '</i>' ;
} else {
$comment = '' ;
$event_comments_array = array_reverse ( $event_comments_array );
foreach ( $event_comments_array as $c ) {
$comment .= date ( $system -> getConfig ( " date_format " ), $c [ 'utimestamp' ]) . ' (' . $c [ 'id_user' ] . ')' ;
$c [ 'comment' ] = io_safe_output ( $c [ 'comment' ]);
$c [ 'comment' ] = str_replace ( " \n " , " <br> " , $c [ 'comment' ]);
$comment .= '<br>' . $c [ 'comment' ] . '<br>' ;
}
}
$event [ " comments " ] = $comment ;
2013-03-21 19:47:28 +01:00
echo json_encode ( array ( 'correct' => 1 , 'event' => $event ));
}
else {
echo json_encode ( array ( 'correct' => 0 , 'event' => array ()));
}
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
break ;
2013-03-22 15:31:54 +01:00
case 'validate_event' :
$system = System :: getInstance ();
$id_event = $system -> getRequest ( 'id_event' , 0 );
2013-11-26 14:08:27 +01:00
if ( events_change_status ( $id_event , EVENT_VALIDATE )) {
2013-03-22 15:31:54 +01:00
echo json_encode ( array ( 'correct' => 1 ));
}
else {
echo json_encode ( array ( 'correct' => 0 ));
}
break ;
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
}
}
}
2013-04-09 11:29:03 +02:00
public function disabledColumns ( $columns = null ) {
if ( ! empty ( $columns )) {
foreach ( $columns as $column ) {
2013-04-22 17:51:37 +02:00
$this -> columns [ $column ] = 1 ;
2013-04-09 11:29:03 +02:00
}
}
}
2013-03-15 15:50:47 +01:00
private function eventsGetFilters () {
$system = System :: getInstance ();
2013-03-26 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php, include/functions_groups.php:
changes for to use in the calls in mobile version.
* mobile/index.php, mobile/operation/events.php,
mobile/operation/modules.php, mobile/operation/events,
mobile/operation/events/events.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/alerts.php,
mobile/include/style/main.css, mobile/include/ui.class.php,
mobile/include/user.class.php: changes and improves in the code
of mobile.
* mobile/operation/agents/*, mobile/operation/servers/*: removed
the old files from version pandora mobile 4.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7891 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-26 18:24:10 +01:00
$user = User :: getInstance ();
2013-03-15 15:50:47 +01:00
2013-07-08 12:15:49 +02:00
$this -> default_filters [ 'severity' ] = true ;
$this -> default_filters [ 'group' ] = true ;
$this -> default_filters [ 'type' ] = true ;
$this -> default_filters [ 'status' ] = true ;
$this -> default_filters [ 'free_search' ] = true ;
$this -> default_filters [ 'hours_old' ] = true ;
2013-03-15 15:50:47 +01:00
$this -> hours_old = $system -> getRequest ( 'hours_old' , 8 );
if ( $this -> hours_old != 8 ) {
$this -> default = false ;
2013-07-08 12:15:49 +02:00
$this -> default_filters [ 'hours_old' ] = false ;
2013-03-15 15:50:47 +01:00
}
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
2013-03-15 15:50:47 +01:00
$this -> free_search = $system -> getRequest ( 'free_search' , '' );
if ( $this -> free_search != '' ) {
$this -> default = false ;
2013-07-08 12:15:49 +02:00
$this -> default_filters [ 'free_search' ] = false ;
2013-03-15 15:50:47 +01:00
}
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
2013-03-22 15:31:54 +01:00
$this -> status = $system -> getRequest ( 'status' , __ ( " Status " ));
2013-03-21 19:47:28 +01:00
if (( $this -> status === __ ( " Status " )) || ( $this -> status == 3 )) {
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
$this -> status = 3 ;
2013-03-15 15:50:47 +01:00
}
else {
2013-07-05 16:29:35 +02:00
$this -> status = ( int ) $this -> status ;
2013-03-15 15:50:47 +01:00
$this -> default = false ;
2013-07-08 12:15:49 +02:00
$this -> default_filters [ 'status' ] = false ;
2013-03-15 15:50:47 +01:00
}
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
2013-03-15 15:50:47 +01:00
$this -> type = $system -> getRequest ( 'type' , __ ( " Type " ));
if ( $this -> type === __ ( " Type " )) {
2013-11-19 14:28:35 +01:00
$this -> type = " all " ;
2013-03-15 15:50:47 +01:00
}
else {
$this -> default = false ;
2013-07-08 12:15:49 +02:00
$this -> default_filters [ 'type' ] = false ;
2013-03-15 15:50:47 +01:00
}
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
2013-03-21 19:47:28 +01:00
$this -> group = $system -> getRequest ( 'group' , __ ( " Group " ));
2013-03-26 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php, include/functions_groups.php:
changes for to use in the calls in mobile version.
* mobile/index.php, mobile/operation/events.php,
mobile/operation/modules.php, mobile/operation/events,
mobile/operation/events/events.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/alerts.php,
mobile/include/style/main.css, mobile/include/ui.class.php,
mobile/include/user.class.php: changes and improves in the code
of mobile.
* mobile/operation/agents/*, mobile/operation/servers/*: removed
the old files from version pandora mobile 4.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7891 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-26 18:24:10 +01:00
if ( ! $user -> isInGroup ( $this -> acl , $this -> group )) {
$this -> group = 0 ;
}
2013-03-21 19:47:28 +01:00
if (( $this -> group === __ ( " Group " )) || ( $this -> group == 0 )) {
$this -> group = 0 ;
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
}
else {
$this -> default = false ;
2013-07-08 12:15:49 +02:00
$this -> default_filters [ 'group' ] = false ;
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
}
2013-03-15 15:50:47 +01:00
$this -> severity = $system -> getRequest ( 'severity' , __ ( " Severity " ));
if ( $this -> severity === __ ( " Severity " )) {
$this -> severity = - 1 ;
}
else {
$this -> default = false ;
2013-07-08 12:15:49 +02:00
$this -> default_filters [ 'severity' ] = false ;
2013-03-15 15:50:47 +01:00
}
$this -> filter = $system -> getRequest ( 'filter' , __ ( 'Preset Filters' ));
2013-03-21 19:47:28 +01:00
if (( $this -> filter === __ ( " Preset Filters " )) || ( $this -> filter == 0 )) {
2013-03-15 15:50:47 +01:00
$this -> filter = 0 ;
}
else {
$this -> default = false ;
}
///The user set a preset filter
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 ( $this -> filter > 0 ) {
$this -> loadPresetFilter ();
}
2014-01-31 11:50:55 +01:00
$this -> limit = $system -> getRequest ( 'limit' , - 1 );
2013-03-15 15:50:47 +01:00
}
2013-04-09 11:29:03 +02:00
public function setFilters ( $filters ) {
if ( isset ( $filters [ 'id_agent' ])) {
$this -> id_agent = $filters [ 'id_agent' ];
}
2014-01-31 11:50:55 +01:00
2013-04-09 11:29:03 +02:00
if ( isset ( $filters [ 'all_events' ])) {
$this -> all_events = $filters [ 'all_events' ];
}
}
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
private function loadPresetFilter () {
$filter = db_get_row ( 'tevent_filter' , 'id_filter' , $this -> filter );
$this -> free_search = $filter [ 'search' ];
$this -> hours_old = $filter [ 'event_view_hr' ];
$this -> status = $filter [ 'status' ];
2014-08-22 13:01:20 +02:00
$this -> type = $filter [ 'event_type' ];
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
$this -> severity = $filter [ 'severity' ];
2013-03-15 15:50:47 +01:00
}
public function show () {
if ( ! $this -> correct_acl ) {
$this -> show_fail_acl ();
}
else {
$this -> eventsGetFilters ();
$this -> show_events ();
}
}
private function show_fail_acl () {
2014-10-15 18:12:51 +02:00
$error [ 'type' ] = 'onStart' ;
2013-04-24 14:36:32 +02:00
$error [ 'title_text' ] = __ ( 'You don\'t have access to this page' );
$error [ 'content_text' ] = __ ( 'Access to this page is restricted to authorized users only, please contact system administrator if you need assistance. <br><br>Please know that all attempts to access this page are recorded in security logs of Pandora System Database' );
2014-10-15 18:12:51 +02:00
if ( class_exists ( " HomeEnterprise " ))
$home = new HomeEnterprise ();
else
$home = new Home ();
2013-04-24 14:36:32 +02:00
$home -> show ( $error );
2013-03-15 15:50:47 +01:00
}
2014-02-10 12:54:39 +01:00
public function get_event_dialog_error_options ( $options ) {
$options [ 'type' ] = 'hidden' ;
$options [ 'dialog_id' ] = 'detail_event_dialog_error' ;
$options [ 'title_text' ] = __ ( 'ERROR: Event detail' );
$options [ 'content_text' ] = '<span style="color: #ff0000;">' .
__ ( 'Error connecting to DB pandora.' ) . '</span>' ;
return $options ;
}
public function get_event_dialog_options () {
2013-03-15 15:50:47 +01:00
$ui = Ui :: getInstance ();
2014-02-10 12:54:39 +01:00
$options [ 'type' ] = 'hidden' ;
2013-03-15 15:50:47 +01:00
2014-02-10 12:54:39 +01:00
$options [ 'dialog_id' ] = 'detail_event_dialog' ;
2013-03-21 19:47:28 +01:00
2014-02-10 12:54:39 +01:00
$options [ 'title_close_button' ] = true ;
$options [ 'title_text' ] = __ ( 'Event detail' );
//Content
ob_start ();
?>
< table class = " pandora_responsive alternate event_details " >
< tbody >
< tr class = " event_name " >
< td class = " cell_event_name " colspan = " 2 " ></ td >
</ tr >
< tr class = " event_id " >
< th >< ? php echo __ ( 'Event ID' ); ?> </th>
< td class = " cell_event_id " ></ td >
</ tr >
< tr class = " event_timestamp " >
< th >< ? php echo __ ( 'Timestamp' ); ?> </th>
< td class = " cell_event_timestamp " ></ td >
</ tr >
< tr class = " event_owner " >
< th >< ? php echo __ ( 'Owner' ); ?> </th>
< td class = " cell_event_owner " ></ td >
</ tr >
< tr class = " event_type " >
< th >< ? php echo __ ( 'Type' ); ?> </th>
< td class = " cell_event_type " ></ td >
</ tr >
< tr class = " event_repeated " >
< th >< ? php echo __ ( 'Repeated' ); ?> </th>
< td class = " cell_event_repeated " ></ td >
</ tr >
< tr class = " event_severity " >
< th >< ? php echo __ ( 'Severity' ); ?> </th>
< td class = " cell_event_severity " ></ td >
</ tr >
< tr class = " event_status " >
< th >< ? php echo __ ( 'Status' ); ?> </th>
< td class = " cell_event_status " ></ td >
</ tr >
< tr class = " event_acknowledged_by " >
< th >< ? php echo __ ( 'Acknowledged by' ); ?> </th>
< td class = " cell_event_acknowledged_by " ></ td >
</ tr >
< tr class = " event_group " >
< th >< ? php echo __ ( 'Group' ); ?> </th>
< td class = " cell_event_group " ></ td >
</ tr >
</ tr >
< tr class = " event_module_graph " >
< th >< ? php echo __ ( 'Module Graph' ); ?> </th>
< td class = " cell_module_graph " ></ td >
</ tr >
< tr class = " event_agent " >
< th >< ? php echo __ ( 'Agent' ); ?> </th>
< td class = " cell_agent " ></ td >
</ tr >
< tr class = " event_tags " >
< th >< ? php echo __ ( 'Tags' ); ?> </th>
< td class = " cell_event_tags " ></ td >
</ tr >
2014-08-13 03:57:55 +02:00
< tr class = " event_comments " >
< th >< ? php echo __ ( 'Comments' ); ?> </th>
< td class = " cell_event_comments " ></ td >
</ tr >
2014-02-10 12:54:39 +01:00
</ tbody >
</ table >
< ? php
$options [ 'content_text' ] = ob_get_clean ();
$options_button = array (
2013-03-22 15:31:54 +01:00
'text' => __ ( 'Validate' ),
'id' => 'validate_button' ,
'href' => 'javascript: validateEvent();' );
2014-02-10 12:54:39 +01:00
$options [ 'content_text' ] .= $ui -> createButton ( $options_button );
$options_hidden = array (
'id' => 'event_id' ,
'value' => 0 ,
'type' => 'hidden'
);
$options [ 'content_text' ] .= $ui -> getInput ( $options_hidden );
$options [ 'content_text' ] .= ' < div id = " validate_button_loading " style = " display: none; text-align: center; " >
< img src = " images/ajax-loader.gif " /></ div > ' ;
$options [ 'content_text' ] .= ' < div id = " validate_button_correct " style = " display: none; text-align: center; " >
< h3 > ' . __(' Sucessful validate ') . ' </ h3 ></ div > ' ;
$options [ 'content_text' ] .= ' < div id = " validate_button_fail " style = " display: none; text-align: center; " >
< h3 style = " color: #ff0000; " > ' . __(' Fail validate ') . ' </ h3 ></ div > ' ;
$options [ 'button_close' ] = false ;
return $options ;
}
private function show_events () {
$ui = Ui :: getInstance ();
$ui -> createPage ();
$options = $this -> get_event_dialog_options ();
2013-03-22 15:31:54 +01:00
$ui -> addDialog ( $options );
2014-02-10 12:54:39 +01:00
$options = $this -> get_event_dialog_error_options ( $options );
2013-03-22 15:31:54 +01:00
2013-03-21 19:47:28 +01:00
$ui -> addDialog ( $options );
2013-11-27 17:54:53 +01:00
$ui -> createDefaultHeader ( __ ( " Events " ),
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
$ui -> createHeaderButton (
array ( 'icon' => 'back' ,
'pos' => 'left' ,
'text' => __ ( 'Back' ),
2013-11-28 17:54:18 +01:00
'href' => 'index.php?page=home' )));
2013-03-15 15:50:47 +01:00
$ui -> showFooter ( false );
$ui -> beginContent ();
2013-03-21 19:47:28 +01:00
$ui -> contentAddHtml ( " <a id='detail_event_dialog_hook' href='#detail_event_dialog' style='display:none;'>detail_event_hook</a> " );
2013-03-22 15:31:54 +01:00
$ui -> contentAddHtml ( " <a id='detail_event_dialog_error_hook' href='#detail_event_dialog_error' style='display:none;'>detail_event_dialog_error_hook</a> " );
2013-03-26 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php, include/functions_groups.php:
changes for to use in the calls in mobile version.
* mobile/index.php, mobile/operation/events.php,
mobile/operation/modules.php, mobile/operation/events,
mobile/operation/events/events.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/alerts.php,
mobile/include/style/main.css, mobile/include/ui.class.php,
mobile/include/user.class.php: changes and improves in the code
of mobile.
* mobile/operation/agents/*, mobile/operation/servers/*: removed
the old files from version pandora mobile 4.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7891 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-26 18:24:10 +01:00
2013-03-20 18:41:35 +01:00
$filter_title = sprintf ( __ ( 'Filter Events by %s' ), $this -> filterEventsGetString ());
2013-03-15 15:50:47 +01:00
$ui -> contentBeginCollapsible ( $filter_title );
2013-03-22 15:31:54 +01:00
$ui -> beginForm ( " index.php?page=events " );
/*
2013-03-15 15:50:47 +01:00
$options = array (
'name' => 'page' ,
'type' => 'hidden' ,
'value' => 'events'
);
2013-03-22 15:31:54 +01:00
$ui -> formAddInput ( $options ); */
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
$items = db_get_all_rows_in_table ( 'tevent_filter' );
$items [] = array ( 'id_filter' => 0 , 'id_name' => __ ( 'None' ));
2013-03-15 15:50:47 +01:00
$options = array (
'name' => 'filter' ,
'title' => __ ( 'Preset Filters' ),
'label' => __ ( 'Preset Filters' ),
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
'items' => $items ,
'item_id' => 'id_filter' ,
'item_value' => 'id_name' ,
'selected' => $this -> filter
2013-03-15 15:50:47 +01:00
);
$ui -> formAddSelectBox ( $options );
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
$system = System :: getInstance ();
$groups = users_get_groups_for_select (
$system -> getConfig ( 'id_user' ), " ER " , true , true , false , 'id_grupo' );
2013-03-15 15:50:47 +01:00
$options = array (
'name' => 'group' ,
'title' => __ ( 'Group' ),
'label' => __ ( 'Group' ),
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
'items' => $groups ,
'selected' => $this -> group
2013-03-15 15:50:47 +01:00
);
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
$ui -> formAddSelectBox ( $options );
2013-03-15 15:50:47 +01:00
$options = array (
'name' => 'status' ,
'title' => __ ( 'Status' ),
'label' => __ ( 'Status' ),
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
'items' => events_get_all_status (),
'selected' => $this -> status
2013-03-15 15:50:47 +01:00
);
$ui -> formAddSelectBox ( $options );
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
2013-03-15 15:50:47 +01:00
$options = array (
'name' => 'type' ,
'title' => __ ( 'Type' ),
'label' => __ ( 'Type' ),
2013-11-19 14:28:35 +01:00
'items' => array_merge ( array ( " all " => __ ( 'All' )), get_event_types ()),
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
'selected' => $this -> type
2013-03-15 15:50:47 +01:00
);
2013-11-19 14:28:35 +01:00
2013-03-15 15:50:47 +01:00
$ui -> formAddSelectBox ( $options );
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
2013-03-15 15:50:47 +01:00
$options = array (
'name' => 'severity' ,
'title' => __ ( 'Severity' ),
'label' => __ ( 'Severity' ),
2013-11-19 14:28:35 +01:00
'items' => array ( " -1 " => __ ( 'All' )) + get_priorities (),
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
'selected' => $this -> severity
2013-03-15 15:50:47 +01:00
);
$ui -> formAddSelectBox ( $options );
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
2013-03-15 15:50:47 +01:00
$options = array (
'name' => 'free_search' ,
'value' => $this -> free_search ,
'placeholder' => __ ( 'Free search' )
);
$ui -> formAddInputSearch ( $options );
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
2013-03-15 15:50:47 +01:00
$options = array (
'label' => __ ( 'Max. hours old' ),
'name' => 'hours_old' ,
'value' => $this -> hours_old ,
'min' => 0 ,
'max' => 24 * 7 ,
'step' => 8
);
$ui -> formAddSlider ( $options );
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
2013-03-15 15:50:47 +01:00
$options = array (
'icon' => 'refresh' ,
'icon_pos' => 'right' ,
'text' => __ ( 'Apply Filter' )
);
$ui -> formAddSubmitButton ( $options );
$html = $ui -> getEndForm ();
$ui -> contentCollapsibleAddItem ( $html );
$ui -> contentEndCollapsible ();
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
$this -> listEventsHtml ();
2013-03-15 15:50:47 +01:00
$ui -> endContent ();
$ui -> showPage ();
}
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
private function getListEvents ( $page = 0 ) {
2013-03-15 15:50:47 +01:00
$system = System :: getInstance ();
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
//--------------Fill the SQL POST-------------------------------
2013-03-15 15:50:47 +01:00
$sql_post = '' ;
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
switch ( $this -> status ) {
case 0 :
case 1 :
case 2 :
$sql_post .= " AND estado = " . $this -> status ;
break ;
case 3 :
$sql_post .= " AND (estado = 0 OR estado = 2) " ;
break ;
}
if ( $this -> free_search != " " ) {
$sql_post .= " AND evento LIKE '% " . io_safe_input ( $this -> free_search ) . " %' " ;
}
if ( $this -> severity != - 1 ) {
switch ( $this -> severity ) {
case EVENT_CRIT_WARNING_OR_CRITICAL :
$sql_post .= " AND (criticity = " . EVENT_CRIT_WARNING . " OR
criticity = " . EVENT_CRIT_CRITICAL . " ) " ;
break ;
case EVENT_CRIT_NOT_NORMAL :
$sql_post .= " AND criticity != " . EVENT_CRIT_NORMAL ;
break ;
default :
$sql_post .= " AND criticity = " . $this -> severity ;
break ;
}
}
if ( $this -> hours_old > 0 ) {
$unixtime = get_system_time () - ( $this -> hours_old * SECONDS_1HOUR );
$sql_post .= " AND (utimestamp > " . $unixtime . " ) " ;
}
if ( $this -> type != " " ) {
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
// for the user so for him is presented only "warning, critical and normal"
if ( $this -> type == " warning " || $this -> type == " critical "
|| $this -> type == " normal " ) {
$sql_post .= " AND event_type LIKE '% " . $this -> type . " %' " ;
}
elseif ( $this -> type == " not_normal " ) {
$sql_post .= " AND event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%' " ;
}
elseif ( $this -> type != " all " ) {
$sql_post .= " AND event_type = ' " . $this -> type . " ' " ;
}
}
2013-04-24 14:36:32 +02:00
$system = System :: getInstance ();
2016-09-28 16:56:05 +02:00
$groups = users_get_groups ( $system -> getConfig ( 'id_user' ), 'ER' );
2013-04-24 14:36:32 +02:00
//Group selection
if ( $this -> group > 0 && in_array ( $this -> group , array_keys ( $groups ))) {
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 a group is selected and it's in the groups allowed
2013-04-24 14:36:32 +02:00
$sql_post .= " AND id_grupo = " . $this -> group ;
}
else {
if ( is_user_admin ( $system -> getConfig ( 'id_user' ))) {
//Do nothing if you're admin, you get full access
$sql_post .= " " ;
}
else {
//Otherwise select all groups the user has rights to.
$sql_post .= " AND id_grupo IN ( " .
implode ( " , " , array_keys ( $groups )) . " ) " ;
}
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
}
2013-04-22 17:51:37 +02:00
if ( $this -> id_agent > 0 ) {
2013-07-03 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/module_graph.php,
mobile/operation/modules.php, mobile/operation/networkmaps.php,
mobile/operation/groups.php, mobile/operation/agents.php,
mobile/operation/tactical.php, mobile/operation/networkmap.php,
mobile/operation/alerts.php, mobile/operation/agent.php,
mobile/include/ui.class.php: added the back button in the head and
impoved the source code style to make more easy the merges with
the last branch.
* include/functions_graph.php: fixed PHP notices.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8468 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-07-03 15:59:38 +02:00
$sql_post .= " AND id_agente = " . $this -> id_agent ;
2013-04-09 11:29:03 +02:00
}
2013-04-24 14:36:32 +02:00
// Skip system messages if user is not PM
if ( ! check_acl ( $system -> getConfig ( 'id_user' ), 0 , " PM " )) {
$sql_post .= " AND id_grupo != 0 " ;
}
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
//--------------------------------------------------------------
2014-01-31 11:50:55 +01:00
if ( isset ( $this -> limit ) && $this -> limit != - 1 ) {
$offset = 0 ;
$pagination = $this -> limit ;
}
else {
$offset = $page * $system -> getPageSize ();
$pagination = $system -> getPageSize ();
}
2013-07-05 16:29:35 +02:00
2016-09-28 16:56:05 +02:00
$meta = false ;
if ( $system -> getConfig ( 'metaconsole' ))
$meta = true ;
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
$events_db = events_get_events_grouped ( $sql_post ,
2016-09-28 16:56:05 +02:00
$offset , $pagination , $meta , false );
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 ( empty ( $events_db )) {
$events_db = array ();
}
2016-09-28 16:56:05 +02:00
$total_events = events_get_total_events_grouped ( $sql_post , $meta );
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
return array ( 'events' => $events_db , 'total' => $total_events );
}
2014-01-31 11:50:55 +01:00
public function listEventsHtml ( $page = 0 , $return = false , $id_table = 'list_events' ) {
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
$system = System :: getInstance ();
2013-03-15 15:50:47 +01:00
$ui = Ui :: getInstance ();
2014-02-11 11:37:30 +01:00
// Create an empty table to be filled from ajax
$table = new Table ();
$table -> id = $id_table ;
$no_events = '<p id="empty_advice_events" class="empty_advice" style="display: none;">' . __ ( 'No events' ) . '</p>' ;
if ( ! $return ) {
$ui -> contentAddHtml ( $table -> getHTML ());
$ui -> contentAddHtml ( '<div id="loading_rows">' .
2016-09-28 16:56:05 +02:00
html_print_image ( 'images/spinner.gif' , true , false , false , false , false , true ) .
2014-02-11 11:37:30 +01:00
' ' . __ ( 'Loading...' ) .
'</div>' . $no_events );
$this -> addJavascriptAddBottom ();
$this -> addJavascriptDialog ();
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
}
else {
2014-02-11 11:37:30 +01:00
$this -> addJavascriptAddBottom ();
2014-01-31 11:50:55 +01:00
2014-02-12 13:07:58 +01:00
return array ( 'table' => $table -> getHTML () . $no_events );
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
}
2014-02-10 12:54:39 +01:00
$ui -> contentAddLinkListener ( 'list_events' );
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
}
2014-01-31 11:50:55 +01:00
public function putEventsTableJS ( $id_agent ) {
return " <script type= \" text/javascript \" >
ajax_load_latest_agent_events ( " . $id_agent . " , 10 );
</ script > " ;
}
2014-02-10 12:54:39 +01:00
public function addJavascriptDialog () {
2013-03-21 19:47:28 +01:00
$ui = Ui :: getInstance ();
$ui -> contentAddHtml ( "
< script type = \ " text/javascript \" >
function openDetails ( id_event ) {
$ . mobile . showPageLoadingMsg ();
postvars = {};
postvars [ \ " action \" ] = \" ajax \" ;
postvars [ \ " parameter1 \" ] = \" events \" ;
postvars [ \ " parameter2 \" ] = \" get_detail_event \" ;
2013-03-22 15:31:54 +01:00
postvars [ \ " id_event \" ] = id_event;
2013-03-21 19:47:28 +01:00
2013-03-22 15:31:54 +01:00
$ . ajax ({
type : \ " POST \" ,
url : \ " index.php \" ,
dataType : \ " json \" ,
data : postvars ,
success :
function ( data ) {
if ( data . correct ) {
event = data . event ;
//Fill the dialog
$ ( \ " #detail_event_dialog h1.dialog_title \" )
. html ( event [ \ " evento \" ]);
$ ( \ " #detail_event_dialog .cell_event_name \" )
. html ( event [ \ " evento \" ]);
$ ( \ " #detail_event_dialog .cell_event_id \" )
. html ( id_event );
$ ( \ " #detail_event_dialog .cell_event_timestamp \" )
. html ( event [ \ " timestamp \" ]);
$ ( \ " #detail_event_dialog .cell_event_owner \" )
. html ( event [ \ " owner_user \" ]);
$ ( \ " #detail_event_dialog .cell_event_type \" )
. html ( event [ \ " event_type \" ]);
$ ( \ " #detail_event_dialog .cell_event_repeated \" )
. html ( event [ \ " event_repeated \" ]);
$ ( \ " #detail_event_dialog .cell_event_severity \" )
. html ( event [ \ " criticity \" ]);
$ ( \ " #detail_event_dialog .cell_event_status \" )
. html ( event [ \ " status \" ]);
$ ( \ " #detail_event_dialog .cell_event_acknowledged_by \" )
. html ( event [ \ " acknowledged_by \" ]);
$ ( \ " #detail_event_dialog .cell_event_group \" )
. html ( event [ \ " group \" ]);
$ ( \ " #detail_event_dialog .cell_event_tags \" )
. html ( event [ \ " tags \" ]);
2014-08-13 03:57:55 +02:00
$ ( \ " #detail_event_dialog .cell_event_comments \" )
. html ( event [ \ " comments \" ]);
2013-11-26 14:08:27 +01:00
$ ( \ " #detail_event_dialog .cell_agent \" )
. html ( event [ \ " agent \" ]);
2013-03-22 15:31:54 +01:00
2013-04-05 15:07:03 +02:00
//The link to module graph
2014-01-30 11:44:54 +01:00
$ ( \ " .cell_module_graph \" ).html(event[ \" module_graph_link \" ]);
2013-04-05 15:07:03 +02:00
2013-03-22 15:31:54 +01:00
$ ( \ " #event_id \" ).val(id_event);
if ( event [ \ " estado \" ] != 1) {
$ ( \ " #validate_button \" ).show();
}
else {
//The event is validated.
$ ( \ " #validate_button \" ).hide();
}
$ ( \ " #validate_button_loading \" ).hide();
$ ( \ " #validate_button_fail \" ).hide();
$ ( \ " #validate_button_correct \" ).hide();
$ . mobile . hidePageLoadingMsg ();
$ ( \ " #detail_event_dialog_hook \" ).click();
}
else {
$ . mobile . hidePageLoadingMsg ();
$ ( \ " #detail_event_dialog_error_hook \" ).click();
}
},
error :
function ( jqXHR , textStatus , errorThrown ) {
2013-03-21 19:47:28 +01:00
$ . mobile . hidePageLoadingMsg ();
2013-03-22 15:31:54 +01:00
$ ( \ " #detail_event_dialog_error_hook \" ).click();
}
});
}
function validateEvent () {
id_event = $ ( \ " #event_id \" ).val();
$ ( \ " #validate_button \" ).hide();
$ ( \ " #validate_button_loading \" ).show();
//Hide the button to close
$ ( \ " #detail_event_dialog div.ui-header a.ui-btn-right \" )
. hide ();
postvars = {};
postvars [ \ " action \" ] = \" ajax \" ;
postvars [ \ " parameter1 \" ] = \" events \" ;
postvars [ \ " parameter2 \" ] = \" validate_event \" ;
postvars [ \ " id_event \" ] = id_event;
$ . ajax ({
type : \ " POST \" ,
url : \ " index.php \" ,
dataType : \ " json \" ,
data : postvars ,
success :
function ( data ) {
$ ( \ " #validate_button_loading \" ).hide();
if ( data . correct ) {
$ ( \ " #validate_button_correct \" ).show();
}
else {
$ ( \ " #validate_button_fail \" ).show();
}
2013-03-21 19:47:28 +01:00
2013-03-22 15:31:54 +01:00
$ ( \ " #detail_event_dialog div.ui-header a.ui-btn-right \" )
. show ();
},
error :
function ( jqXHR , textStatus , errorThrown ) {
$ ( \ " #validate_button_loading \" ).hide();
$ ( \ " #validate_button_fail \" ).show();
$ ( \ " #detail_event_dialog div.ui-header a.ui-btn-right \" )
. show ();
2013-03-21 19:47:28 +01:00
}
2013-03-22 15:31:54 +01:00
});
2013-03-21 19:47:28 +01:00
}
</ script > " );
}
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
private function addJavascriptAddBottom () {
$ui = Ui :: getInstance ();
$ui -> contentAddHtml ( " <script type= \" text/javascript \" >
var load_more_rows = 1 ;
2013-11-27 17:54:53 +01:00
var page = 0 ;
2014-01-31 11:50:55 +01:00
function add_rows ( data , table_id ) {
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
if ( data . end ) {
$ ( \ " #loading_rows \" ).hide();
}
else {
2014-02-12 13:07:58 +01:00
var new_rows = \ " \" ;
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
$ . each ( data . events , function ( key , event ) {
2014-02-12 13:07:58 +01:00
new_rows = \ " <tr class='events \" + event[2] + \" '> \" +
2017-02-13 16:06:17 +01:00
\ " <td class='cell_0' style='vertical-align:middle;'> \" +
2013-04-01 18:27:19 +02:00
event [ 0 ] +
\ " </td> \" +
2017-02-13 16:06:17 +01:00
\ " <td style='vertical-align:middle;'> \" + event[1] + \" </td> \" +
2014-02-12 13:07:58 +01:00
\ " </tr> \" + new_rows;
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
});
2014-02-12 13:07:58 +01:00
$ ( \ " table# \" +table_id+ \" tbody \" ).append(new_rows);
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
load_more_rows = 1 ;
2014-02-10 12:54:39 +01:00
refresh_link_listener_list_events ();
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
}
}
function ajax_load_rows () {
if ( load_more_rows ) {
load_more_rows = 0 ;
postvars = {};
postvars [ \ " action \" ] = \" ajax \" ;
postvars [ \ " parameter1 \" ] = \" events \" ;
postvars [ \ " parameter2 \" ] = \" get_events \" ;
postvars [ \ " filter \" ] = $ ( \" select[name='filter'] \" ).val();
postvars [ \ " group \" ] = $ ( \" select[name='group'] \" ).val();
postvars [ \ " status \" ] = $ ( \" select[name='status'] \" ).val();
postvars [ \ " type \" ] = $ ( \" select[name='type'] \" ).val();
postvars [ \ " severity \" ] = $ ( \" select[name='severity'] \" ).val();
postvars [ \ " free_search \" ] = $ ( \" input[name='free_search'] \" ).val();
postvars [ \ " hours_old \" ] = $ ( \" input[name='hours_old'] \" ).val();
postvars [ \ " page \" ] = page;
page ++ ;
$ . post ( \ " index.php \" ,
postvars ,
function ( data ) {
2014-01-31 11:50:55 +01:00
add_rows ( data , 'list_events' );
if ( $ ( '#list_events' ) . offset () != undefined ) {
//For large screens load the new events
//Check if the end of the event list tables is in the client limits
var table_end = $ ( '#list_events' ) . offset () . top + $ ( '#list_events' ) . height ();
if ( table_end < document . documentElement . clientHeight ) {
ajax_load_rows ();
}
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
}
2014-02-11 11:37:30 +01:00
if ( data . events . length == 0 && page == 1 ) {
$ ( '#empty_advice_events' ) . show ();
}
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
},
\ " json \" );
}
}
2014-01-31 11:50:55 +01:00
function ajax_load_latest_agent_events ( id_agent , limit ) {
postvars = {};
postvars [ \ " action \" ] = \" ajax \" ;
postvars [ \ " parameter1 \" ] = \" events \" ;
postvars [ \ " parameter2 \" ] = \" get_events \" ;
postvars [ \ " agent_events \" ] = \" 1 \" ;
postvars [ \ " id_agent \" ] = id_agent;
postvars [ \ " limit \" ] = limit;
2013-12-13 12:50:20 +01:00
2014-01-31 11:50:55 +01:00
$ . post ( \ " index.php \" ,
postvars ,
function ( data ) {
add_rows ( data , 'last_agent_events' );
2014-02-11 11:37:30 +01:00
if ( data . events . length == 0 ) {
$ ( '#last_agent_events' ) . css ( 'visibility' , 'hidden' );
$ ( '#empty_advice_events' ) . show ();
}
2014-01-31 11:50:55 +01:00
},
\ " json \" );
}
$ ( document ) . ready ( function () {
ajax_load_rows ();
$ ( window ) . bind ( \ " scroll \" , function () {
custom_scroll ();
});
$ ( window ) . on ( \ " touchmove \" , function(event) {
custom_scroll ();
});
2013-12-13 12:50:20 +01:00
});
function custom_scroll () {
if ( $ ( this ) . scrollTop () + $ ( this ) . height ()
2013-11-20 11:03:31 +01:00
>= ( $ ( document ) . height () - 100 )) {
2013-03-27 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/events.php, mobile/operation/tactical.php,
mobile/include/ui.class.php, mobile/include/style/main.css,
mobile/images/datos_blue.png, mobile/images/datos_brown.png,
mobile/images/datos_green.png, mobile/images/datos_pink.png,
mobile/images/datos_grey.png, mobile/images/datos_red.png,
mobile/images/datos_yellow.png: some fixes and changes in the
Pandora mobile.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7895 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2013-03-27 18:51:35 +01:00
ajax_load_rows ();
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
}
2013-12-13 12:50:20 +01:00
}
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
</ script > " );
2013-03-15 15:50:47 +01:00
}
private function filterEventsGetString () {
2013-12-05 16:33:53 +01:00
global $system ;
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 ( $this -> default ) {
2013-03-15 15:50:47 +01:00
return __ ( " (Default) " );
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
}
2013-03-15 15:50:47 +01:00
else {
if ( $this -> filter ) {
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
$filter = db_get_row ( 'tevent_filter' , 'id_filter' , $this -> filter );
return sprintf ( __ ( 'Filter: %s' ), $filter [ 'id_name' ]);
2013-03-15 15:50:47 +01:00
}
else {
2013-07-08 12:15:49 +02:00
$filters_to_serialize = array ();
2013-11-22 14:24:28 +01:00
if ( $this -> severity == - 1 ) {
$severity = __ ( 'All' );
}
else {
$severity = get_priorities ( $this -> severity );
}
2013-07-08 12:15:49 +02:00
if ( ! $this -> default_filters [ 'severity' ]) {
$filters_to_serialize [] = sprintf ( __ ( " Severity: %s " ),
2013-11-22 14:24:28 +01:00
$severity );
2013-07-08 12:15:49 +02:00
}
if ( ! $this -> default_filters [ 'group' ]) {
$groups = users_get_groups_for_select (
$system -> getConfig ( 'id_user' ), " ER " , true , true , false , 'id_grupo' );
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
2013-07-08 12:15:49 +02:00
$filters_to_serialize [] = sprintf ( __ ( " Group: %s " ),
$groups [ $this -> group ]);
}
2013-11-22 14:24:28 +01:00
if ( $this -> type == 'all' ) {
$type = __ ( 'All' );
}
else {
$type = get_event_types ( $this -> type );
}
2013-07-08 12:15:49 +02:00
if ( ! $this -> default_filters [ 'type' ]) {
$filters_to_serialize [] = sprintf ( __ ( " Type: %s " ),
2013-11-22 14:24:28 +01:00
$type );
2013-07-08 12:15:49 +02:00
}
if ( ! $this -> default_filters [ 'status' ]) {
$filters_to_serialize [] = sprintf ( __ ( " Status: %s " ),
events_get_status ( $this -> status ));
}
if ( ! $this -> default_filters [ 'free_search' ]) {
$filters_to_serialize [] = sprintf ( __ ( " Free search: %s " ),
$this -> free_search );
}
if ( ! $this -> default_filters [ 'hours_old' ]) {
$filters_to_serialize [] = sprintf ( __ ( " Hours: %s " ),
$this -> hours_old );
}
$string = '(' . implode ( ' - ' , $filters_to_serialize ) . ')' ;
2013-03-15 15:50:47 +01:00
return $string ;
}
}
}
}
2013-11-19 14:28:35 +01:00
?>