'.__('No agents selected').''; return false; } if (empty ($id_alert_template)) { echo '

'.__('No alert selected').'

'; return false; } process_sql_begin (); $modules = get_agent_modules ($id_agents, 'id_agente_modulo', false, true); $contfail = 0; $contsuccess = 0; foreach($modules as $module){ $success = create_alert_agent_module ($module, $id_alert_template); if(!$success) $contfail = $contfail + 1; else $contsuccess = $contsuccess + 1; } if ($contfail > 0) { echo '

'.__('There was an error adding the alerts, the operation has been cancelled').'

'; echo '

'.__('Could not add alerts').'

'; process_sql_rollback (); } else { echo '

'.__('Successfully added').' '.$contsuccess.' '.__('Alerts').'

'; process_sql_commit (); } } $id_group = (int) get_parameter ('id_group', -1); $id_agents = get_parameter ('id_agents'); $id_alert_template = (int) get_parameter ('id_alert_template'); $add = (bool) get_parameter_post ('add'); if ($add) { process_manage_add ($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 (); $table->data[0][0] = __('Group'); $table->data[0][1] = print_select_groups(false, "AR", true, 'id_group', $id_group, '', 'Select', -1, true, false, true, '', false); $table->data[1][0] = __('Agent'); $table->data[1][0] .= ''; $agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group, false, array ('tagente.nombre', 'tagente.id_agente')); $table->data[1][1] = print_select (index_array ($agents_alerts, 'id_agente', 'nombre'), 'id_agents[]', '', '', '', '', true, true, true, '', false); $templates = get_alert_templates (false, array ('id', 'name')); $table->data[2][0] = __('Alert template'); $table->data[2][1] = print_select (index_array ($templates, 'id', 'name'), 'id_alert_template', $id_alert_template, false, __('Select'), 0, true); echo '
'; print_table ($table); echo '
'; print_input_hidden ('add', 1); print_submit_button (__('Add'), 'go', false, 'class="sub add"'); echo '
'; echo '
'; echo ''; require_jquery_file ('form'); require_jquery_file ('pandora.controls'); ?>