'event_fields', 'value' => $event_fields, ]; // Update 'event_fields' in tconfig table to keep the value at update. $result = db_process_sql_update( 'tconfig', $values, ['token' => 'event_fields'] ); $config['event_fields'] = $event_fields; } $fields_selected = []; $event_fields = ''; $fields_selected = explode(',', $config['event_fields']); $result_selected = []; // Show list of fields selected. if ($fields_selected[0] != '') { foreach ($fields_selected as $field_selected) { $result_selected[$field_selected] = events_get_column_name( $field_selected ); } } $event = []; echo '

'.__('Show event fields'); echo ' '; html_print_image('images/clean.png', false, ['title' => __('Load the fields from previous events'), 'onclick' => "if (! confirm ('".__('Event fields will be loaded. Do you want to continue?')."')) return false"]); echo '

'; $table = new stdClass(); $table->width = '100%'; $table->class = 'databox filters'; $table->size = []; $table->size[1] = '10px'; $table->style[0] = 'text-align:center;'; $table->style[2] = 'text-align:center;'; $table->data = []; $fields_available = []; $fields_available['id_evento'] = __('Event Id'); $fields_available['evento'] = __('Event Name'); $fields_available['id_agente'] = __('Agent ID'); $fields_available['agent_name'] = __('Agent Name'); $fields_available['direccion'] = __('Agent IP'); $fields_available['id_usuario'] = __('User'); $fields_available['id_grupo'] = __('Group'); $fields_available['estado'] = __('Status'); $fields_available['timestamp'] = __('Timestamp'); $fields_available['event_type'] = __('Event Type'); $fields_available['id_agentmodule'] = __('Module Name'); $fields_available['id_alert_am'] = __('Alert'); $fields_available['criticity'] = __('Severity'); $fields_available['user_comment'] = __('Comment'); $fields_available['tags'] = __('Tags'); $fields_available['source'] = __('Source'); $fields_available['id_extra'] = __('Extra Id'); $fields_available['owner_user'] = __('Owner'); $fields_available['ack_utimestamp'] = __('ACK Timestamp'); $fields_available['instructions'] = __('Instructions'); $fields_available['server_name'] = __('Server Name'); $fields_available['data'] = __('Data'); $fields_available['module_status'] = __('Module Status'); $fields_available['mini_severity'] = __('Severity mini'); $fields_available['module_custom_id'] = __('Module custom ID'); $fields_available['custom_data'] = __('Custom data'); // Remove fields already selected. foreach ($fields_available as $key => $available) { if (isset($result_selected[$key])) { unset($fields_available[$key]); } } $table->data[0][0] = ''.__('Fields available').''; $table->data[1][0] = html_print_select($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px'); $table->data[1][1] = ''.html_print_image( 'images/arrow@svg.svg', true, [ 'id' => 'right', 'title' => __('Add fields to select'), 'style' => 'rotate: 180deg; width: 40px', ] ).''; $table->data[1][1] .= '



'.html_print_image( 'images/arrow@svg.svg', true, [ 'id' => 'left', 'title' => __('Delete fields to select'), 'style' => 'width: 40px', ] ).''; $table->data[0][1] = ''; $table->data[0][2] = ''.__('Fields selected').''; $table->data[1][2] = '
'.html_print_select( $result_selected, 'fields_selected[]', true, '', '', 0, true, true, false, '', false, 'width: 300px' ); $table->data[1][2] .= '
'; $table->data[1][2] .= ''.html_print_image( 'images/darrowup.png', true, [ 'onclick' => 'sortUpDown(\'up\');', 'title' => __('Move up selected fields'), ] ).''; $table->data[1][2] .= ''.html_print_image( 'images/darrowdown.png', true, [ 'onclick' => 'sortUpDown(\'down\');', 'title' => __('Move down selected fields'), ] ).''; $table->data[1][2] .= '
'; echo '
'; html_print_table($table); html_print_action_buttons( html_print_submit_button( __('Update'), 'upd_button', false, [ 'icon' => 'update' ], true ), [ 'type' => 'form_action' ] ); echo '
'; ?>