$source_id_agent, 'Destinity agent' => implode(',', $destiny_id_agents), ]; if ($result) { db_pandora_audit( 'Massive management', 'Copy modules', false, false, json_encode($info) ); } else { db_pandora_audit( 'Massive management', 'Fail to try copy modules', false, false, json_encode($info) ); } } $groups = users_get_groups(); $table->class = 'databox filters'; $table->width = '100%'; $table->data = []; $table->style = []; $table->style[0] = 'font-weight: bold;'; $table->style[2] = 'font-weight: bold'; $table->style[4] = 'font-weight: bold'; $table->style[6] = 'font-weight: bold'; // Source selection $table->id = 'source_table'; $table->data[0][0] = __('Group'); $table->data[0][1] = html_print_select_groups( false, 'AW', true, 'source_id_group', $source_id_group, false, '', '', true ); $table->data[0][2] = __('Group recursion'); $table->data[0][3] = html_print_checkbox('source_recursion', 1, $source_recursion, true, false); $status_list = []; $status_list[AGENT_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_STATUS_WARNING] = __('Warning'); $status_list[AGENT_STATUS_CRITICAL] = __('Critical'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $table->data[0][4] = __('Status'); $table->data[0][5] = html_print_select( $status_list, 'status_agents_source', 'selected', '', __('All'), AGENT_STATUS_ALL, true ); $table->data[0][6] = __('Agent'); $table->data[0][6] .= ' '; // $table->data[0][7] = html_print_select (agents_get_group_agents ($source_id_group, false, "none"), // 'source_id_agent', $source_id_agent, false, __('Select'), 0, true); $agents = ( $source_id_group ? agents_get_group_agents($source_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) ); $table->data[0][7] = html_print_select($agents, 'source_id_agent', $source_id_agent, false, __('Select'), 0, true); echo '
'; echo '
'; echo ''; echo ''.__('Source'); echo ''; html_print_table($table); echo '
'; // Target selection $table->id = 'target_table'; $table->class = 'databox filters'; $table->data = []; $modules = []; if ($source_id_agent) { $modules = agents_get_modules($source_id_agent, 'nombre'); } $agent_alerts = []; if ($source_id_agent) { $agent_alerts = agents_get_alerts_simple($source_id_agent); } $alerts = []; foreach ($agent_alerts as $alert) { $name = alerts_get_alert_template_name($alert['id_alert_template']); $name .= ' ('.$modules[$alert['id_agent_module']].')'; $alerts[$alert['id']] = $name; } $tags = tags_get_user_tags(); $table->data['tags'][0] = __('Tags'); $table->data['tags'][1] = html_print_select( $tags, 'tags[]', $tags_name, false, __('Any'), -1, true, true, true ); $table->data['operations'][0] = __('Operations'); $table->data['operations'][1] = ''; $table->data['operations'][1] .= html_print_checkbox('copy_modules', 1, true, true); $table->data['operations'][1] .= html_print_label(__('Copy modules'), 'checkbox-copy_modules', true); $table->data['operations'][1] .= '
'; $table->data['operations'][1] .= ''; $table->data['operations'][1] .= html_print_checkbox('copy_alerts', 1, true, true); $table->data['operations'][1] .= html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true); $table->data['operations'][1] .= ''; $table->data['form_modules_filter'][0] = __('Filter Modules'); $table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true); $table->data[1][0] = __('Modules'); $table->data[1][1] = ''; $table->data[1][1] .= html_print_select( $modules, 'target_modules[]', 0, false, '', '', true, true ); $table->data[1][1] .= ''; $table->data[1][1] .= ''; $table->data[1][1] .= ''.__('No modules for this agent').''; $table->data[1][1] .= ''; $table->data[2][0] = __('Alerts'); $table->data[2][1] = ''; $table->data[2][1] .= html_print_select( $alerts, 'target_alerts[]', 0, false, '', '', true, true ); $table->data[2][1] .= ''; $table->data[2][1] .= ''; $table->data[2][1] .= ''.__('No alerts for this agent').''; $table->data[2][1] .= ''; echo ''; echo ''; // Destiny selection $table->id = 'destiny_table'; $table->class = 'databox filters'; $table->data = []; $table->size[0] = '20%'; $table->size[1] = '30%'; $table->size[2] = '20%'; $table->size[3] = '30%'; $table->data[0][0] = __('Group'); $table->data[0][1] = html_print_select_groups( false, 'AW', true, 'destiny_id_group', $destiny_id_group, false, '', '', true ); $table->data[0][2] = __('Group recursion'); $table->data[0][3] = html_print_checkbox( 'destiny_recursion', 1, $destiny_recursion, true, false ); $status_list = []; $status_list[AGENT_STATUS_NORMAL] = __('Normal'); $status_list[AGENT_STATUS_WARNING] = __('Warning'); $status_list[AGENT_STATUS_CRITICAL] = __('Critical'); $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); $status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); $table->data[1][0] = __('Status'); $table->data[1][1] = html_print_select( $status_list, 'status_agents_destiny', 'selected', '', __('All'), AGENT_STATUS_ALL, true ); $table->data['form_agents_filter'][0] = __('Filter Agents'); $table->data['form_agents_filter'][1] = html_print_input_text('filter_agents', '', '', 20, 255, true); $table->data[2][0] = __('Agent'); $table->data[2][0] .= ''; $agents = []; if ($source_id_agent) { $agents = ( $destiny_id_group ? agents_get_group_agents($destiny_id_group, false, 'none') : agents_get_group_agents(array_keys(users_get_groups($config['id_user'], 'AW', false))) ); unset($agents[$source_id_agent]); } $table->data[2][1] = html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true); echo ''; echo '
'; html_print_input_hidden('do_operation', 1); html_print_submit_button(__('Copy'), 'go', false, 'class="sub wand"'); echo '
'; echo '
'; echo ''; ui_require_jquery_file('form'); ui_require_jquery_file('pandora.controls'); ?>