0, '`tagente_modulo`.disabled' => 0), array ('tagente.id_agente', 'tagente.nombre')); echo json_encode (index_array ($agents_modules, 'id_agente', 'nombre')); return; } return; } function process_manage_delete ($module_name, $id_agents) { if (empty ($module_name)) { echo '

'.__('No module selected').'

'; return false; } if (empty ($id_agents)) { echo '

'.__('No agents selected').'

'; return false; } process_sql_begin (); $modules = get_agent_modules ($id_agents, 'id_agente_modulo', array ('nombre' => $module_name), true); $success = delete_agent_module ($modules); if (! $success) { echo '

'.__('There was an error deleting the modules, the operation has been cancelled').'

'; echo '

'.__('Could not delete modules').'

'; process_sql_rollback (); return false; } else { echo '

'.__('Successfully deleted').'

'; process_sql_commit (); return true; } } $id_group = (int) get_parameter ('id_group'); $id_agents = (array) get_parameter ('id_agents'); $module_name = (string) get_parameter ('module_name'); $delete = (bool) get_parameter_post ('delete'); if ($delete) { $result = process_manage_delete ($module_name, $id_agents); if ($result) { pandora_audit("Massive management", "Delete module ", false, false, 'Agent: ' . json_encode($id_agents) . ' Module: ' . $module_name); } else { pandora_audit("Massive management", "Fail try to delete module", false, false, 'Agent: ' . json_encode($id_agents) . ' Module: ' . $module_name); } } $groups = get_user_groups (); $table->id = 'delete_table'; $table->width = '95%'; $table->data = array (); $table->style = array (); $table->style[0] = 'font-weight: bold; vertical-align:top'; $table->style[2] = 'font-weight: bold'; $table->size = array (); $table->size[0] = '15%'; $table->size[1] = '85%'; $table->data = array (); $table->data[0][0] = __('Modules'); $modules = get_agent_modules(); $modulesSelect = array(); foreach ($modules as $module) { $modulesSelect[$module] = $module; } $table->data[0][1] = print_select($modulesSelect, 'module_name', $module_name, false, __('Select'), '', true); $table->data[1][0] = __('Group'); $table->data[1][1] = print_select_groups(false, "AR", true, 'id_group', $id_group, false, '', '', true, false, true, '', empty ($module_name)); $table->data[2][0] = __('Agent'); $table->data[2][0] .= ''; $agents = get_agents_with_module_name ($module_name, $id_group, array ('delete_pending' => 0, '`tagente_modulo`.disabled' => 0), array ('tagente.id_agente', 'tagente.nombre')); $table->data[2][1] = print_select (index_array ($agents, 'id_agente', 'nombre'), 'id_agents[]', 0, false, __('None'), 0, true, true, true, '', empty ($module_name)); echo '
'; print_table ($table); echo '
'; print_input_hidden ('delete', 1); print_submit_button (__('Delete'), 'go', false, 'class="sub delete"'); echo '
'; echo '
'; echo ''; require_jquery_file ('form'); require_jquery_file ('pandora.controls'); ?>