0)); if ($current_modules_agent != false) { // And their modules foreach ($current_modules_agent as $current_module) { $module_alerts = alerts_get_alerts_agent_module($current_module); if ($module_alerts != false) { // And for all alert in modules foreach ($module_alerts as $module_alert) { // Find the template in module if ($module_alert['id_alert_template'] == $id_alert_template) $modules_id[] = $module_alert['id_agent_module']; } } } } } } } $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("Massive management", "Delete alert ", false, false, 'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names); } else { db_pandora_audit("Massive 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] = __('When select agents'); $table->data[2][2] .= '
'; $table->data[2][2] .= html_print_select (array('common' => __('Show common modules'), 'all' => __('Show all modules')), 'modules_selection_mode', 'common', false, '', '', true); $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'); ?>