'.__('No alert selected').''; return false; } if (empty ($id_agents) || $id_agents[0] == 0) { echo '

'.__('No agents selected').'

'; return false; } foreach($module_names as $module){ foreach($id_agents as $id_agent) { $module_id = modules_get_agentmodule_id($module, $id_agent); $modules_id[] = $module_id['id_agente_modulo']; } } if(count($module_names) == 1 && $module_names[0] == '0'){ $modules_id = agents_common_modules_with_alerts ($id_agents, false, true); } $conttotal = 0; $contsuccess = 0; foreach($modules_id as $module){ $success = alerts_delete_alert_agent_module (false, array ('id_agent_module' => $module, 'id_alert_template' => $id_alert_template)); if($success) $contsuccess ++; $conttotal ++; } ui_print_result_message ($contsuccess > 0, __('Successfully deleted')."(".$contsuccess."/".$conttotal.")", __('Could not be deleted')); return (bool)($contsuccess > 0); } $id_group = (int) get_parameter ('id_group'); $id_agents = get_parameter ('id_agents'); $module_names = get_parameter ('module'); $id_alert_template = (int) get_parameter ('id_alert_template'); $delete = (bool) get_parameter_post ('delete'); if ($delete) { $result = process_manage_delete ($id_alert_template, $id_agents, $module_names); if ($result) { db_pandora_audit("Masive management", "Delete alert ", false, false, 'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names); } else { db_pandora_audit("Masive management", "Fail try to delete alert", false, false, 'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names); } } $groups = users_get_groups (); $table->id = 'delete_table'; $table->width = '98%'; $table->data = array (); $table->style = array (); $table->style[0] = 'font-weight: bold; vertical-align:top'; $table->style[2] = 'font-weight: bold; vertical-align:top'; $table->size = array (); $table->size[0] = '15%'; $table->size[1] = '40%'; $table->size[2] = '15%'; $table->size[3] = '40%'; $table->data = array (); $templates = alerts_get_alert_templates (false, array ('id', 'name')); $table->data[0][0] = __('Alert template'); $table->data[0][1] = html_print_select (index_array ($templates, 'id', 'name'), 'id_alert_template', $id_alert_template, false, __('Select'), 0, true); $table->data[0][2] = ''; $table->data[0][3] = ''; $table->data[1][0] = __('Group'); $table->data[1][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', '', true, false, true, '', $id_alert_template == 0); $table->data[1][2] = __('Group recursion'); $table->data[1][3] = html_print_checkbox ("recursion", 1, false, true, false); $table->data[2][0] = __('Agents'); $table->data[2][0] .= ''; $agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group, false, array ('tagente.nombre', 'tagente.id_agente')); $table->data[2][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'nombre'), 'id_agents[]', '', '', '', '', true, true, true, '', $id_alert_template == 0); $table->data[2][2] = __('Modules'); $table->data[2][3] = html_print_select (array(), 'module[]', '', false, '', '', true, true, false); echo '
'; html_print_table ($table); echo '
'; html_print_input_hidden ('delete', 1); html_print_submit_button (__('Delete'), 'go', false, 'class="sub delete"'); echo '
'; echo '
'; //Hack to translate text "none" in PHP to javascript echo ''; echo ''; ui_require_jquery_file ('form'); ui_require_jquery_file ('pandora.controls'); ?>