diff options
author | plegall <plg@piwigo.org> | 2005-01-19 23:36:43 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2005-01-19 23:36:43 +0000 |
commit | da60b94ca0450f7e9656564fbb944cc98d9b913c (patch) | |
tree | 8f0e4a379eb237ff110fe5052babede845d0c4c1 | |
parent | 54e615890c434d09492c6ba0c623b23bbcc8d246 (diff) |
- new features : multipages users list. The list can be ordered by id (same
effect than registration date) or by username. On each line, you can
access properties and permissions for the user
git-svn-id: http://piwigo.org/svn/trunk@709 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/user_perm.php | 4 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/admin.lang.php | 5 | ||||
-rw-r--r-- | language/fr_FR.iso-8859-1/admin.lang.php | 5 | ||||
-rw-r--r-- | profile.php | 128 | ||||
-rw-r--r-- | template/default/profile.tpl | 43 |
5 files changed, 183 insertions, 2 deletions
diff --git a/admin/user_perm.php b/admin/user_perm.php index 4c58725b5..2583306a1 100644 --- a/admin/user_perm.php +++ b/admin/user_perm.php @@ -36,6 +36,10 @@ if (isset($_POST['submituser'])) { $userdata = getuserdata($_POST['username']); } +else if (isset($_GET['user_id'])) +{ + $userdata = getuserdata(intval($_GET['user_id'])); +} else if (isset($_POST['falsify']) and isset($_POST['cat_true']) and count($_POST['cat_true']) > 0) diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php index 22beb924e..01cd891d9 100644 --- a/language/en_UK.iso-8859-1/admin.lang.php +++ b/language/en_UK.iso-8859-1/admin.lang.php @@ -323,6 +323,11 @@ $lang['user_delete'] = 'Delete user'; $lang['user_delete_hint'] = 'Click here to delete this user. Warning! This operation cannot be undone!'; $lang['permuser_only_private'] = 'Only private categories are shown'; $lang['permuser_info'] = 'Only private categories are listed. Private/Public category status can be set in screen "Categories > Public / Private"'; +$lang['order_by'] = 'order by'; +$lang['registration_date'] = 'registration date'; +$lang['ascending'] = 'ascending'; +$lang['descending'] = 'descending'; +$lang['actions'] = 'actions'; // Groups $lang['group_confirm_delete']= 'Confirm group deletion'; diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php index c8f32a111..9221bfc8b 100644 --- a/language/fr_FR.iso-8859-1/admin.lang.php +++ b/language/fr_FR.iso-8859-1/admin.lang.php @@ -331,6 +331,11 @@ $lang['user_delete'] = 'Supprimer l\'utilisateur'; $lang['user_delete_hint'] = 'Cliquez ici pour supprimer définitivement l\'utilisateur. Attention cette opération ne pourra être rétablie.'; $lang['permuser_info'] = 'Seules les catégories déclarées en privée sont affichées. Le status privé/public des catégories est configurable dans l\'écran "Catégories > Sécurité" de l\'administration.'; $lang['permuser_only_private'] = 'Seules les catégories privées sont représentées'; +$lang['order_by'] = 'classer par'; +$lang['registration_date'] = 'date d\'enregistrement'; +$lang['ascending'] = 'croissant'; +$lang['descending'] = 'décroissant'; +$lang['actions'] = 'actions'; // Groups $lang['group_list_title'] = 'Liste des groupes existants'; diff --git a/profile.php b/profile.php index 2f4f3311e..28a7af672 100644 --- a/profile.php +++ b/profile.php @@ -34,6 +34,10 @@ if (defined('IN_ADMIN') and isset($_POST['submituser'])) { $userdata = getuserdata($_POST['username']); } +else if (defined('IN_ADMIN') and IN_ADMIN and isset($_GET['user_id'])) +{ + $userdata = getuserdata(intval($_GET['user_id'])); +} elseif (defined('IN_ADMIN') and isset($_POST['submit'])) { $userdata = getuserdata(intval($_POST['userid'])); @@ -226,6 +230,22 @@ if (defined('IN_ADMIN') and IN_ADMIN and empty($userdata)) $template->assign_block_vars('select_user',array()); $admin_profile = add_session_id(PHPWG_ROOT_PATH.'admin.php?page=profile'); + + $conf['users_page'] = 20; + $start = isset($_GET['start']) ? $_GET['start'] : 0; + + $query = ' +SELECT COUNT(*) AS counter + FROM '.USERS_TABLE.' + WHERE id != 2 +;'; + list($counter) = mysql_fetch_row(pwg_query($query)); + $url = PHPWG_ROOT_PATH.'admin.php'.get_query_string_diff(array('start')); + $navbar = create_navigation_bar($url, + $counter, + $start, + $conf['users_page'], + ''); $template->assign_vars( array( @@ -234,10 +254,115 @@ if (defined('IN_ADMIN') and IN_ADMIN and empty($userdata)) 'L_FIND_USERNAME'=>$lang['Find_username'], 'L_AUTH_USER'=>$lang['permuser_only_private'], 'L_SUBMIT'=>$lang['submit'], - + 'L_STATUS'=>$lang['user_status'], + 'L_USERNAME' => $lang['login'], + 'L_EMAIL' => $lang['mail_address'], + 'L_ORDER_BY' => $lang['order_by'], + 'L_ACTIONS' => $lang['actions'], + 'L_PERMISSIONS' => $lang['permissions'], + 'L_USERS_LIST' => $lang['title_liste_users'], + + 'NAVBAR'=>$navbar, 'F_SEARCH_USER_ACTION' => $admin_profile, + 'F_ORDER_ACTION' => $admin_profile, 'U_SEARCH_USER' => add_session_id(PHPWG_ROOT_PATH.'admin/search.php') )); + + $order_by_items = array('id' => $lang['registration_date'], + 'username' => $lang['login']); + foreach ($order_by_items as $item => $label) + { + $selected = (isset($_GET['order_by']) and $_GET['order_by'] == $item) ? + 'selected="selected"' : ''; + $template->assign_block_vars( + 'select_user.order_by', + array( + 'VALUE' => $item, + 'CONTENT' => $label, + 'SELECTED' => $selected + )); + } + + $direction_items = array('asc' => $lang['ascending'], + 'desc' => $lang['descending']); + foreach ($direction_items as $item => $label) + { + $selected = (isset($_GET['direction']) and $_GET['direction'] == $item) ? + 'selected="selected"' : ''; + $template->assign_block_vars( + 'select_user.direction', + array( + 'VALUE' => $item, + 'CONTENT' => $label, + 'SELECTED' => $selected + )); + } + + $profile_url = PHPWG_ROOT_PATH.'admin.php?page=profile&user_id='; + $perm_url = PHPWG_ROOT_PATH.'admin.php?page=user_perm&user_id='; + + $users = array(); + $user_ids = array(); + $groups_content = array(); + + $order_by = 'id'; + if (isset($_GET['order_by']) + and in_array($_GET['order_by'], array_keys($order_by_items))) + { + $order_by = $_GET['order_by']; + } + + $direction = 'ASC'; + if (isset($_GET['direction']) + and in_array($_GET['direction'], array_keys($direction_items))) + { + $direction = strtoupper($_GET['direction']); + } + + $query = ' +SELECT id, username, mail_address, status + FROM '.USERS_TABLE.' + WHERE id != 2 + ORDER BY '.$order_by.' '.$direction.' + LIMIT '.$start.', '.$conf['users_page'].' +;'; + $result = pwg_query($query); + while ($row = mysql_fetch_array($result)) + { + array_push($users, $row); + array_push($user_ids, $row['id']); + $user_groups[$row['id']] = array(); + } + + $query = ' +SELECT user_id, group_id, name + FROM '.USER_GROUP_TABLE.' INNER JOIN '.GROUPS_TABLE.' ON group_id = id + WHERE user_id IN ('.implode(',', $user_ids).') +;'; + $result = pwg_query($query); + while ($row = mysql_fetch_array($result)) + { + $groups_content[$row['group_id']] = $row['name']; + array_push($user_groups[$row['user_id']], $row['group_id']); + } + + foreach ($users as $item) + { + $groups = preg_replace('/(\d+)/e', + "\$groups_content['$1']", + implode(', ', $user_groups[$item['id']])); + + $template->assign_block_vars( + 'select_user.user', + array( + 'U_MOD'=>add_session_id($profile_url.$item['id']), + 'U_PERM'=>add_session_id($perm_url.$item['id']), + 'USERNAME'=>$item['username'], + 'STATUS'=>$item['status'], + 'EMAIL'=>isset($item['mail_address']) ? $item['mail_address'] : '', + 'GROUPS'=>$groups + )); + } } else { @@ -289,6 +414,7 @@ else 'L_YES'=>$lang['yes'], 'L_NO'=>$lang['no'], 'L_SUBMIT'=>$lang['submit'], + 'L_RESET'=>$lang['reset'], 'L_RETURN' => $lang['home'], 'L_RETURN_HINT' => $lang['home_hint'], diff --git a/template/default/profile.tpl b/template/default/profile.tpl index b672e566f..79f15764e 100644 --- a/template/default/profile.tpl +++ b/template/default/profile.tpl @@ -5,6 +5,46 @@ <input type="submit" name="submituser" value="{L_LOOKUP_USER}" class="bouton" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="bouton" onClick="window.open('{U_SEARCH_USER}', '_phpwgsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /> </form> + +<div class="admin">{L_USERS_LIST}</div> +<form method="get" action="{F_ORDER_ACTION}"> +<input type="hidden" name="page" value="profile" /> +<div style="text-align:center"> + {L_ORDER_BY} + <select name="order_by"> + <!-- BEGIN order_by --> + <option value="{select_user.order_by.VALUE}" {select_user.order_by.SELECTED} >{select_user.order_by.CONTENT}</option> + <!-- END order_by --> + </select> + <select name="direction"> + <!-- BEGIN direction --> + <option value="{select_user.direction.VALUE}" {select_user.direction.SELECTED} >{select_user.direction.CONTENT}</option> + <!-- END direction --> + </select> + <input type="submit" value="{L_SUBMIT}" class="bouton" /> +</div> +</form> + +<table style="width:100%;" > + <tr class="throw"> + <th style="width:20%;">{L_USERNAME}</th> + <th style="width:20%;">{L_STATUS}</th> + <th style="width:30%;">{L_EMAIL}</th> + <th style="width:30%;">{L_GROUPS}</th> + <th style="width:1%;">{L_ACTIONS}</th> + </tr> + <!-- BEGIN user --> + <tr> + <td><a href="{select_user.user.U_MOD}">{select_user.user.USERNAME}</a></td> + <td>{select_user.user.STATUS}</td> + <td>{select_user.user.EMAIL}</td> + <td>{select_user.user.GROUPS}</td> +<!-- [<a href="{select_user.user.U_MOD}">{L_MODIFY}</a>] --> + <td>[<a href="{select_user.user.U_PERM}">{L_PERMISSIONS}</a>]</td> + </tr> + <!-- END user --> +</table> +<div class="navigationBar">{NAVBAR}</div> <!-- END select_user --> <!-- BEGIN modify --> <!-- BEGIN profile --> @@ -109,6 +149,7 @@ <tr> <td colspan="2" align="center"> <input type="submit" name="submit" value="{L_SUBMIT}" class="bouton" /> + <input type="reset" name="reset" value="{L_RESET}" class="bouton" /> </td> </tr> </table> @@ -118,4 +159,4 @@ <a href="{U_RETURN}" title="{L_RETURN_HINT}">[{L_RETURN}]</a> </div> <!-- END profile --> -<!-- END modify -->
\ No newline at end of file +<!-- END modify --> |