".__('Agent configuration')." > ".__('Alerts').""; $create_alert = (bool) get_parameter ('create_alert'); $add_action = (bool) get_parameter ('add_action'); if ($create_alert) { $id_alert_template = (int) get_parameter ('template'); $id_agent_module = (int) get_parameter ('id_agent_module'); $id = create_alert_agent_module ($id_agent_module, $id_alert_template); print_error_message ($id, __('Successfully created'), __('Could not be created')); if ($id !== false) { $id_alert_action = (int) get_parameter ('action'); $fires_min = (int) get_parameter ('fires_min'); $fires_max = (int) get_parameter ('fires_max'); $values = array (); if ($fires_min != -1) $values['fires_min'] = $fires_min; if ($fires_max != -1) $values['fires_max'] = $fires_max; add_alert_agent_module_action ($id, $id_alert_action, $values); } } if ($add_action) { $id_action = (int) get_parameter ('action'); $id_alert_module = (int) get_parameter ('id_alert_module'); $fires_min = (int) get_parameter ('fires_min'); $fires_max = (int) get_parameter ('fires_max'); $values = array (); if ($fires_min != -1) $values['fires_min'] = $fires_min; if ($fires_max != -1) $values['fires_max'] = $fires_max; $result = add_alert_agent_module_action ($id_alert_module, $id_action, $values); print_error_message ($id, __('Successfully added'), __('Could not be added')); } $modules = get_agent_modules ($id_agente, array ('id_tipo_modulo', 'nombre', 'id_agente')); echo "

".__('Modules defined')."

"; $table->id = 'modules'; $table->cellspacing = '0'; $table->width = '90%'; $table->head = array (); $table->head[0] = __('Module'); $table->data = array (); $table->style = array (); $table->style[1] = 'vertical-align: top'; $table_alerts->class = 'listing'; $table_alerts->width = '100%'; $table_alerts->size = array (); $table_alerts->size[0] = '50%'; $table_alerts->size[1] = '50%'; $table_alerts->style = array (); $table_alerts->style[0] = 'vertical-align: top'; $table_alerts->style[1] = 'vertical-align: top'; foreach ($modules as $id_agent_module => $module) { $data = array (); $last_data = return_value_agent_module ($id_agent_module); if ($last_data === false) $last_data = ''.__('N/A').''; $data[0] = ''.$module['nombre'].''; $data[0] .= ''; $data[0] .= ''; /* Alerts in module list */ $table_alerts->id = 'alerts-'.$id_agent_module; $table_alerts->data = array (); $alerts = get_alerts_agent_module ($id_agent_module); if ($alerts === false) { $alerts = array (); } else { $data[0] .= '

'; $data[0] .= __('Alerts'); $data[0] .= '

'; } foreach ($alerts as $alert) { $alert_data = array (); $alert_actions = get_alert_agent_module_actions ($alert['id']); $alert_data[0] = get_alert_template_name ($alert['id_alert_template']); $alert_data[0] .= ''; $alert_data[1] = ''; $alert_data[1] .= ''; $table_alerts->data['alert-'.$alert['id']] = $alert_data; } $data[0] .= print_table ($table_alerts, true); array_push ($table->data, $data); } print_table ($table); /* This hidden value is used in Javascript. It's a workaraound for IE because it doesn't allow input elements creation. */ print_input_hidden ('add_action', 1); print_input_hidden ('id_alert_module', 0); echo ''; ?>