User list php format
This commit is contained in:
parent
ec9936bd59
commit
aaf01c6a01
|
@ -383,512 +383,513 @@ if (($filter_group == 0) && ($filter_search == '')) {
|
|||
$search = false;
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->rowclass[0] = '';
|
||||
$table->data[0][0] = '<b>'.__('Group').'</b>';
|
||||
$table->data[0][1] = html_print_select_groups(
|
||||
false,
|
||||
'AR',
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->rowclass[0] = '';
|
||||
$table->data[0][0] = '<b>'.__('Group').'</b>';
|
||||
$table->data[0][1] = html_print_select_groups(
|
||||
false,
|
||||
'AR',
|
||||
true,
|
||||
'filter_group',
|
||||
$filter_group,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
$table->data[0][2] = '<b>'.__('Search').'</b>'.ui_print_help_tip(__('Search by username, fullname or email'), true);
|
||||
$table->data[0][3] = html_print_input_text(
|
||||
'filter_search',
|
||||
$filter_search,
|
||||
__('Search by username, fullname or email'),
|
||||
30,
|
||||
90,
|
||||
true
|
||||
);
|
||||
$table->data[0][4] = html_print_submit_button(
|
||||
__('Search'),
|
||||
'search',
|
||||
false,
|
||||
['class' => 'sub search'],
|
||||
true
|
||||
);
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_metaconsole() === false && is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
if (is_metaconsole() === false) {
|
||||
$url = '<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/users_setup&tab=user&pure='.(int) $config['pure']
|
||||
).'">'.__('metaconsole').'</a>';
|
||||
} else {
|
||||
$url = __('any node');
|
||||
}
|
||||
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. All users information is read only. Go to %s to manage it.',
|
||||
$url
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$table->width = '96%';
|
||||
$form_filter = "<form class='filters_form' method='post'>";
|
||||
$form_filter .= html_print_table($table, true);
|
||||
$form_filter .= '</form>';
|
||||
ui_toggle($form_filter, __('Show Options'));
|
||||
} else {
|
||||
$form_filter = "<form method='post'>";
|
||||
$form_filter .= html_print_table($table, true);
|
||||
$form_filter .= '</form>';
|
||||
ui_toggle(
|
||||
$form_filter,
|
||||
__('Users control filter'),
|
||||
__('Toggle filter(s)'),
|
||||
'',
|
||||
!$search
|
||||
);
|
||||
}
|
||||
|
||||
// Urls to sort the table.
|
||||
$url_up_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=up&pure='.$pure;
|
||||
$url_down_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=down&pure='.$pure;
|
||||
$url_up_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=up&pure='.$pure;
|
||||
$url_down_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=down&pure='.$pure;
|
||||
$url_up_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=up&pure='.$pure;
|
||||
$url_down_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=down&pure='.$pure;
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->align = [];
|
||||
$table->size = [];
|
||||
$table->valign = [];
|
||||
|
||||
$table->head[0] = __('User ID').ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown);
|
||||
$table->head[1] = __('Name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown);
|
||||
$table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown);
|
||||
|
||||
$table->head[3] = __('Admin');
|
||||
$table->head[4] = __('Profile / Group');
|
||||
$table->head[5] = __('Description');
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[6] = '<span title="Operations">'.__('Op.').'</span>';
|
||||
}
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
$table->align[2] = '';
|
||||
$table->size[2] = '150px';
|
||||
}
|
||||
|
||||
$table->align[3] = 'left';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$table->size[6] = '110px';
|
||||
} else {
|
||||
$table->size[6] = '85px';
|
||||
}
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
$table->valign[2] = 'top';
|
||||
$table->valign[3] = 'top';
|
||||
$table->valign[4] = 'top';
|
||||
$table->valign[5] = 'top';
|
||||
$table->valign[6] = 'top';
|
||||
}
|
||||
|
||||
$info1 = [];
|
||||
|
||||
$user_is_admin = users_is_admin();
|
||||
|
||||
if ($user_is_admin) {
|
||||
$info1 = get_users($order);
|
||||
} else {
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
// 0 is the group 'all'.
|
||||
if (isset($group_um[0])) {
|
||||
$info1 = get_users($order);
|
||||
} else {
|
||||
foreach ($group_um as $group => $value) {
|
||||
$info1 = array_merge($info1, users_get_users_by_group($group, $value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the users.
|
||||
if ($search) {
|
||||
foreach ($info1 as $iterator => $user_info) {
|
||||
$found = false;
|
||||
|
||||
if (!empty($filter_search)) {
|
||||
if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['fullname'])) != 0) {
|
||||
$found = true;
|
||||
}
|
||||
|
||||
if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['id_user'])) != 0) {
|
||||
$found = true;
|
||||
}
|
||||
|
||||
if (preg_match('/.*'.$filter_search.'.*/', $user_info['email']) != 0) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filter_group != 0) {
|
||||
$groups = users_get_groups(
|
||||
$user_info['id_user'],
|
||||
'AR',
|
||||
$user_info['is_admin']
|
||||
);
|
||||
|
||||
$id_groups = array_keys($groups);
|
||||
|
||||
if (array_search($filter_group, $id_groups) !== false) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
unset($info1[$iterator]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$info = $info1;
|
||||
|
||||
// Prepare pagination.
|
||||
ui_pagination(count($info));
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
$limit = (int) $config['block_size'];
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
$cont = 0;
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if (!$user_is_admin && $user_info['is_admin']) {
|
||||
// If user is not admin then don't display admin users.
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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
|
||||
);
|
||||
} else {
|
||||
$user_profiles_aux = users_get_user_profile($user_id);
|
||||
$user_profiles = [];
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($user_profiles_aux) === false) {
|
||||
$user_info['not_delete'] = 1;
|
||||
}
|
||||
|
||||
if ($user_profiles == false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$cont++;
|
||||
|
||||
// Manual pagination due the complicated process of the ACL data.
|
||||
if ($cont <= $offset && $search !== true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($cont > ($limit + $offset) && $search !== true) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ($rowPair) {
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
} else {
|
||||
$table->rowclass[$iterator] = 'rowOdd';
|
||||
}
|
||||
|
||||
$rowPair = !$rowPair;
|
||||
if ($user_info['disabled']) {
|
||||
$table->rowclass[$iterator] .= ' disabled_row_user';
|
||||
}
|
||||
|
||||
$iterator++;
|
||||
|
||||
if ($is_management_allowed === true
|
||||
&& ($user_is_admin
|
||||
|| $config['id_user'] == $user_info['id_user']
|
||||
|| (!$user_info['is_admin'] && (!isset($user_info['edit'])
|
||||
|| isset($group_um[0]) || (isset($user_info['edit'])
|
||||
&& $user_info['edit']))))
|
||||
) {
|
||||
$data[0] = '<a href="#" onclick="document.forms[\'edit_user_form_'.$user_info['id_user'].'\'].submit();">'.$user_id.'</a>';
|
||||
} else {
|
||||
$data[0] = $user_id;
|
||||
}
|
||||
|
||||
$data[1] = '<ul class="user_list_ul">';
|
||||
$data[1] .= '<li>'.$user_info['fullname'].'</li>';
|
||||
$data[1] .= '<li>'.$user_info['phone'].'</li>';
|
||||
$data[1] .= '<li>'.$user_info['email'].'</li>';
|
||||
$data[1] .= '</ul>';
|
||||
$data[2] = ui_print_timestamp($user_info['last_connect'], true);
|
||||
|
||||
if ($user_info['is_admin']) {
|
||||
$data[3] = html_print_image(
|
||||
'images/user_suit.png',
|
||||
true,
|
||||
'filter_group',
|
||||
$filter_group,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
true
|
||||
);
|
||||
$table->data[0][2] = '<b>'.__('Search').'</b>'.ui_print_help_tip(__('Search by username, fullname or email'), true);
|
||||
$table->data[0][3] = html_print_input_text(
|
||||
'filter_search',
|
||||
$filter_search,
|
||||
__('Search by username, fullname or email'),
|
||||
30,
|
||||
90,
|
||||
true
|
||||
);
|
||||
$table->data[0][4] = html_print_submit_button(
|
||||
__('Search'),
|
||||
'search',
|
||||
false,
|
||||
['class' => 'sub search'],
|
||||
true
|
||||
);
|
||||
[
|
||||
'alt' => __('Admin'),
|
||||
'title' => __('Administrator'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).' ';
|
||||
} else {
|
||||
$data[3] = '';
|
||||
}
|
||||
|
||||
$is_management_allowed = true;
|
||||
if (is_metaconsole() === false && is_management_allowed() === false) {
|
||||
$is_management_allowed = false;
|
||||
if (is_metaconsole() === false) {
|
||||
$url = '<a target="_blank" href="'.ui_get_meta_url(
|
||||
'index.php?sec=advanced&sec2=advanced/users_setup&tab=user&pure='.(int) $config['pure']
|
||||
).'">'.__('metaconsole').'</a>';
|
||||
} else {
|
||||
$url = __('any node');
|
||||
}
|
||||
$data[4] = '';
|
||||
if ($user_profiles !== false) {
|
||||
$total_profile = 0;
|
||||
|
||||
ui_print_warning_message(
|
||||
__(
|
||||
'This node is configured with centralized mode. All users information is read only. Go to %s to manage it.',
|
||||
$url
|
||||
)
|
||||
);
|
||||
}
|
||||
$data[4] .= '<div class="text_end">';
|
||||
foreach ($user_profiles as $row) {
|
||||
if ($total_profile <= 5) {
|
||||
$data[4] .= "<div class='float-left'>";
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / </div>';
|
||||
$data[4] .= "<div class='float-left pdd_l_5px'>";
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</div>';
|
||||
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$table->width = '96%';
|
||||
$form_filter = "<form class='filters_form' method='post'>";
|
||||
$form_filter .= html_print_table($table, true);
|
||||
$form_filter .= '</form>';
|
||||
ui_toggle($form_filter, __('Show Options'));
|
||||
} else {
|
||||
$form_filter = "<form method='post'>";
|
||||
$form_filter .= html_print_table($table, true);
|
||||
$form_filter .= '</form>';
|
||||
ui_toggle(
|
||||
$form_filter,
|
||||
__('Users control filter'),
|
||||
__('Toggle filter(s)'),
|
||||
'',
|
||||
!$search
|
||||
);
|
||||
}
|
||||
|
||||
// Urls to sort the table.
|
||||
$url_up_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=up&pure='.$pure;
|
||||
$url_down_id = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=id_user&sort=down&pure='.$pure;
|
||||
$url_up_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=up&pure='.$pure;
|
||||
$url_down_name = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=fullname&sort=down&pure='.$pure;
|
||||
$url_up_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=up&pure='.$pure;
|
||||
$url_down_last = '?sec='.$sec.'&sec2=godmode/users/user_list&sort_field=last_connect&sort=down&pure='.$pure;
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
|
||||
$table->head = [];
|
||||
$table->data = [];
|
||||
$table->align = [];
|
||||
$table->size = [];
|
||||
$table->valign = [];
|
||||
|
||||
$table->head[0] = __('User ID').ui_get_sorting_arrows($url_up_id, $url_down_id, $selectUserIDUp, $selectUserIDDown);
|
||||
$table->head[1] = __('Name').ui_get_sorting_arrows($url_up_name, $url_down_name, $selectFullnameUp, $selectFullnameDown);
|
||||
$table->head[2] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastConnectUp, $selectLastConnectDown);
|
||||
|
||||
$table->head[3] = __('Admin');
|
||||
$table->head[4] = __('Profile / Group');
|
||||
$table->head[5] = __('Description');
|
||||
if ($is_management_allowed === true) {
|
||||
$table->head[6] = '<span title="Operations">'.__('Op.').'</span>';
|
||||
}
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
$table->align[2] = '';
|
||||
$table->size[2] = '150px';
|
||||
}
|
||||
|
||||
$table->align[3] = 'left';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$table->size[6] = '110px';
|
||||
} else {
|
||||
$table->size[6] = '85px';
|
||||
}
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
$table->valign[0] = 'top';
|
||||
$table->valign[1] = 'top';
|
||||
$table->valign[2] = 'top';
|
||||
$table->valign[3] = 'top';
|
||||
$table->valign[4] = 'top';
|
||||
$table->valign[5] = 'top';
|
||||
$table->valign[6] = 'top';
|
||||
}
|
||||
|
||||
$info1 = [];
|
||||
|
||||
$user_is_admin = users_is_admin();
|
||||
|
||||
if ($user_is_admin) {
|
||||
$info1 = get_users($order);
|
||||
} else {
|
||||
$group_um = users_get_groups_UM($config['id_user']);
|
||||
// 0 is the group 'all'.
|
||||
if (isset($group_um[0])) {
|
||||
$info1 = get_users($order);
|
||||
} else {
|
||||
foreach ($group_um as $group => $value) {
|
||||
$info1 = array_merge($info1, users_get_users_by_group($group, $value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter the users.
|
||||
if ($search) {
|
||||
foreach ($info1 as $iterator => $user_info) {
|
||||
$found = false;
|
||||
|
||||
if (!empty($filter_search)) {
|
||||
if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['fullname'])) != 0) {
|
||||
$found = true;
|
||||
}
|
||||
|
||||
if (preg_match('/.*'.strtolower($filter_search).'.*/', strtolower($user_info['id_user'])) != 0) {
|
||||
$found = true;
|
||||
}
|
||||
|
||||
if (preg_match('/.*'.$filter_search.'.*/', $user_info['email']) != 0) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filter_group != 0) {
|
||||
$groups = users_get_groups(
|
||||
$user_info['id_user'],
|
||||
'AR',
|
||||
$user_info['is_admin']
|
||||
);
|
||||
|
||||
$id_groups = array_keys($groups);
|
||||
|
||||
if (array_search($filter_group, $id_groups) !== false) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
unset($info1[$iterator]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$info = $info1;
|
||||
|
||||
// Prepare pagination.
|
||||
ui_pagination(count($info));
|
||||
|
||||
$offset = (int) get_parameter('offset');
|
||||
$limit = (int) $config['block_size'];
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
$cont = 0;
|
||||
foreach ($info as $user_id => $user_info) {
|
||||
if (!$user_is_admin && $user_info['is_admin']) {
|
||||
// If user is not admin then don't display admin users.
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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
|
||||
);
|
||||
} else {
|
||||
$user_profiles_aux = users_get_user_profile($user_id);
|
||||
$user_profiles = [];
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($user_profiles_aux) === false) {
|
||||
$user_info['not_delete'] = 1;
|
||||
}
|
||||
|
||||
if ($user_profiles == false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$cont++;
|
||||
|
||||
// Manual pagination due the complicated process of the ACL data.
|
||||
if ($cont <= $offset && $search !== true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($cont > ($limit + $offset) && $search !== true) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ($rowPair) {
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
} else {
|
||||
$table->rowclass[$iterator] = 'rowOdd';
|
||||
}
|
||||
|
||||
$rowPair = !$rowPair;
|
||||
if ($user_info['disabled']) {
|
||||
$table->rowclass[$iterator] .= ' disabled_row_user';
|
||||
}
|
||||
|
||||
$iterator++;
|
||||
|
||||
if ($is_management_allowed === true
|
||||
&& ($user_is_admin
|
||||
|| $config['id_user'] == $user_info['id_user']
|
||||
|| (!$user_info['is_admin'] && (!isset($user_info['edit'])
|
||||
|| isset($group_um[0]) || (isset($user_info['edit'])
|
||||
&& $user_info['edit']))))
|
||||
) {
|
||||
$data[0] = '<a href="#" onclick="document.forms[\'edit_user_form_'.$user_info['id_user'].'\'].submit();">'.$user_id.'</a>';
|
||||
} else {
|
||||
$data[0] = $user_id;
|
||||
}
|
||||
|
||||
$data[1] = '<ul class="user_list_ul">';
|
||||
$data[1] .= '<li>'.$user_info['fullname'].'</li>';
|
||||
$data[1] .= '<li>'.$user_info['phone'].'</li>';
|
||||
$data[1] .= '<li>'.$user_info['email'].'</li>';
|
||||
$data[1] .= '</ul>';
|
||||
$data[2] = ui_print_timestamp($user_info['last_connect'], true);
|
||||
|
||||
if ($user_info['is_admin']) {
|
||||
$data[3] = html_print_image(
|
||||
'images/user_suit.png',
|
||||
true,
|
||||
[
|
||||
'alt' => __('Admin'),
|
||||
'title' => __('Administrator'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).' ';
|
||||
} else {
|
||||
$data[3] = '';
|
||||
}
|
||||
|
||||
$data[4] = '';
|
||||
if ($user_profiles !== false) {
|
||||
$total_profile = 0;
|
||||
|
||||
$data[4] .= '<div class="text_end">';
|
||||
foreach ($user_profiles as $row) {
|
||||
if ($total_profile <= 5) {
|
||||
$data[4] .= "<div class='float-left'>";
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / </div>';
|
||||
$data[4] .= "<div class='float-left pdd_l_5px'>";
|
||||
$data[4] .= groups_get_name($row['id_grupo'], true);
|
||||
$data[4] .= '</div>';
|
||||
|
||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||
$data[4] .= '<span onclick="showGroups()" class="pdd_l_15px">
|
||||
'.html_print_image(
|
||||
'images/zoom.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Show'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</span>';
|
||||
}
|
||||
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= "<div id='groups_list' class='invisible'>";
|
||||
$data[4] .= '<div >';
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / '.groups_get_name($row['id_grupo'], true).'</div>';
|
||||
$data[4] .= '<br/>';
|
||||
}
|
||||
|
||||
$total_profile++;
|
||||
}
|
||||
|
||||
if (isset($user_info['not_delete']) === true) {
|
||||
$data[4] .= __('Other profiles are also assigned.');
|
||||
$data[4] .= ui_print_help_tip(
|
||||
__('Other profiles you cannot manage are also assigned. These profiles are not shown. You cannot enable/disable or delete this user.'),
|
||||
true
|
||||
);
|
||||
if ($total_profile == 0 && count($user_profiles) >= 5) {
|
||||
$data[4] .= '<span onclick="showGroups()" class="pdd_l_15px">
|
||||
'.html_print_image(
|
||||
'images/zoom.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Show'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
).'</span>';
|
||||
}
|
||||
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '<br />';
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= __('The user doesn\'t have any assigned profile/group');
|
||||
$data[4] .= "<div id='groups_list' class='invisible'>";
|
||||
$data[4] .= '<div >';
|
||||
$data[4] .= profile_get_name($row['id_perfil']);
|
||||
$data[4] .= ' / '.groups_get_name($row['id_grupo'], true).'</div>';
|
||||
$data[4] .= '<br/>';
|
||||
}
|
||||
|
||||
$data[5] = ui_print_string_substr($user_info['comments'], 24, true);
|
||||
$total_profile++;
|
||||
}
|
||||
|
||||
if ($is_management_allowed === true) {
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
$data[6] = '';
|
||||
if ($user_is_admin
|
||||
|| $config['id_user'] == $user_info['id_user']
|
||||
|| isset($group_um[0])
|
||||
|| (!$user_info['is_admin'] && (!isset($user_info['edit'])
|
||||
|| (isset($user_info['edit']) && $user_info['edit'])))
|
||||
) {
|
||||
// Disable / Enable user.
|
||||
if (isset($user_info['not_delete']) === false) {
|
||||
if ($user_info['disabled'] == 0) {
|
||||
$toDoString = __('Disable');
|
||||
$toDoAction = '1';
|
||||
$toDoImage = 'images/lightbulb.png';
|
||||
$toDoClass = '';
|
||||
} else {
|
||||
$toDoString = __('Enable');
|
||||
$toDoAction = '0';
|
||||
$toDoImage = 'images/lightbulb_off.png';
|
||||
$toDoClass = 'filter_none';
|
||||
}
|
||||
if (isset($user_info['not_delete']) === true) {
|
||||
$data[4] .= __('Other profiles are also assigned.');
|
||||
$data[4] .= ui_print_help_tip(
|
||||
__('Other profiles you cannot manage are also assigned. These profiles are not shown. You cannot enable/disable or delete this user.'),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'id',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'disable_user',
|
||||
$toDoAction,
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_disable_enable',
|
||||
$toDoImage,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'data-title' => $toDoString,
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding '.$toDoClass,
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
}
|
||||
$data[4] .= '</div>';
|
||||
} else {
|
||||
$data[4] .= __('The user doesn\'t have any assigned profile/group');
|
||||
}
|
||||
|
||||
// Edit user.
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'" id="edit_user_form_'.$user_info['id_user'].'" class="inline">';
|
||||
$data[5] = ui_print_string_substr($user_info['comments'], 24, true);
|
||||
|
||||
if ($is_management_allowed === true) {
|
||||
$table->cellclass[][6] = 'action_buttons';
|
||||
$data[6] = '';
|
||||
if ($user_is_admin
|
||||
|| $config['id_user'] == $user_info['id_user']
|
||||
|| isset($group_um[0])
|
||||
|| (!$user_info['is_admin'] && (!isset($user_info['edit'])
|
||||
|| (isset($user_info['edit']) && $user_info['edit'])))
|
||||
) {
|
||||
// Disable / Enable user.
|
||||
if (isset($user_info['not_delete']) === false) {
|
||||
if ($user_info['disabled'] == 0) {
|
||||
$toDoString = __('Disable');
|
||||
$toDoAction = '1';
|
||||
$toDoImage = 'images/lightbulb.png';
|
||||
$toDoClass = '';
|
||||
} else {
|
||||
$toDoString = __('Enable');
|
||||
$toDoAction = '0';
|
||||
$toDoImage = 'images/lightbulb_off.png';
|
||||
$toDoClass = 'filter_none';
|
||||
}
|
||||
|
||||
$data[6] = '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'id',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'disable_user',
|
||||
$toDoAction,
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_disable_enable',
|
||||
$toDoImage,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
[
|
||||
'data-title' => $toDoString,
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding '.$toDoClass,
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
}
|
||||
|
||||
// Edit user.
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'" id="edit_user_form_'.$user_info['id_user'].'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'id_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'edit_user',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_edit_user',
|
||||
'images/config.png',
|
||||
'',
|
||||
'padding:0',
|
||||
true,
|
||||
[
|
||||
'data-title' => __('Edit'),
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
|
||||
if ($config['admin_can_delete_user']
|
||||
&& $user_info['id_user'] != $config['id_user']
|
||||
&& isset($user_info['not_delete']) === false
|
||||
) {
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'user_del',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_delete_user',
|
||||
'images/cross.png',
|
||||
'',
|
||||
'padding:0',
|
||||
true,
|
||||
[
|
||||
'data-title' => __('Delete'),
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'id_user',
|
||||
'delete_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'edit_user',
|
||||
'user_del',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_edit_user',
|
||||
'images/config.png',
|
||||
'',
|
||||
'padding:0',
|
||||
true,
|
||||
[
|
||||
'data-title' => __('Edit'),
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_all',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
|
||||
if ($config['admin_can_delete_user']
|
||||
&& $user_info['id_user'] != $config['id_user']
|
||||
&& isset($user_info['not_delete']) === false
|
||||
) {
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'user_del',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_image(
|
||||
'submit_delete_user',
|
||||
'images/cross.png',
|
||||
'',
|
||||
'padding:0',
|
||||
true,
|
||||
[
|
||||
'data-title' => __('Delete'),
|
||||
'data-use_title_for_force_title' => '1',
|
||||
'class' => 'forced_title no-padding',
|
||||
]
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$data[6] .= '<form method="POST" action="index.php?sec='.$sec.'&sec2=godmode/users/user_list&pure='.$pure.'" class="inline">';
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_user',
|
||||
$user_info['id_user'],
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'user_del',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= html_print_input_hidden(
|
||||
'delete_all',
|
||||
'1',
|
||||
true
|
||||
);
|
||||
$data[6] .= '</form>';
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode.
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode.
|
||||
}
|
||||
}
|
||||
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination(count($info), false, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
|
||||
echo '<div style="width: '.$table->width.'" class="action-buttons">';
|
||||
unset($table);
|
||||
if ($is_management_allowed === true) {
|
||||
if ($config['admin_can_add_user'] !== false) {
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'">';
|
||||
html_print_input_hidden('new_user', 1);
|
||||
html_print_submit_button(__('Create user'), 'crt', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
} else {
|
||||
echo '<i>'.__("The current authentication scheme doesn't support creating users on %s", get_product_name()).'</i>';
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode.
|
||||
}
|
||||
} else {
|
||||
$data[6] .= '';
|
||||
// Delete button not in this mode.
|
||||
}
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
html_print_table($table);
|
||||
ui_pagination(count($info), false, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
echo '<div style="width: '.$table->width.'" class="action-buttons">';
|
||||
unset($table);
|
||||
if ($is_management_allowed === true) {
|
||||
if ($config['admin_can_add_user'] !== false) {
|
||||
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/users/configure_user&pure='.$pure.'">';
|
||||
html_print_input_hidden('new_user', 1);
|
||||
html_print_submit_button(__('Create user'), 'crt', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
} else {
|
||||
echo '<i>'.__("The current authentication scheme doesn't support creating users on %s", get_product_name()).'</i>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
function showGroups(){
|
||||
var groups_list = document.getElementById("groups_list");
|
||||
var groups_list = document.getElementById("groups_list");
|
||||
|
||||
if(groups_list.style.display == "none"){
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "block");
|
||||
}else{
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "none");
|
||||
};
|
||||
if(groups_list.style.display == "none"){
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "block");
|
||||
}else{
|
||||
document.querySelectorAll("[id=groups_list]").forEach(element=>
|
||||
element.style.display = "none");
|
||||
};
|
||||
}
|
||||
</script>';
|
||||
|
|
Loading…
Reference in New Issue