- user list updated : ability to filter list on status. Function get_enums

comes back to retrieve the list of possible status in the database.


git-svn-id: http://piwigo.org/svn/trunk@777 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2005-04-30 14:36:57 +00:00
parent 5293402be5
commit 9cfba96167
4 changed files with 81 additions and 0 deletions
+38
View File
@@ -155,6 +155,29 @@ while ($row = mysql_fetch_array($result))
));
}
$blockname = 'status_option';
$template->assign_block_vars(
$blockname,
array(
'VALUE'=> -1,
'CONTENT' => '------------',
'SELECTED' => ''
));
foreach (get_enums(USERS_TABLE, 'status') as $status)
{
$selected = (isset($_GET['status']) and $_GET['status'] == $status) ?
'selected="selected"' : '';
$template->assign_block_vars(
$blockname,
array(
'VALUE' => $status,
'CONTENT' => $lang['user_status_'.$status],
'SELECTED' => $selected
));
}
// +-----------------------------------------------------------------------+
// | filter |
// +-----------------------------------------------------------------------+
@@ -186,6 +209,11 @@ if (isset($_GET['group'])
$filter['group'] = $_GET['group'];
}
if (isset($_GET['status'])
and in_array($_GET['status'], get_enums(USERS_TABLE, 'status')))
{
$filter['status'] = $_GET['status'];
}
// +-----------------------------------------------------------------------+
// | navigation bar |
@@ -205,6 +233,11 @@ if (isset($filter['group']))
$query.= '
AND group_id = '.$filter['group'];
}
if (isset($filter['status']))
{
$query.= '
AND status = \''.$filter['status']."'";
}
$query.= '
;';
list($counter) = mysql_fetch_row(pwg_query($query));
@@ -258,6 +291,11 @@ if (isset($filter['group']))
$query.= '
AND group_id = '.$filter['group'];
}
if (isset($filter['status']))
{
$query.= '
AND status = \''.$filter['status']."'";
}
$query.= '
ORDER BY '.$order_by.' '.$direction.'
LIMIT '.$start.', '.$conf['users_page'].'