'.__('Massive alerts deletion').'';
function process_manage_delete ($id_alert_template, $id_agents) {
if (empty ($id_alert_template)) {
echo '
'.__('No alert selected').'
';
return false;
}
if (empty ($id_agents)) {
echo ''.__('No agents selected').'
';
return false;
}
process_sql_begin ();
$modules = get_agent_modules ($id_agents, 'id_agente_modulo', false, true);
$success = delete_alert_agent_module (false,
array ('id_agent_module' => $modules,
'id_alert_template' => $id_alert_template));
if (! $success) {
echo ''.__('There was an error deleting the alerts, the operation has been cancelled').'
';
echo ''.__('Could not delete alerts').'
';
process_sql_rollback ();
} else {
echo ''.__('Successfully deleted').'
';
process_sql_commit ();
}
}
$id_group = (int) get_parameter ('id_group');
$id_agents = get_parameter ('id_agents');
$id_alert_template = (int) get_parameter ('id_alert_template');
$delete = (bool) get_parameter_post ('delete');
if ($delete) {
process_manage_delete ($id_alert_template, $id_agents);
}
$groups = get_user_groups ();
$table->id = 'delete_table';
$table->width = '95%';
$table->data = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold; vertical-align:top';
$table->style[2] = 'font-weight: bold';
$table->size = array ();
$table->size[0] = '15%';
$table->size[1] = '85%';
$table->data = array ();
$templates = get_alert_templates (false, array ('id', 'name'));
$table->data[0][0] = __('Alert template');
$table->data[0][1] = print_select (index_array ($templates, 'id', 'name'),
'id_alert_template', $id_alert_template, false, __('Select'), 0, true);
$table->data[1][0] = __('Group');
$table->data[1][1] = print_select ($groups, 'id_group', $id_group,
'', '', '', true, false, true, '', $id_alert_template == 0);
$table->data[2][0] = __('Agent');
$table->data[2][0] .= '';
$table->data[2][0] .= '';
$table->data[2][0] .= '';
$agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
$table->data[2][1] = print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
'id_agents[]', '', '', '', '', true, true, true, '', $id_alert_template == 0);
echo '';
echo '
';
require_jquery_file ('form');
require_jquery_file ('pandora.controls');
?>