From 9e90c8da07a2f361fc8c0649c8fc8e91d008d63d Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 20 Sep 2022 13:56:36 +0200 Subject: [PATCH] #9506 Changes in user profiles --- pandora_console/godmode/users/user_list.php | 113 +++++++++++++++----- 1 file changed, 85 insertions(+), 28 deletions(-) diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index efc3321c2c..b0dda31890 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -52,6 +52,8 @@ if (is_ajax()) { $method = get_parameter('method'); $group_id = get_parameter('group_id'); $group_recursion = (bool) get_parameter('group_recursion', 0); + $get_user_profile_group = (bool) get_parameter('get_user_profile_group', false); + $return_all = false; if ($group_id == -1) { @@ -93,6 +95,37 @@ if (is_ajax()) { echo json_encode($ret_id); return; } + + if ($get_user_profile_group === true) { + $id_user = get_parameter('id_user'); + + $user_profiles = []; + + // User profiles. + if (users_is_admin()) { + $user_profiles = db_get_all_rows_field_filter( + 'tusuario_perfil', + 'id_usuario', + $id_user + ); + } else { + $user_profiles_aux = users_get_user_profile($id_user); + foreach ($group_um as $key => $value) { + if (isset($user_profiles_aux[$key]) === true) { + $user_profiles[$key] = $user_profiles_aux[$key]; + unset($user_profiles_aux[$key]); + } + } + } + + foreach ($user_profiles as $key => $value) { + $user_profiles[$key]['id_perfil'] = profile_get_name($value['id_perfil']); + $user_profiles[$key]['id_grupo'] = groups_get_name($value['id_grupo'], true); + } + + echo json_encode($user_profiles); + return; + } } $sortField = get_parameter('sort_field'); @@ -588,10 +621,8 @@ $cont = 0; foreach ($info as $user_id => $user_info) { // User profiles. if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) { - $user_profiles = db_get_all_rows_field_filter( - 'tusuario_perfil', - 'id_usuario', - $user_id + $user_profiles = db_get_all_rows_sql( + 'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'" LIMIT 5' ); } else { $user_profiles_aux = users_get_user_profile($user_id); @@ -674,9 +705,9 @@ foreach ($info as $user_id => $user_info) { if ($user_profiles !== false) { $total_profile = 0; - $data[4] .= '
'; + $data[4] .= '
'; foreach ($user_profiles as $row) { - if ($total_profile <= 5) { + if ($total_profile < 5) { $data[4] .= "
"; $data[4] .= profile_get_name($row['id_perfil']); $data[4] .= ' /
'; @@ -685,8 +716,7 @@ foreach ($info as $user_id => $user_info) { $data[4] .= '
'; if ($total_profile == 0 && count($user_profiles) >= 5) { - $data[4] .= ' - '.html_print_image( + $data[4] .= ''.html_print_image( 'images/zoom.png', true, [ @@ -694,16 +724,15 @@ foreach ($info as $user_id => $user_info) { 'class' => 'invert_filter', ] ).''; + + $data[4] .= html_print_input_hidden( + 'show_groups_'.$row['id_usuario'], + -1, + true + ); } - $data[4] .= '
'; - $data[4] .= '
'; - $data[4] .= '
'; - } else { - $data[4] .= "'; enterprise_hook('close_meta_frame'); -echo ''; +;