diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0399940aea..850e663843 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,21 @@ +2012-10-09 Sergio Martin + + * include/functions_events.php + include/styles/jquery-ui-1.8.23.custom.css + include/javascript/pandora_events.js + include/ajax/events.php + operation/events/events_list.php + operation/events/events.php + extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql + godmode/menu.php + godmode/events/event_responses.list.php + godmode/events/custom_events.php + godmode/events/event_responses.php + godmode/events/events.php + godmode/events/event_responses.editor.php: Added several changes on + events system as responses editor and performer, and several + fixes + 2012-10-09 Miguel de Dios * extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql index e7b6d4bd2f..d853182627 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql @@ -316,3 +316,20 @@ ALTER TABLE tnetwork_map ADD `pandoras_children` TINYINT(1) UNSIGNED NOT NULL DE -- Table `tagente_estado` -- ---------------------------------------------------------------------- ALTER TABLE `tagente_estado` ADD COLUMN `last_known_status` tinyint(4) NOT NULL DEFAULT 0; + +-- --------------------------------------------------------------------- +-- Table `tevent_response` +-- --------------------------------------------------------------------- +CREATE TABLE IF NOT EXISTS `tevent_response` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(600) NOT NULL default '', + `description` TEXT NOT NULL, + `target` TEXT NOT NULL, + `type` varchar(60) NOT NULL, + `id_group` MEDIUMINT(4) NOT NULL default 0, + `modal_width` INTEGER NOT NULL DEFAULT 0, + `modal_height` INTEGER NOT NULL DEFAULT 0, + `new_window` TINYINT(4) NOT NULL DEFAULT 0, + `params` TEXT NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index c289b9b991..0303bda3ec 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -106,6 +106,12 @@ if ($fields_selected[0]!='') { case 'id_extra': $result = __('Extra id'); break; + case 'owner_user': + $result = __('Owner'); + break; + case 'ack_utimestamp': + $result = __('ACK Timestamp'); + break; } $result_selected[$field_selected] = $result; } @@ -121,9 +127,12 @@ echo ''; $table->width = '90%'; $table->size = array(); -$table->size[0] = '20%'; -$table->size[2] = '10px'; -$table->size[3] = '20%'; +//~ $table->size[0] = '20%'; +$table->size[1] = '10px'; +//~ $table->size[2] = '20%'; + +$table->style[0] = 'text-align:center;'; +$table->style[2] = 'text-align:center;'; $table->data = array(); @@ -144,6 +153,8 @@ $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'); //remove fields already selected foreach ($fields_available as $key=>$available) { @@ -154,13 +165,14 @@ foreach ($fields_available as $key=>$available) { } } -$table->data[1][0] = '' . __('Fields available').''; -$table->data[1][1] = html_print_select ($fields_available, 'fields_available[]', true, '', '', '', true, true, false, '', false, 'width: 200px'); -$table->data[1][2] = html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add fields to select'))); //html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module'))); -$table->data[1][2] .= '



' . html_print_image('images/darrowleft.png', true, array('id' => 'left', 'title' => __('Delete fields to select'))); //html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module'))); +$table->data[0][0] = '' . __('Fields available').''; +$table->data[1][0] = html_print_select ($fields_available, 'fields_available[]', true, '', '', '', true, true, false, '', false, 'width: 200px'); +$table->data[1][1] = ''.html_print_image('images/darrowright.png', true, array('id' => 'right', 'title' => __('Add fields to select'))).''; +$table->data[1][1] .= '



'. html_print_image('images/darrowleft.png', true, array('id' => 'left', 'title' => __('Delete fields to select'))).''; -$table->data[1][3] = '' . __('Fields selected') . ''; -$table->data[1][4] = html_print_select($result_selected, 'fields_selected[]', true, '', '', '', true, true, false, '', false, 'width: 200px'); +$table->data[0][1] = ''; +$table->data[0][2] = '' . __('Fields selected') . ''; +$table->data[1][2] = html_print_select($result_selected, 'fields_selected[]', true, '', '', '', true, true, false, '', false, 'width: 200px'); echo '
'; html_print_table($table); @@ -191,7 +203,7 @@ $(document).ready (function () { field_name = $(value).html(); if (field_name != ){ id_field = $(value).attr('value'); - $("select[name='fields_available[]']").append($("").val(field_name).html('' + id_field + '')); + $("select[name='fields_available[]']").append($("").val(id_field).html('' + field_name + '')); $("#fields_selected").find("option[value='" + id_field + "']").remove(); } }); @@ -203,4 +215,4 @@ $(document).ready (function () { }); }); }); - \ No newline at end of file + diff --git a/pandora_console/godmode/events/event_responses.editor.php b/pandora_console/godmode/events/event_responses.editor.php new file mode 100644 index 0000000000..c04745c311 --- /dev/null +++ b/pandora_console/godmode/events/event_responses.editor.php @@ -0,0 +1,168 @@ + 0) { + $event_response = db_get_row('tevent_response','id',$event_response_id); +} +else { + $event_response = array(); + $event_response['name'] = ''; + $event_response['description'] = ''; + $event_response['id_group'] = 0; + $event_response['type'] = ''; + $event_response['target'] = ''; + $event_response['id'] = 0; +} + +$table->width = '90%'; + +$table->size = array(); + +$table->style[0] = 'font-weight: bold;'; +$table->style[2] = 'font-weight: bold;'; + +$table->data = array(); + +$data = array(); +$data[0] = __('Name'); +$data[1] = html_print_input_text('name',$event_response['name'],'',100,255,true); +$data[1] .= html_print_input_hidden('id_response',$event_response['id'],true); + +$data[2] = __('Group'); +$data[3] = html_print_select_groups(false, 'AR', true, 'id_group',$event_response['id_group'],'','','',true); +$table->data[0] = $data; + +$data = array(); +$table->colspan[1][1] = 3; +$data[0] = __('Description'); +$data[1] = html_print_textarea('description',5,40,$event_response['description'],'',true); +$table->data[1] = $data; + +$data = array(); +$data[0] = __('Location'); +$locations = array(__('Modal window'), __('New window')); +$data[1] = html_print_select($locations,'new_window',$event_response['new_window'],'','','',true); + +$data[2] = ''.__('Size').''; +if($event_response['modal_width'] == 0) { + $event_response['modal_width'] = 620; +} +if($event_response['modal_height'] == 0) { + $event_response['modal_height'] = 500; +} +$data[3] = ''.__('Width').' (px) '; +$data[3] .= ''.html_print_input_text('modal_width',$event_response['modal_width'],'',4,5,true).''; +$data[3] .= ''.__('Height').' (px) '; +$data[3] .= ''.html_print_input_text('modal_height',$event_response['modal_height'],'',4,5,true).''; +$table->data[2] = $data; + +$data = array(); +$data[0] = __('Parameters').ui_print_help_icon ("response_parameters", true); +$data[1] = html_print_input_text('params',$event_response['params'],'',100,255,true); +$types = array('url' => __('URL'), 'command' => __('Command')); +$data[2] = __('Type'); +$data[3] = html_print_select($types,'type',$event_response['type'],'','','',true); +$table->data[3] = $data; + +$data = array(); +$table->colspan[4][1] = 3; +$data[0] = ''.__('Command').''; +$data[1] = html_print_input_text('target',$event_response['target'],'',150,255,true); +$types = array('url' => __('URL'), 'command' => __('Command')); +$table->data[4] = $data; + +$data = array(); +$table->colspan[5][0] = 4; + +$macros = events_get_macros(); + +$macros_info = "
"; +foreach($macros as $k=>$v) { + $macros_info .= "$v: $k
"; +} +$macros_info .= "
"; + +$data[0] = ui_print_info_message(array('title'=>__('Available macros'), 'message' => '
'.$macros_info), '', true); +$table->data[5] = $data; + +echo '
'; + +if($event_response_id == 0) { + echo ''; + html_print_table($table); + echo '

'; + html_print_submit_button(__('Create'), 'create_response_button', false, array('class' => 'sub next')); + echo '
'; + echo '
'; +} +else { + echo '
'; + html_print_table($table); + echo '

'; + html_print_submit_button(__('Update'), 'update_response_button', false, array('class' => 'sub next')); + echo '
'; + echo '
'; +} +?> + + diff --git a/pandora_console/godmode/events/event_responses.list.php b/pandora_console/godmode/events/event_responses.list.php new file mode 100644 index 0000000000..27dacca8a4 --- /dev/null +++ b/pandora_console/godmode/events/event_responses.list.php @@ -0,0 +1,71 @@ +
'; +echo '
'; +html_print_submit_button(__('Create response'), 'create_response_button', false, array('class' => 'sub next')); +echo '
'; +echo '
'; + +$event_responses = db_get_all_rows_in_table('tevent_response'); + +if(empty($event_responses)) { + ui_print_info_message(__('No responses found')); + $event_responses = array(); + return; +} + +$table->width = '90%'; + +$table->size = array(); +$table->size[0] = '200px'; +$table->size[2] = '70px'; +$table->size[3] = '70px'; + +$table->style[2] = 'text-align:center;'; +$table->style[2] = 'text-align:center;'; + +$table->head[0] = __('Name'); +$table->head[1] = __('Description'); +$table->head[2] = __('Group'); +$table->head[3] = __('Actions'); + +$table->data = array(); + +foreach($event_responses as $response) { + $data = array(); + $data[0] = ''.$response['name'].''; + $data[1] = $response['description']; + $data[2] = ui_print_group_icon ($response['id_group'], true); + $data[3] = ''.html_print_image('images/cross.png', true, array('title'=>__('Delete'))).''; + $data[3] .= ' '.html_print_image('images/pencil.png', true, array('title'=>__('Edit'))).''; + $table->data[] = $data; +} + +html_print_table($table); + +?> diff --git a/pandora_console/godmode/events/event_responses.php b/pandora_console/godmode/events/event_responses.php new file mode 100644 index 0000000000..cf525738be --- /dev/null +++ b/pandora_console/godmode/events/event_responses.php @@ -0,0 +1,109 @@ + $response_id)); + + if($result) { + ui_print_success_message(__('Response updated succesfully')); + } + else { + ui_print_error_message(__('Response cannot be updated')); + } + break; + case 'delete_response': + $response_id = get_parameter('id_response',0); + + $result = db_process_sql_delete('tevent_response', array('id' => $response_id)); + + if($result) { + ui_print_success_message(__('Response deleted succesfully')); + } + else { + ui_print_error_message(__('Response cannot be deleted')); + } + break; +} + +switch($mode) { + case 'list': + require('event_responses.list.php'); + break; + case 'editor': + require('event_responses.editor.php'); + break; +} +?> diff --git a/pandora_console/godmode/events/events.php b/pandora_console/godmode/events/events.php index c719ff0f2d..926f52bd3d 100644 --- a/pandora_console/godmode/events/events.php +++ b/pandora_console/godmode/events/events.php @@ -37,6 +37,9 @@ $buttons = array( 'filter' => array('active' => false, 'text' => '' . html_print_image("images/lightning_go.png", true, array ("title" => __('Create filter'))) . ''), + 'responses' => array('active' => false, + 'text' => '' . + html_print_image("images/cog.png", true, array ("title" => __('Event responses'))) . ''), 'fields' => array('active' => false, 'text' => '' . html_print_image("images/god6.png", true, array ("title" => __('Custom fields'))) . ''), @@ -51,6 +54,10 @@ switch ($section) { $buttons['fields']['active'] = true; $subpage = ' - ' . __('Custom fields'); break; + case 'responses': + $buttons['responses']['active'] = true; + $subpage = ' - ' . __('Responses'); + break; case 'view': $buttons['view']['active'] = true; break; @@ -70,6 +77,9 @@ switch($section) { case 'fields': require_once('godmode/events/custom_events.php'); break; + case 'responses': + require_once('godmode/events/event_responses.php'); + break; } -?> \ No newline at end of file +?> diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index b9bd3eff3e..4e723d65dd 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -150,6 +150,7 @@ if (check_acl ($config['id_user'], 0, "IW")) { // Custom event fields $sub = array (); $sub["godmode/events/events&section=fields"]["text"] = __('Custom events'); + $sub["godmode/events/events&section=responses"]["text"] = __('Event responses'); $menu_godmode["geventos"]["sub"] = $sub; } @@ -298,4 +299,4 @@ if (check_acl ($config['id_user'], 0, "PM")) { if(!$config['pure']) { menu_print_menu ($menu_godmode); } -?> \ No newline at end of file +?> diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index a27b8bb449..b37105a887 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -25,6 +25,113 @@ $get_extended_event = (bool) get_parameter ('get_extended_event'); $change_status = (bool) get_parameter ('change_status'); $change_owner = (bool) get_parameter ('change_owner'); $add_comment = (bool) get_parameter ('add_comment'); +$dialogue_event_response = (bool) get_parameter ('dialogue_event_response'); +$perform_event_response = (bool) get_parameter ('perform_event_response'); +$get_response = (bool) get_parameter ('get_response'); +$get_response_target = (bool) get_parameter ('get_response_target'); +$get_response_params = (bool) get_parameter ('get_response_params'); +$get_response_description = (bool) get_parameter ('get_response_description'); + +if($get_response_description) { + $response_id = get_parameter ('response_id'); + + $description = db_get_value('description','tevent_response','id',$response_id); + + if($description === false) { + return; + } + + $description = io_safe_output($description); + $description = str_replace("\r\n", '
', $description); + + echo $description; + + return; +} + +if($get_response_params) { + $response_id = get_parameter ('response_id'); + + $params = db_get_value('params','tevent_response','id',$response_id); + + if($params === false) { + return; + } + + echo json_encode(explode(',',$params)); + + return; +} + +if($get_response_target) { + $response_id = get_parameter ('response_id'); + $event_id = get_parameter ('event_id'); + + $event_response = db_get_row('tevent_response','id',$response_id); + + if(empty($event_response)) { + return; + } + + echo events_get_response_target($event_id, $response_id); + + return; +} + +if($get_response) { + $response_id = get_parameter ('response_id'); + + $event_response = db_get_row('tevent_response','id',$response_id); + + if(empty($event_response)) { + return; + } + + echo json_encode($event_response); + return; +} + +if($perform_event_response) { + global $config; + + $command = get_parameter('target',''); + + echo system('/usr/bin/timeout 10 '.io_safe_output($command).' 2>&1'); + + return; +} + +if($dialogue_event_response) { + global $config; + + $event_id = get_parameter ('event_id'); + $response_id = get_parameter ('response_id'); + $command = get_parameter ('target'); + + $event_response = db_get_row('tevent_response','id',$response_id); + + $event = db_get_row('tevento','id_evento',$event_id); + + $prompt = "
> "; + + switch($event_response['type']) { + case 'command': + echo "
"; + echo $prompt.sprintf(__('Executing command: %s',$command)); + echo "

"; + + echo ""; + echo "
"; + + echo "
"; + break; + case 'url': + echo ""; + break; + } +} if($add_comment) { $comment = get_parameter ('comment'); @@ -81,24 +188,58 @@ if($get_extended_event) { $dialog_page = get_parameter('dialog_page','general'); $event_id = get_parameter('event_id',false); - $event = events_get_event($event_id); + $events = events_get_events_grouped("AND evento = (SELECT evento FROM tevento WHERE id_evento = $event_id)"); + + // If the event is not found, we abort + if(empty($events)) { + echo 'not found'; + return false; + } + else { + $event = reset($events); + } + // Check ACLs + if (is_user_admin ($config["id_user"])) { + //Do nothing if you're admin, you get full access + } + else if($config["id_user"] == $event['owner_user']) { + //Do nothing if you're the owner user, you get access + } + else if($event['id_grupo'] == 0){ + //If the event has access to all groups, you get access + } + else { + // Get your groups + $groups = users_get_groups($config['id_user'], 'IR'); + + if(in_array ($event['id_grupo'], array_keys ($groups))) { + //If the event group is among the groups of the user, you get access + } + else { + // If all the access types fail, abort + echo 'fail'; + return false; + } + } + + $group_rep = get_parameter('group_rep',false); // Print group_rep in a hidden field to recover it from javascript - html_debug_print('group_rep',(int)$group_rep,true); - + html_print_input_hidden('group_rep',(int)$group_rep); + if($event === false) { return; } // Tabs $tabs = ""; // Get criticity image @@ -128,7 +269,7 @@ if($get_extended_event) { } - $actions = events_page_actions($event); + $responses = events_page_responses($event); $details = events_page_details($event); @@ -140,20 +281,32 @@ if($get_extended_event) { $notifications = ''; $notifications .= ''; - $notifications .= ''; + $notifications .= ''; $notifications .= ''; - $notifications .= ''; + $notifications .= ''; $notifications .= ''; - $out = '
'.$tabs.$notifications.$general.$details.$custom_fields.$comments.$actions.html_print_input_hidden('id_event',$event['id_evento']).'
'; + $loading = ''; + + $out = '
'. + $tabs. + $notifications. + $loading. + $general. + $details. + $custom_fields. + $comments. + $responses. + html_print_input_hidden('id_event',$event['id_evento']). + '
'; $js = '"; + + $responses = '
'.html_print_table($table_responses, true).$responses_js.'
'; + + return $responses; +} + +// Replace macros in the target of a response and return it +function events_get_response_target($event_id, $response_id) { + $event_response = db_get_row('tevent_response','id',$response_id); + + $event = db_get_row('tevento','id_evento',$event_id); + + $macros = array_keys(events_get_macros()); + + $target = io_safe_output($event_response['target']); + foreach($macros as $macro) { + $subst = ''; + switch($macro) { + case '_agent_address_': + $subst = agents_get_address($event['id_agente']); + break; + case '_agent_id_': + $subst = $event['id_agente']; + break; + case '_event_id_': + $subst = $event['id_evento']; + break; + } + + $target = str_replace($macro,$subst,$target); + } + + return $target; +} + +function events_page_custom_fields ($event) { + global $config; + ///////// + // Custom fields + ///////// + + $table->width = '100%'; + $table->data = array (); + $table->head = array (); + $table->style[0] = 'width:35%; font-weight: bold; text-align: left;'; + $table->style[1] = 'text-align: left;'; + $table->class = "databox alternate"; + + $fields = db_get_all_rows_filter('tagent_custom_fields'); + + if($event['id_agente'] == 0) { + $fields_data = array(); + } + else { + $fields_data = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $event['id_agente'])); + if(is_array($fields_data)) { + $fields_data_aux = array(); + foreach($fields_data as $fd) { + $fields_data_aux[$fd['id_field']] = $fd['description']; + } + $fields_data = $fields_data_aux; + } + } + + foreach($fields as $field) { + // Owner + $data = array(); + $data[0] = $field['name']; + + $data[1] = empty($fields_data[$field['id_field']]) ? ''.__('N/A').'' : $fields_data[$field['id_field']]; + + $field['id_field']; + + $table->data[] = $data; + } + + $custom_fields = '
'.html_print_table($table, true).'
'; + + return $custom_fields; +} + +function events_page_details ($event) { + global $img_sev; + + ///////// + // Details + ///////// + + $table_details->width = '100%'; + $table_details->data = array (); + $table_details->head = array (); + $table_details->style[0] = 'width:35%; font-weight: bold; text-align: left;'; + $table_details->style[1] = 'text-align: left;'; + $table_details->class = "databox alternate"; + + switch($event['event_type']) { + case 'going_unknown': + case 'going_up_warning': + case 'going_down_warning': + case 'going_up_critical': + case 'going_down_critical': + + break; + } + + if ($event["id_agente"] != 0) { + $agent = db_get_row('tagente','id_agente',$event["id_agente"]); + } + else { + $agent = array(); + } + + $data = array(); + $data[0] = __('Agent details'); + $data[1] = empty($agent) ? '' . __('N/A') . '' : ''; + $table_details->data[] = $data; + + if (!empty($agent)) { + $data = array(); + $data[0] = '
'.__('Name').'
'; + $data[1] = ui_print_agent_name ($event["id_agente"], true); + $table_details->data[] = $data; + + $data = array(); + $data[0] = '
'.__('IP Address').'
'; + $data[1] = empty($agent['url_address']) ? ''.__('N/A').'' : $agent['url_address']; + $table_details->data[] = $data; + + $data = array(); + $data[0] = '
'.__('OS').'
'; + $data[1] = ui_print_os_icon ($agent["id_os"], true, true).' ('.$agent["os_version"].')'; + $table_details->data[] = $data; + + $data = array(); + $data[0] = '
'.__('Last contact').'
'; + $data[1] = $agent["ultimo_contacto"]; + $table_details->data[] = $data; + + $data = array(); + $data[0] = '
'.__('Last remote contact').'
'; + if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") { + $data[1] .= __('Never'); + } + else { + $data[1] .= $agent["ultimo_contacto_remoto"]; + } + $table_details->data[] = $data; + + $data = array(); + $data[0] = '
'.__('Custom fields').'
'; + $data[1] = html_print_button(__('View custom fields'),'custom_button',false,'$(\'#link_custom_fields\').trigger(\'click\');','class="sub next"',true); + $table_details->data[] = $data; + } + + if ($event["id_agentmodule"] != 0) { + $module = db_get_row_filter('tagente_modulo',array('id_agente_modulo' => $event["id_agentmodule"], 'delete_pending' => 0)); + } + else { + $module = array(); + } + + $data = array(); + $data[0] = __('Module details'); + $data[1] = empty($module) ? '' . __('N/A') . '' : ''; + $table_details->data[] = $data; + + if (!empty($module)) { + // Module name + $data = array(); + $data[0] = '
'.__('Name').'
'; + $data[1] = ''; + $data[1] .= $module['nombre']; + $data[1] .= ''; + $table_details->data[] = $data; + + // Module group + $data = array(); + $data[0] = '
'.__('Module group').'
'; + $id_module_group = $module['id_module_group']; + if($id_module_group == 0) { + $data[1] = __('No assigned'); + } + else { + $module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group); + $data[1] = ''; + $data[1] .= $module_group; + $data[1] .= ''; + } + $table_details->data[] = $data; + + $data = array(); + $data[0] = '
'.__('Graph').'
'; + $data[1] = ''; + $data[1] .= html_print_image('images/chart_curve.png',true); + $data[1] .= ''; + $table_details->data[] = $data; + } + + $data = array(); + $data[0] = __('Alert details'); + $data[1] = $event["id_alert_am"] == 0 ? '' . __('N/A') . '' : ''; + $table_details->data[] = $data; + + if($event["id_alert_am"] != 0) { + $data = array(); + $data[0] = '
'.__('Source').'
'; + $data[1] = ''; + $standby = db_get_value('standby', 'talert_template_modules', 'id', $event["id_alert_am"]); + if(!$standby) { + $data[1] .= html_print_image ("images/bell.png", true, + array ("title" => __('Go to data overview'))); + } + else { + $data[1] .= html_print_image ("images/bell_pause.png", true, + array ("title" => __('Go to data overview'))); + } + + $sql = 'SELECT name + FROM talert_templates + WHERE id IN (SELECT id_alert_template + FROM talert_template_modules + WHERE id = ' . $event["id_alert_am"] . ');'; + + $templateName = db_get_sql($sql); + + $data[1] .= $templateName; + + $data[1] .= ''; + + $table_details->data[] = $data; + + $data = array(); + $data[0] = '
'.__('Priority').'
'; + + $priority_code = db_get_value('priority', 'talert_template_modules', 'id', $event["id_alert_am"]); + $alert_priority = get_priority_name ($priority_code); + $data[1] = html_print_image ($img_sev, true, + array ("class" => "image_status", + "width" => 12, + "height" => 12, + "title" => $alert_priority)); + $data[1] .= ' '.$alert_priority; + + $table_details->data[] = $data; + } + + switch($event['event_type']) { + case 'going_unknown': + $data = array(); + $data[0] = __('Instructions'); + if ($event["unknown_instructions"] != '') { + $data[1] = $event["unknown_instructions"]; + } + else { + $data[1] = '' . __('N/A') . ''; + } + $table_details->data[] = $data; + break; + case 'going_up_warning': + case 'going_down_warning': + $data = array(); + $data[0] = __('Instructions'); + if ($event["warning_instructions"] != '') { + $data[1] = $event["warning_instructions"]; + } + else { + $data[1] = '' . __('N/A') . ''; + } + $table_details->data[] = $data; + break; + case 'going_up_critical': + case 'going_down_critical': + $data = array(); + $data[0] = __('Instructions'); + if ($event["critical_instructions"] != '') { + $data[1] = $event["critical_instructions"]; + } + else { + $data[1] = '' . __('N/A') . ''; + } + $table_details->data[] = $data; + break; + } + + $data = array(); + $data[0] = __('Extra id'); + if ($event["id_extra"] != '') { + $data[1] = $event["id_extra"]; + } + else { + $data[1] = '' . __('N/A') . ''; + } + $table_details->data[] = $data; + + $data = array(); + $data[0] = __('Source'); + if ($event["source"] != '') { + $data[1] = $event["source"]; + } + else { + $data[1] = '' . __('N/A') . ''; + } + $table_details->data[] = $data; + + $details = '
'.html_print_table($table_details, true).'
'; + + return $details; +} + +function events_page_general ($event) { + global $img_sev; + global $config; + global $group_rep; + ///////// + // General + ///////// + + $table_general->width = '100%'; + $table_general->data = array (); + $table_general->head = array (); + $table_general->style[0] = 'width:35%; font-weight: bold; text-align: left;'; + $table_general->style[1] = 'text-align: left;'; + $table_general->class = "databox alternate"; + + $data = array(); + $data[0] = __('Event ID'); + $data[1] = "#".$event["id_evento"]; + $table_general->data[] = $data; + + $data = array(); + $data[0] = __('Event name'); + $data[1] = io_safe_output(io_safe_output($event["evento"])); + $table_general->data[] = $data; + + $data = array(); + $data[0] = __('Timestamp'); + if ($group_rep == 1 && $event["event_rep"] > 0) { + $data[1] = __('First event').': '.date ($config["date_format"], $event['timestamp_rep_min']).'
'.__('Last event').': '.date ($config["date_format"], $event['timestamp_rep']); + } + else { + $data[1] = date ($config["date_format"], strtotime($event["timestamp"])); + } + $table_general->data[] = $data; + + $data = array(); + $data[0] = __('Owner'); + if(empty($event["owner_user"])) { + $data[1] = ''.__('N/A').''; + } + else { + $user_owner = db_get_value('fullname', 'tusuario', 'id_user', $event["owner_user"]); + $data[1] = $user_owner; + } + $table_general->data[] = $data; + + $data = array(); + $data[0] = __('Type'); + $data[1] = events_print_type_img ($event["event_type"], true).' '.events_print_type_description($event["event_type"], true); + $table_general->data[] = $data; + + $data = array(); + $data[0] = __('Repeated'); + if ($group_rep != 0) { + if($event["event_rep"] == 0) { + $data[1] = __('No'); + } + else { + $data[1] = sprintf("%d Times",$event["event_rep"]); + } + } + else { + $data[1] = __('No'); + } + $table_general->data[] = $data; + + $data = array(); + $data[0] = __('Severity'); + $event_criticity = get_priority_name ($event["criticity"]); + $data[1] = html_print_image ($img_sev, true, + array ("class" => "image_status", + "width" => 12, + "height" => 12, + "title" => $event_criticity)); + $data[1] .= ' '.$event_criticity; + $table_general->data[] = $data; + + // Get Status + switch($event['estado']) { + case 0: + $img_st = "images/star.png"; + $title_st = __('New event'); + break; + case 1: + $img_st = "images/tick.png"; + $title_st = __('Event validated'); + break; + case 2: + $img_st = "images/hourglass.png"; + $title_st = __('Event in process'); + break; + } + + $data = array(); + $data[0] = __('Status'); + $data[1] = html_print_image($img_st,true).' '.$title_st; + $table_general->data[] = $data; + + // If event is validated, show who and when acknowleded it + $data = array(); + $data[0] = __('Acknowledged by'); + + if($event['estado'] == 1) { + $user_ack = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']); + $date_ack = date ($config["date_format"], $event['ack_utimestamp']); + $data[1] = $user_ack.' ('.$date_ack.')'; + } + else { + $data[1] = ''.__('N/A').''; + } + $table_general->data[] = $data; + + $data = array(); + $data[0] = __('Group'); + $data[1] = ui_print_group_icon ($event["id_grupo"], true); + $data[1] .= groups_get_name ($event["id_grupo"]); + $table_general->data[] = $data; + + $data = array(); + $data[0] = __('Tags'); + + if ($event["tags"] != '') { + $tag_array = explode(',', $event["tags"]); + $data[1] = ''; + foreach ($tag_array as $tag_element){ + $blank_char_pos = strpos($tag_element, ' '); + $tag_name = substr($tag_element, 0, $blank_char_pos); + $tag_url = substr($tag_element, $blank_char_pos + 1); + $data[1] .= ' ' .$tag_name; + if (!empty($tag_url)){ + $data[1] .= ' ' . html_print_image('images/lupa.png', true, array('title' => __('Click here to open a popup window with URL tag'))) . ' '; + } + $data[1] .= ','; + } + $data[1] = rtrim($table_general, ','); + } + else { + $data[1] = '' . __('N/A') . ''; + } + $table_general->data[] = $data; + + $general = '
'.html_print_table($table_general,true).'
'; + + return $general; +} + +function events_page_comments ($event) { + ///////// + // Comments + ///////// + + $table_comments->width = '100%'; + $table_comments->data = array (); + $table_comments->head = array (); + $table_comments->style[0] = 'width:35%; vertical-align: top; text-align: left;'; + $table_comments->style[1] = 'text-align: left;'; + $table_comments->class = "databox alternate"; + + $comments_array = explode('
',io_safe_output($event["user_comment"])); + + // Split comments and put in table + $col = 0; + $data = array(); + foreach($comments_array as $c) { + switch($col) { + case 0: + $row_text = preg_replace('/\s*--\s*/',"",$c); + $row_text = preg_replace('/\<\/b\>/',"",$row_text); + $row_text = preg_replace('/\[/',"

[",$row_text); + $row_text = preg_replace('/[\[|\]]/',"",$row_text); + break; + case 1: + $row_text = preg_replace("/[\r\n|\r|\n]/","
",io_safe_output(strip_tags($c))); + break; + } + + $data[$col] = $row_text; + + $col++; + + if($col == 2) { + $col = 0; + $table_comments->data[] = $data; + $data = array(); + } + } + + if(count($comments_array) == 1 && $comments_array[0] == '') { + $table_comments->style[0] = 'text-align:center;'; + $table_comments->colspan[0][0] = 2; + $data = array(); + $data[0] = __('There are no comments'); + $table_comments->data[] = $data; + } + + $comments_form = '
'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%;"', true); + $comments_form .= '
'.html_print_button(__('Add comment'),'comment_button',false,'event_comment();','class="sub next"',true).'

'; + + $comments = '
'.$comments_form.html_print_table($table_comments, true).'
'; + + return $comments; +} ?> diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 41497a2b12..c4a053b407 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -1,3 +1,4 @@ +// Show the modal window of an event function show_event_dialog(event_id, group_rep, dialog_page, result) { if(dialog_page == undefined) { dialog_page = 'general'; @@ -10,7 +11,7 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) { "dialog_page": dialog_page, "event_id": event_id}, function (data, status) { - $("#alert_messages").hide () + $("#event_details_window").hide () .empty () .append (data) .dialog ({ @@ -54,7 +55,216 @@ function show_event_dialog(event_id, group_rep, dialog_page, result) { return false; } +// Check the response type and open it in a modal dialog or new window +function execute_response(event_id) { + var response_id = $('#select_custom_response option:selected').val(); + + var response = get_response(response_id); + + // If cannot get response abort it + if(response == null) { + return; + } + + response['target'] = get_response_target(event_id, response_id); + + switch(response['type']) { + case 'command': + show_response_dialog(event_id, response_id, response); + break; + case 'url': + if(response['new_window'] == 1) { + window.open(response['target'],'_blank'); + } + else { + show_response_dialog(event_id, response_id, response); + } + break; + } +} +//Show the modal window of an event response +function show_response_dialog(event_id, response_id, response) { + var params = []; + params.push("page=include/ajax/events"); + params.push("dialogue_event_response=1"); + params.push("event_id="+event_id); + params.push("target="+response['target']); + params.push("response_id="+response_id); + + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action="ajax.php", + async: false, + timeout: 10000, + dataType: 'html', + success: function (data) { + $("#event_response_window").hide () + .empty () + .append (data) + .dialog ({ + title: $('#select_custom_response option:selected').html(), + resizable: true, + draggable: true, + modal: false, + open: function(event, ui) { + perform_response(response['target']); + }, + bgiframe: jQuery.browser.msie, + width: response['modal_width'], + height: response['modal_height'] + }) + .show (); + } + }); +} + +// Get an event response from db +function get_response(response_id) { + var response = ''; + + var params = []; + params.push("page=include/ajax/events"); + params.push("get_response=1"); + params.push("response_id="+response_id); + + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action="ajax.php", + async: false, + timeout: 10000, + dataType: 'json', + success: function (data) { + response = data; + } + }); + + return response; +} + +// Get an event response params from db +function get_response_params(response_id) { + var response_params; + + var params = []; + params.push("page=include/ajax/events"); + params.push("get_response_params=1"); + params.push("response_id="+response_id); + + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action="ajax.php", + async: false, + timeout: 10000, + dataType: 'json', + success: function (data) { + response_params = data; + } + }); + + return response_params; +} + +// Get an event response description from db +function get_response_description(response_id) { + var response_description = ''; + + var params = []; + params.push("page=include/ajax/events"); + params.push("get_response_description=1"); + params.push("response_id="+response_id); + + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action="ajax.php", + async: false, + timeout: 10000, + dataType: 'html', + success: function (data) { + response_description = data; + } + }); + + return response_description; +} + +function add_row_param(id_table, param) { + $('#'+id_table).append(''+param+''); +} + +// Get an event response from db +function get_response_target(event_id, response_id) { + var target = ''; + + // Replace the main macros + var params = []; + params.push("page=include/ajax/events"); + params.push("get_response_target=1"); + params.push("event_id="+event_id); + params.push("response_id="+response_id); + + jQuery.ajax ({ + data: params.join ("&"), + type: 'POST', + url: action="ajax.php", + async: false, + timeout: 10000, + dataType: 'html', + success: function (data) { + target = data; + } + }); + + // Replace the custom params macros + var response_params = get_response_params(response_id); + + if(response_params.length > 1 || response_params[0] != '') { + for(i=0;i"); + $('#response_out').html(out); + $('#response_loading_command').hide(); + $('#re_exec_command').show(); + } + }); + + return false; +} + +// Change the status of an event to new, in process or validated function event_change_status() { var event_id = $('#hidden-id_event').val(); var new_status = $('#estado').val(); @@ -66,7 +276,8 @@ function event_change_status() { params.push("new_status="+new_status); $('#button-status_button').attr('disabled','disabled'); - + $('#response_loading').show(); + jQuery.ajax ({ data: params.join ("&"), type: 'POST', @@ -76,7 +287,8 @@ function event_change_status() { dataType: 'html', success: function (data) { $('#button-status_button').removeAttr('disabled'); - show_event_dialog(event_id, $('#hidden-group_rep').val(), 'actions', data); + $('#response_loading').hide(); + show_event_dialog(event_id, $('#hidden-group_rep').val(), 'responses', data); if(data == 'ok') { } else { @@ -86,6 +298,7 @@ function event_change_status() { return false; } +// Change te owner of an event to one user of empty function event_change_owner() { var event_id = $('#hidden-id_event').val(); var new_owner = $('#id_owner').val(); @@ -97,7 +310,8 @@ function event_change_owner() { params.push("new_owner="+new_owner); $('#button-owner_button').attr('disabled','disabled'); - + $('#response_loading').show(); + jQuery.ajax ({ data: params.join ("&"), type: 'POST', @@ -107,13 +321,16 @@ function event_change_owner() { dataType: 'html', success: function (data) { $('#button-owner_button').removeAttr('disabled'); - show_event_dialog(event_id, $('#hidden-group_rep').val(), 'actions', data); + $('#response_loading').hide(); + + show_event_dialog(event_id, $('#hidden-group_rep').val(), 'responses', data); } }); return false; } +// Save a comment into an event function event_comment() { var event_id = $('#hidden-id_event').val(); var comment = $('#textarea_comment').val(); @@ -130,7 +347,8 @@ function event_comment() { params.push("comment="+comment); $('#button-comment_button').attr('disabled','disabled'); - + $('#response_loading').show(); + jQuery.ajax ({ data: params.join ("&"), type: 'POST', @@ -140,6 +358,8 @@ function event_comment() { dataType: 'html', success: function (data) { $('#button-comment_button').removeAttr('disabled'); + $('#response_loading').show(); + show_event_dialog(event_id, $('#hidden-group_rep').val(), 'comments', data); } }); diff --git a/pandora_console/include/styles/jquery-ui-1.8.23.custom.css b/pandora_console/include/styles/jquery-ui-1.8.23.custom.css index 2a0fa231a9..51fd2d4c69 100644 --- a/pandora_console/include/styles/jquery-ui-1.8.23.custom.css +++ b/pandora_console/include/styles/jquery-ui-1.8.23.custom.css @@ -86,7 +86,7 @@ color: #ffffff !important; } .ui-state-hover a, .ui-state-hover a:hover { - color: #B1B1B1; + color: #DFD; text-decoration: none; } .ui-state-active, .ui-widget-content .ui-state-active, @@ -98,7 +98,7 @@ } .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { - color: #eb8f00; + color: #DFD; text-decoration: none; } .ui-widget :active { outline: none; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 7b36dd54fd..42e014c851 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -382,6 +382,9 @@ else { } } +echo "
"; +echo "
"; + ui_require_jquery_file ('bgiframe'); ui_require_javascript_file('pandora_events'); @@ -422,6 +425,7 @@ $(document).ready( function() { $tr = $(this).parents ("tr"); id = this.id.split ("-").pop (); + var comment = $('#textarea_comment_'+id).val(); var select_validate = $('#select_validate_'+id).val(); // 1 validate, 2 in process, 3 add comment var checkbox_standby_alert = $('#checkbox-standby-alert-'+id).attr('checked'); @@ -642,7 +646,7 @@ $(document).ready( function() { ); return false; }); - + function toggleDiv (divid){ if (document.getElementById(divid).style.display == 'none'){ document.getElementById(divid).style.display = 'block'; @@ -678,4 +682,15 @@ $(document).ready( function() { $('.event_form_' + id_event).css('display', ''); } } - \ No newline at end of file + + // Autoload event giving the id as POST/GET parameter + + show_event_dialog(, 1); + + diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 9b97b1dad7..bbbd066f9b 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -449,57 +449,14 @@ if ($group_rep == 0) { $sql = oracle_recode_query ($sql, $set); break; } + + //Extract the events by filter (or not) from db + $result = db_get_all_rows_sql ($sql); } else { - switch ($config["dbtype"]) { - case "mysql": - db_process_sql ('SET group_concat_max_len = 9999999'); - $sql = "SELECT *, MAX(id_evento) AS id_evento, - GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment, - MIN(estado) AS min_estado, - MAX(estado) AS max_estado, - COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep, - MIN(utimestamp) AS timestamp_rep_min - FROM tevento - WHERE 1=1 ".$sql_post." - GROUP BY evento, id_agentmodule - ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination; - break; - case "postgresql": - $sql = "SELECT *, MAX(id_evento) AS id_evento, array_to_string(array_agg(DISTINCT user_comment), '') AS user_comment, - MIN(estado) AS min_estado, MAX(estado) AS max_estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep, - MIN(utimestamp) AS timestamp_rep_min - FROM tevento - WHERE 1=1 ".$sql_post." - GROUP BY evento, id_agentmodule, id_evento, id_agente, id_usuario, id_grupo, estado, timestamp, utimestamp, event_type, id_alert_am, criticity, user_comment, tags, source, id_extra - ORDER BY timestamp_rep DESC LIMIT ".$pagination." OFFSET ".$offset; - break; - case "oracle": - $set = array(); - $set['limit'] = $pagination; - $set['offset'] = $offset; - // TODO: Remove duplicate user comments - $sql = "SELECT a.*, b.event_rep, b.timestamp_rep - FROM (SELECT * FROM tevento WHERE 1=1 ".$sql_post.") a, - (SELECT MAX (id_evento) AS id_evento, to_char(evento) AS evento, - id_agentmodule, COUNT(*) AS event_rep, MIN(estado) AS min_estado, MAX(estado) AS max_estado, - LISTAGG(user_comment, '') AS user_comment, MAX(utimestamp) AS timestamp_rep, - MIN(utimestamp) AS timestamp_rep_min - FROM tevento - WHERE 1=1 ".$sql_post." - GROUP BY to_char(evento), id_agentmodule) b - WHERE a.id_evento=b.id_evento AND - to_char(a.evento)=to_char(b.evento) - AND a.id_agentmodule=b.id_agentmodule"; - $sql = oracle_recode_query ($sql, $set); - break; - } - + $result = events_get_events_grouped($sql_post, $offset, $pagination); } -//Extract the events by filter (or not) from db -$result = db_get_all_rows_sql ($sql); - // Delete rnum field generated by oracle_recode_query() function if (($config['dbtype'] == 'oracle') && ($result !== false)) { for ($i=0; $i < count($result); $i++) { @@ -534,6 +491,9 @@ $show_fields = explode (',', $config['event_fields']); //headers $i = 0; +$table->head[$i] = __('ID'); +$table->align[$i] = 'center'; +$i++; if (in_array('estado', $show_fields)) { $table->head[$i] = __('Status'); $table->align[$i] = 'center'; @@ -564,6 +524,11 @@ if (in_array('id_usuario', $show_fields)) { $table->align[$i] = 'center'; $i++; } +if (in_array('owner_user', $show_fields)) { + $table->head[$i] = __('Owner'); + $table->align[$i] = 'center'; + $i++; +} if (in_array('id_grupo', $show_fields)) { $table->head[$i] = __('Group'); $table->align[$i] = 'center'; @@ -610,6 +575,11 @@ if (in_array('id_extra', $show_fields)) { $table->align[$i] = 'center'; $i++; } +if (in_array('ack_utimestamp', $show_fields)) { + $table->head[$i] = __('ACK Timestamp'); + $table->align[$i] = 'center'; + $i++; +} if ($i != 0) { $table->head[$i] = __('Action'); $table->align[$i] = 'center'; @@ -665,6 +635,9 @@ foreach ($result as $event) { $i = 0; + $data[$i] = "#".$event["id_evento"]; + $i++; + if (in_array('estado',$show_fields)) { $data[$i] = html_print_image ($img_st, true, array ("class" => "image_status", @@ -741,8 +714,14 @@ foreach ($result as $event) { $i++; } - $user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']); + if (in_array('owner_user',$show_fields)) { + $owner_name = db_get_value('fullname', 'tusuario', 'id_user', $event['owner_user']); + $data[$i] = $owner_name; + $i++; + } + if (in_array('id_usuario',$show_fields)) { + $user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']); $data[$i] = $user_name; $i++; } @@ -828,12 +807,22 @@ foreach ($result as $event) { $i++; } + if (in_array('ack_utimestamp',$show_fields)) { + if($event["ack_utimestamp"] == 0){ + $data[$i] = ''; + } + else { + $data[$i] = date ($config["date_format"], $event['ack_utimestamp']); + } + $i++; + } + if ($i != 0) { //Actions $data[$i] = ''; // Validate event if (($event["estado"] != 1) and (check_acl ($config["id_user"], $event["id_grupo"], "IW") == 1)) { - $data[$i] .= ''; + $data[$i] .= ''; $data[$i] .= html_print_image ("images/ok.png", true, array ("title" => __('Validate event'))); $data[$i] .= ' '; @@ -860,20 +849,6 @@ foreach ($result as $event) { $data[$i] .= html_print_image ("images/eye.png", true, array ("title" => __('Show more'))); $data[$i] .= ' '; - - // Create incident from this event - if (check_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) { - if(isset($config['integria_enabled']) && $config['integria_enabled'] == 1) { - $incidents_path = 'integria_incidents/incident&tab=editor'; - } - else { - $incidents_path = 'incidents/incident_detail&insert_form'; - } - $data[$i] .= ''; - $data[$i] .= html_print_image ("images/page_lightning.png", true, - array ("title" => __('Create incident from event'))); - $data[$i] .= ''; - } $i++; if (check_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) { @@ -883,41 +858,6 @@ foreach ($result as $event) { array_push ($table->data, $data); } - //Hiden row with description form - $string = ''; - $string .= ''; - $string .= ''; - $string .= '
'; - $string .= '' . __('Comment:') . '' . html_print_textarea("comment_".$event["id_evento"], 2, 10, '', 'style="min-height: 10px; width: 250px;"', true) . ''; - $string .= '
'; - - if($event["estado"] == 0) { - $string .= html_print_select(array('1' => __('Validate'), '2' => __('Set in process'), '3' => __('Add comment')), 'select_validate_'.$event["id_evento"], '', '', '', 0, true, false, false, 'select_validate').'

'; - } - if($event["estado"] == 2) { - $string .= html_print_select(array('1' => __('Validate'), '3' => __('Add comment')), 'select_validate_'.$event["id_evento"], '', '', '', 0, true, false, false, 'select_validate').'

'; - } - - $string .= ''; - - $string .= html_print_button (__('Update'), 'validate', false, '', 'class="sub ok validate_event" id="validate-'.$event["id_evento"].'"', true).'
'; - $string .= ''; - $string .= '
'; - if($event["id_alert_am"] != 0) { - $string .= ''; - } - $string .= '
'; - - $data = array($string); - - $idx++; - - $table->rowclass[$idx] = 'event_form_' . $event["id_evento"].' event_form'; - $table->colspan[$idx][0] = 10; - $table->rowstyle[$idx] = 'display: none;'; - array_push ($table->data, $data); - - $idx++; }