mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 11:49:56 +03:00
- 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
This commit is contained in:
parent
54e615890c
commit
da60b94ca0
5 changed files with 183 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
126
profile.php
126
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']));
|
||||
|
@ -227,6 +231,22 @@ if (defined('IN_ADMIN') and IN_ADMIN and empty($userdata))
|
|||
|
||||
$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(
|
||||
'L_SELECT_USERNAME'=>$lang['Select_username'],
|
||||
|
@ -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'],
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue