'.__('Massive agent deletion').'';
function process_manage_delete ($id_agents) {
if (empty ($id_agents)) {
echo '
'.__('No agents selected').'
';
return false;
}
$id_agents = (array) $id_agents;
$copy_modules = (bool) get_parameter ('copy_modules');
$copy_alerts = (bool) get_parameter ('copy_alerts');
process_sql ('SET AUTOCOMMIT = 0');
process_sql ('START TRANSACTION');
$error = false;
foreach ($id_agents as $id_agent) {
$success = delete_agent ($id_agent);
if (! $success)
break;
}
if (! $success) {
echo ''.__('There was an error deleting the agent, the operation has been cancelled').'
';
echo ''.__('Could not delete agent').' '.get_agent_name ($id_agent).'
';
process_sql ('ROLLBACK');
} else {
echo ''.__('Successfully deleted').'
';
process_sql ('COMMIT');
}
process_sql ('SET AUTOCOMMIT = 1');
}
$id_group = (int) get_parameter ('id_group');
$id_agents = get_parameter ('id_agents');
$delete = (bool) get_parameter_post ('delete');
if ($delete) {
process_manage_delete ($id_agents);
}
$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] = __('Group');
$table->data[0][1] = print_select ($groups, 'id_group', $id_group,
false, '', '', true);
$table->data[1][0] = __('Agents');
$table->data[1][0] .= '';
$table->data[1][0] .= '';
$table->data[1][0] .= '';
$table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"),
'id_agents[]', 0, false, '', '', true, true);
echo '';
echo '
';
require_jquery_file ('form');
require_jquery_file ('pandora.controls');
?>