2010-07-18 Miguel de Dios <miguel.dedios@artica.es>
* include/auth/mysql.php: added function "get_users" the check to $order parameter if it is array, extract the field and order. * operation/users/user.php, godmode/users/user_list.php: added posibility to sort by columns ID User, Full name or Last Contanct. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3022 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
99f4d3499d
commit
bef3314367
|
@ -1,3 +1,11 @@
|
|||
2010-07-18 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/auth/mysql.php: added function "get_users" the check to $order
|
||||
parameter if it is array, extract the field and order.
|
||||
|
||||
* operation/users/user.php, godmode/users/user_list.php: added posibility to
|
||||
sort by columns ID User, Full name or Last Contanct.
|
||||
|
||||
2010-07-18 Raúl Mateos <raulofpandora@gmail.com>
|
||||
|
||||
* operation/incidents/incident_detail.php: Change Add button to links.
|
||||
|
|
|
@ -25,6 +25,57 @@ if (! give_acl ($config['id_user'], 0, "UM")) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$sortField = get_parameter('sort_field');
|
||||
$sort = get_parameter('sort', 'none');
|
||||
|
||||
$selected = 'border: 1px solid black;';
|
||||
$selectUserIDUp = '';
|
||||
$selectUserIDDown = '';
|
||||
$selectFullnameUp = '';
|
||||
$selectFullnameDown = '';
|
||||
$selectLastConnectUp = '';
|
||||
$selectLastConnectDown = '';
|
||||
$order = null;
|
||||
|
||||
switch ($sortField) {
|
||||
case 'id_user':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectUserIDUp = $selected;
|
||||
$order = array('field' => 'id_user', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectUserIDDown = $selected;
|
||||
$order = array('field' => 'id_user', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'fullname':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectFullnameUp = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectFullnameDown = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'last_connect':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectLastConnectUp = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectLastConnectDown = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
print_page_header (__('User management').' » '.__('Users defined in Pandora'), "images/god3.png", false, "", true);
|
||||
|
||||
|
@ -61,9 +112,15 @@ $table->data = array ();
|
|||
$table->align = array ();
|
||||
$table->size = array ();
|
||||
|
||||
$table->head[0] = __('User ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Last contact');
|
||||
$table->head[0] = __('User ID') . ' ' .
|
||||
'<a href="?sec=gusuarios&sec2=godmode/users/user_list&sort_field=id_user&sort=up"><img src="images/sort_up.png" style="' . $selectUserIDUp . '" /></a>' .
|
||||
'<a href="?sec=gusuarios&sec2=godmode/users/user_list&sort_field=id_user&sort=down"><img src="images/sort_down.png" style="' . $selectUserIDDown . '" /></a>';
|
||||
$table->head[1] = __('Name') . ' ' .
|
||||
'<a href="?sec=gusuarios&sec2=godmode/users/user_list&sort_field=fullname&sort=up"><img src="images/sort_up.png" style="' . $selectFullnameUp . '" /></a>' .
|
||||
'<a href="?sec=gusuarios&sec2=godmode/users/user_list&sort_field=fullname&sort=down"><img src="images/sort_down.png" style="' . $selectFullnameDown . '" /></a>';
|
||||
$table->head[2] = __('Last contact') . ' ' .
|
||||
'<a href="?sec=gusuarios&sec2=godmode/users/user_list&sort_field=last_connect&sort=up"><img src="images/sort_up.png" style="' . $selectLastConnectUp . '" /></a>' .
|
||||
'<a href="?sec=gusuarios&sec2=godmode/users/user_list&sort_field=last_connect&sort=down"><img src="images/sort_down.png" style="' . $selectLastConnectDown . '" /></a>';
|
||||
$table->head[3] = __('Profile');
|
||||
$table->head[4] = __('Description');
|
||||
$table->head[5] = '';
|
||||
|
@ -74,8 +131,8 @@ $table->align[5] = "center";
|
|||
$table->size[5] = 40;
|
||||
|
||||
$info = array ();
|
||||
// Get users ordered by id_user
|
||||
$info = get_users ("id_user",array ('offset' => (int) get_parameter ('offset'),
|
||||
|
||||
$info = get_users ($order, array ('offset' => (int) get_parameter ('offset'),
|
||||
'limit' => (int) $config['block_size']));
|
||||
|
||||
// Prepare pagination
|
||||
|
|
|
@ -192,17 +192,22 @@ function get_user_info ($user) {
|
|||
* @return array An array of user information
|
||||
*/
|
||||
function get_users ($order = "fullname", $filter = false, $fields = false) {
|
||||
switch ($order) {
|
||||
case "id_user":
|
||||
case "registered":
|
||||
case "last_connect":
|
||||
case "fullname":
|
||||
break;
|
||||
default:
|
||||
$order = "fullname";
|
||||
if (is_array($order)) {
|
||||
$filter['order'] = $order['field'] . ' ' . $order['order'];
|
||||
}
|
||||
else {
|
||||
switch ($order) {
|
||||
case "registered":
|
||||
case "last_connect":
|
||||
case "fullname":
|
||||
break;
|
||||
default:
|
||||
$order = "fullname";
|
||||
break;
|
||||
}
|
||||
|
||||
$filter['order'] = $order." ASC";
|
||||
}
|
||||
|
||||
$filter['order'] = $order." ASC";
|
||||
|
||||
|
||||
$output = array();
|
||||
|
|
|
@ -20,6 +20,57 @@ global $config;
|
|||
|
||||
check_login ();
|
||||
|
||||
$sortField = get_parameter('sort_field');
|
||||
$sort = get_parameter('sort', 'none');
|
||||
|
||||
$selected = 'border: 1px solid black;';
|
||||
$selectUserIDUp = '';
|
||||
$selectUserIDDown = '';
|
||||
$selectFullnameUp = '';
|
||||
$selectFullnameDown = '';
|
||||
$selectLastConnectUp = '';
|
||||
$selectLastConnectDown = '';
|
||||
$order = null;
|
||||
|
||||
switch ($sortField) {
|
||||
case 'id_user':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectUserIDUp = $selected;
|
||||
$order = array('field' => 'id_user', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectUserIDDown = $selected;
|
||||
$order = array('field' => 'id_user', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'fullname':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectFullnameUp = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectFullnameDown = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'last_connect':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectLastConnectUp = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'ASC');
|
||||
break;
|
||||
case 'down':
|
||||
$selectLastConnectDown = $selected;
|
||||
$order = array('field' => 'fullname', 'order' => 'DESC');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
print_page_header (__('Pandora users'), "images/group.png", false, "", false, "");
|
||||
|
||||
|
@ -31,9 +82,15 @@ $table->head = array ();
|
|||
$table->data = array ();
|
||||
$table->align = array ();
|
||||
|
||||
$table->head[0] = __('User ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Last contact');
|
||||
$table->head[0] = __('User ID') . ' ' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=id_user&sort=up"><img src="images/sort_up.png" style="' . $selectUserIDUp . '" /></a>' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=id_user&sort=down"><img src="images/sort_down.png" style="' . $selectUserIDDown . '" /></a>';
|
||||
$table->head[1] = __('Name') . ' ' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=fullname&sort=up"><img src="images/sort_up.png" style="' . $selectFullnameUp . '" /></a>' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=fullname&sort=down"><img src="images/sort_down.png" style="' . $selectFullnameDown . '" /></a>';
|
||||
$table->head[2] = __('Last contact') . ' ' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=last_connect&sort=up"><img src="images/sort_up.png" style="' . $selectLastConnectUp . '" /></a>' .
|
||||
'<a href="?sec=usuarios&sec2=operation/users/user&sort_field=last_connect&sort=down"><img src="images/sort_down.png" style="' . $selectLastConnectDown . '" /></a>';
|
||||
$table->head[3] = __('Profile');
|
||||
$table->head[4] = __('Description');
|
||||
|
||||
|
@ -42,8 +99,8 @@ $table->align[3] = "center";
|
|||
|
||||
|
||||
$info = array ();
|
||||
// Get users ordered by id_user
|
||||
$info = get_users ("id_user",array ('offset' => (int) get_parameter ('offset'),
|
||||
|
||||
$info = get_users ($order,array ('offset' => (int) get_parameter ('offset'),
|
||||
'limit' => (int) $config['block_size']));
|
||||
|
||||
//Only the users from the user groups are visible
|
||||
|
|
Loading…
Reference in New Issue