diff --git a/pandora_console/godmode/massive/massive_delete_profiles.php b/pandora_console/godmode/massive/massive_delete_profiles.php index 22cb04b632..b55ab6deb1 100644 --- a/pandora_console/godmode/massive/massive_delete_profiles.php +++ b/pandora_console/godmode/massive/massive_delete_profiles.php @@ -67,20 +67,23 @@ if (is_ajax()) { if ($get_users) { $id_group = get_parameter('id_group'); $id_profile = get_parameter('id_profile'); + $get_all_groups = get_parameter('get_all_groups', '0'); - if ($id_group[0] === '0' || $id_group[0] === '') { + if ($get_all_groups !== '0') { $profile_data = db_get_all_rows_filter( 'tusuario_perfil', ['id_perfil' => $id_profile[0]] ); } else { - $profile_data = db_get_all_rows_filter( - 'tusuario_perfil', - [ - 'id_perfil' => $id_profile[0], - 'id_grupo' => $id_group[0], - ] - ); + if (strlen($id_profile[0]) > 0 && strlen($id_group[0]) > 0) { + $profile_data = db_get_all_rows_filter( + 'tusuario_perfil', + [ + 'id_perfil' => $id_profile[0], + 'id_grupo' => $id_group[0], + ] + ); + } } if (!users_is_admin()) { @@ -257,6 +260,21 @@ $data[2] .= html_print_select( ); array_push($table->data, $data); +$table->data[1][0] = ''; +$table->data[1][1] = html_print_label_input_block( + __('Show all groups'), + html_print_checkbox_switch( + 'get_all_groups', + 1, + $get_all_groups, + true, + false, + '', + false, + ' float-right' + ), + ['div_class' => 'center_align'] +); html_print_table($table); @@ -287,7 +305,8 @@ $(document).ready (function () { {"page" : "godmode/massive/massive_delete_profiles", "get_users" : 1, "id_group[]" : $("#groups_id").val(), - "id_profile[]" : $("#profiles_id").val() + "id_profile[]" : $("#profiles_id").val(), + "get_all_groups" : $('#checkbox-get_all_groups').is(':checked') ? 1 : 0 }, function (data, status) { options = ""; @@ -309,6 +328,10 @@ $(document).ready (function () { $("#profiles_id").change (function () { update_users(); }); + + $("#checkbox-get_all_groups").change (function () { + update_users(); + }); }); /* ]]> */ diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index f3a23ce1e8..7f9e0a5cd5 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -4464,9 +4464,9 @@ function html_print_checkbox_switch_extended( */ -function html_print_checkbox_switch($name, $value, $checked=false, $return=false, $disabled=false, $script='', $disabled_hidden=false) +function html_print_checkbox_switch($name, $value, $checked=false, $return=false, $disabled=false, $script='', $disabled_hidden=false, $class='') { - $output = html_print_checkbox_switch_extended($name, $value, (bool) $checked, $disabled, $script, '', true); + $output = html_print_checkbox_switch_extended($name, $value, (bool) $checked, $disabled, $script, '', true, '', $class); if (!$disabled_hidden) { $output .= html_print_input_hidden($name.'_sent', 1, true); }