2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
<?php
|
2021-01-14 19:08:01 +01:00
|
|
|
/**
|
|
|
|
* Alerts Status functions script
|
|
|
|
*
|
|
|
|
* @category Functions
|
|
|
|
* @package Pandora FMS
|
|
|
|
* @subpackage Alert Status
|
|
|
|
* @version 1.0.0
|
|
|
|
* @license See below
|
|
|
|
*
|
|
|
|
* ______ ___ _______ _______ ________
|
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
*
|
|
|
|
* ============================================================================
|
|
|
|
* Copyright (c) 2005-2021 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.
|
|
|
|
* ============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Begin.
|
2019-01-30 16:18:44 +01:00
|
|
|
function forceExecution($id_group)
|
|
|
|
{
|
|
|
|
global $config;
|
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
include_once 'include/functions_alerts.php';
|
|
|
|
$id_alert = (int) get_parameter('id_alert');
|
|
|
|
alerts_agent_module_force_execution($id_alert);
|
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
2022-07-15 12:15:37 +02:00
|
|
|
function validateAlert($ids)
|
2019-01-30 16:18:44 +01:00
|
|
|
{
|
|
|
|
if (!empty($ids)) {
|
|
|
|
include_once 'include/functions_alerts.php';
|
|
|
|
$result = alerts_validate_alert_agent_module($ids);
|
|
|
|
|
2022-07-15 12:15:37 +02:00
|
|
|
return ui_print_result_message(
|
2019-01-30 16:18:44 +01:00
|
|
|
$result,
|
|
|
|
__('Alert(s) validated'),
|
2022-07-15 12:15:37 +02:00
|
|
|
__('Error processing alert(s)'),
|
|
|
|
'',
|
|
|
|
true
|
2019-01-30 16:18:44 +01:00
|
|
|
);
|
2022-07-15 12:15:37 +02:00
|
|
|
} else {
|
|
|
|
return ui_print_error_message(__('No alert selected'));
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
function printFormFilterAlert($id_group, $filter, $free_search, $url, $filter_standby=false, $tag_filter=false, $action_filter=false, $return=false, $strict_user=false, $access='AR')
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
include_once $config['homedir'].'/include/functions_tags.php';
|
|
|
|
|
|
|
|
$table = new StdClass();
|
|
|
|
$table->width = '100%';
|
2022-07-15 12:15:37 +02:00
|
|
|
$table->class = 'databox filters no-border';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->cellpadding = '0';
|
|
|
|
$table->cellspacing = '0';
|
|
|
|
if (defined('METACONSOLE')) {
|
2022-07-15 12:15:37 +02:00
|
|
|
$table->class = 'databox filters no-border';
|
2019-01-30 16:18:44 +01:00
|
|
|
$table->width = '100%';
|
|
|
|
$table->cellpadding = '0';
|
|
|
|
$table->cellspacing = '0';
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->data = [];
|
|
|
|
$table->style = [];
|
|
|
|
$table->style[0] = 'font-weight: bold;';
|
|
|
|
$table->style[1] = 'font-weight: bold;';
|
|
|
|
$table->style[2] = 'font-weight: bold;';
|
|
|
|
$table->style[3] = 'font-weight: bold;';
|
|
|
|
$table->style[4] = 'font-weight: bold;';
|
|
|
|
if (defined('METACONSOLE')) {
|
|
|
|
$table->style[0] = 'font-weight: bold;';
|
|
|
|
$table->style[1] = 'font-weight: bold;';
|
|
|
|
$table->style[2] = 'font-weight: bold;';
|
|
|
|
$table->style[3] = 'font-weight: bold;';
|
|
|
|
$table->style[4] = 'font-weight: bold;';
|
|
|
|
}
|
|
|
|
|
|
|
|
$table->data[0][0] = __('Group');
|
|
|
|
$table->data[0][1] = html_print_select_groups($config['id_user'], $access, true, 'ag_group', $id_group, '', '', '', true, false, false, '', false, '', false, false, 'id_grupo', $strict_user);
|
|
|
|
|
|
|
|
$alert_status_filter = [];
|
|
|
|
$alert_status_filter['all_enabled'] = __('All (Enabled)');
|
|
|
|
$alert_status_filter['all'] = __('All');
|
|
|
|
$alert_status_filter['fired'] = __('Fired');
|
|
|
|
$alert_status_filter['notfired'] = __('Not fired');
|
|
|
|
$alert_status_filter['disabled'] = __('Disabled');
|
|
|
|
|
|
|
|
$alert_standby = [];
|
2022-07-15 12:15:37 +02:00
|
|
|
$alert_standby['1'] = __('Standby on');
|
|
|
|
$alert_standby['0'] = __('Standby off');
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$table->data[0][2] = __('Status');
|
2022-07-15 12:15:37 +02:00
|
|
|
$table->data[0][3] = html_print_select($alert_status_filter, 'disabled', $filter, '', '', '', true);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$table->data[0][4] = __('Tags').ui_print_help_tip(__('Only it is show tags in use.'), true);
|
|
|
|
|
|
|
|
$tags = tags_get_user_tags();
|
|
|
|
|
|
|
|
if (empty($tags)) {
|
|
|
|
$table->data[0][5] .= html_print_input_text('tags', __('No tags'), '', 20, 40, true, true);
|
|
|
|
} else {
|
2022-07-15 12:15:37 +02:00
|
|
|
$table->data[0][5] .= html_print_select($tags, 'tag', $tag_filter, '', __('All'), '', true, false, true, '', false, 'width: 150px;');
|
2019-01-30 16:18:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$table->data[1][0] = __('Free text for search').ui_print_help_tip(
|
|
|
|
__('Filter by agent name, module name, template name or action name'),
|
|
|
|
true
|
|
|
|
);
|
|
|
|
$table->data[1][1] = html_print_input_text('free_search', $free_search, '', 20, 40, true);
|
|
|
|
|
|
|
|
$table->data[1][2] = __('Standby');
|
2022-07-15 12:15:37 +02:00
|
|
|
$table->data[1][3] = html_print_select($alert_standby, 'standby', $filter_standby, '', __('All'), '', true);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$table->data[1][4] = __('Action');
|
|
|
|
$alert_action = alerts_get_alert_actions_filter();
|
|
|
|
|
2022-07-15 12:15:37 +02:00
|
|
|
$table->data[1][5] = html_print_select($alert_action, 'action', $action_filter, '', __('All'), '', true);
|
2019-01-30 16:18:44 +01:00
|
|
|
|
|
|
|
$data .= html_print_table($table, true);
|
|
|
|
|
|
|
|
if ($return) {
|
|
|
|
return $data;
|
|
|
|
} else {
|
|
|
|
echo $data;
|
|
|
|
}
|
2010-04-05 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: changed some parts of source code in the
functions "format_alert_row" for show column modules in general view. In the
function "pagination" added the parameter $offset_name with default value
'offset' for to use several paginations in one page.
* include/functions_agents.php: added the parameters $limit, $idGroup,
$count in the function "get_agent_alerts_simple", and now you can limit the
rows, search by id group and return the count of rows (without limit). And
in the function "get_agent_alerts_compound" added the same parameters to
another function $idGroup, $limit, $count for similar uses.
* operation/agentes/alerts_status.php: cleaned more parts of source code,
fixed the mad array_merge of alerts, fixed SQL with the searchs IN
(large large list ids), fixed the pagination before loop all rows, now
only loop the block page rows.
* operation/agentes/alerts_status.functions.php: new file with the functions
"forceExecution", "validateAlert", and "printFormFilterAlert".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2542 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-04-06 14:46:34 +02:00
|
|
|
}
|
2020-03-12 10:47:59 +01:00
|
|
|
|
|
|
|
|
2022-07-15 12:15:37 +02:00
|
|
|
function printFormFilterAlertAgent($agent_view_page, $free_search, $id_agent, $return=false)
|
2020-03-12 10:47:59 +01:00
|
|
|
{
|
|
|
|
$table_filter = new stdClass();
|
|
|
|
$table_filter->width = '100%';
|
|
|
|
|
|
|
|
if ($agent_view_page === true) {
|
|
|
|
$table_filter->class = 'info_table';
|
|
|
|
$table_filter->styleTable = 'border-radius: 0;padding: 0;margin: 0;';
|
|
|
|
$free_search_name = 'free_search_alert';
|
|
|
|
} else {
|
|
|
|
$table_filter->class = 'databox filters';
|
|
|
|
$free_search_name = 'free_search';
|
|
|
|
}
|
|
|
|
|
|
|
|
$table_filter->style = [];
|
|
|
|
$table_filter->style[0] = 'font-weight: bold';
|
|
|
|
$table_filter->data = [];
|
|
|
|
|
|
|
|
$table_filter->data[0][0] = __('Free text for search (*):').ui_print_help_tip(
|
|
|
|
__('Filter by module name, template name or action name'),
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
2021-03-11 15:40:23 +01:00
|
|
|
$table_filter->data[0][0] .= '<span class="mrgn_lft_10px">'.html_print_input_text(
|
2020-03-12 10:47:59 +01:00
|
|
|
$free_search_name,
|
|
|
|
$free_search,
|
|
|
|
'',
|
|
|
|
20,
|
|
|
|
100,
|
|
|
|
true
|
|
|
|
).'</span>';
|
|
|
|
|
2022-07-15 12:15:37 +02:00
|
|
|
$form = html_print_table($table_filter, true);
|
2020-03-12 10:47:59 +01:00
|
|
|
|
2022-07-15 12:15:37 +02:00
|
|
|
if ($return === true) {
|
|
|
|
return $form;
|
2020-03-12 10:47:59 +01:00
|
|
|
} else {
|
2022-07-15 12:15:37 +02:00
|
|
|
echo $form;
|
2020-03-12 10:47:59 +01:00
|
|
|
}
|
|
|
|
}
|