$source_id_agent, 'Destinity agent' => implode(',', $destiny_id_agents), ]; if ($result) { db_pandora_audit( AUDIT_LOG_MASSIVE_MANAGEMENT, 'Copy modules', false, false, json_encode($info) ); } else { db_pandora_audit( AUDIT_LOG_MASSIVE_MANAGEMENT, 'Fail to try copy modules', false, false, json_encode($info) ); } } $groups = users_get_groups(); $table = new stdClass(); $table->id = 'source_table'; $table->class = 'databox filters filter-table-adv'; $table->width = '100%'; $table->size[0] = '50%'; $table->size[1] = '50%'; $table->data = []; // Source selection. $table->data[0][0] = html_print_label_input_block( __('Group'), html_print_select_groups( false, 'AW', true, 'source_id_group', $source_id_group, false, '', '', true, false, false, 'w100p', false, 'width:100%' ) ); $table->data[0][1] = html_print_label_input_block( __('Group recursion'), 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[1][0] = html_print_label_input_block( __('Status'), html_print_select( $status_list, 'status_agents_source', 'selected', '', __('All'), AGENT_STATUS_ALL, true, false, true, 'w100p' ) ); $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[1][1] = html_print_label_input_block( __('Agent').' ', html_print_select( $agents, 'source_id_agent', $source_id_agent, false, __('Select'), 0, true ) ); echo '
'; echo '
'; echo ''.__('Source').''; html_print_table($table); echo '
'; unset($table); // Target selection. $table = new stdClass(); $table->id = 'target_table'; $table->class = 'databox filters filter-table-adv'; $table->width = '100%'; $table->size[0] = '50%'; $table->size[1] = '50%'; $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->colspan[0][0] = 2; $table->data[0][0] = html_print_label_input_block( __('Tags'), html_print_select( $tags, 'tags[]', $tags_name, false, __('Any'), -1, true, true, true, '', false, 'overflow-x: hidden;white-space: nowrap;max-width: 1136px;' ) ); $table->data[1][0] = html_print_label_input_block( __('Operations'), ''.html_print_checkbox('copy_modules', 1, true, true).html_print_label(__('Copy modules'), 'checkbox-copy_modules', true).''.html_print_checkbox('copy_alerts', 1, true, true).html_print_label(__('Copy alerts'), 'checkbox-copy_alerts', true).'' ); $table->data[1][1] = html_print_label_input_block( __('Filter Modules'), html_print_input_text('filter_modules', '', '', 20, 255, true) ); $table->colspan[2][0] = 2; $table->data[2][0] = html_print_label_input_block( __('Modules'), ''.html_print_select( $modules, 'target_modules[]', 0, false, '', '', true, true ).''.__('No modules for this agent').'' ); $table->colspan[3][0] = 2; $table->data[3][0] = html_print_label_input_block( __('Alerts'), ''.html_print_select( $alerts, 'target_alerts[]', 0, false, '', '', true, true ).''.__('No alerts for this agent').'' ); echo ''; echo ''; unset($table); // Destiny selection. $table = new stdClass(); $table->id = 'destiny_table'; $table->class = 'databox filters filter-table-adv'; $table->width = '100%'; $table->size[0] = '50%'; $table->size[1] = '50%'; $table->data = []; $table->data[0][0] = html_print_label_input_block( __('Group'), html_print_select_groups( false, 'AW', true, 'destiny_id_group', $destiny_id_group, false, '', '', true, false, false, 'w100p', false, 'width:100%' ) ); $table->data[0][1] = html_print_label_input_block( __('Group recursion'), html_print_checkbox( 'destiny_recursion', 1, $destiny_recursion, true, false ) ); $table->data[1][0] = html_print_label_input_block( __('Filter Agents'), html_print_input_text('filter_agents', '', '', 20, 255, true) ); $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][1] = html_print_label_input_block( __('Status'), html_print_select( $status_list, 'status_agents_destiny', 'selected', '', __('All'), AGENT_STATUS_ALL, true ) ); $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->colspan[2][0] = 2; $table->data[2][0] = html_print_label_input_block( __('Agent').'', html_print_select($agents, 'destiny_id_agent[]', 0, false, '', '', true, true) ); echo ''; attachActionButton('do_operation', 'copy', $table->width, false, $SelectAction); echo '
'; echo ''; // Load JS files. ui_require_javascript_file('pandora_modules'); ui_require_jquery_file('form'); ui_require_jquery_file('pandora.controls'); ?>