function user_filter_form
7.x user.admin.inc | user_filter_form() |
6.x user.admin.inc | user_filter_form() |
Form builder; Return form for user administration filters.
See also
Related topics
2 string references to 'user_filter_form'
- user_admin in drupal-6.x/
modules/ user/ user.admin.inc - Page callback: Generates the appropriate user administration form.
- user_theme in drupal-6.x/
modules/ user/ user.module - Implementation of hook_theme().
File
- drupal-6.x/
modules/ user/ user.admin.inc, line 49 - Admin page callback file for the user module.
Code
function user_filter_form() {
$session = &$_SESSION['user_overview_filter'];
$session = is_array($session) ? $session : array();
$filters = user_filters();
$i = 0;
$form['filters'] = array(
'#type' => 'fieldset',
'#title' => t('Show only users where'),
'#theme' => 'user_filters',
);
foreach ($session as $filter) {
list($type, $value) = $filter;
// Merge an array of arrays into one if necessary.
$options = $type == 'permission' ? call_user_func_array('array_merge', $filters[$type]['options']) : $filters[$type]['options'];
$params = array('%property' => $filters[$type]['title'], '%value' => $options[$value]);
if ($i++ > 0) {
$form['filters']['current'][] = array('#value' => t('<em>and</em> where <strong>%property</strong> is <strong>%value</strong>', $params));
}
else {
$form['filters']['current'][] = array('#value' => t('<strong>%property</strong> is <strong>%value</strong>', $params));
}
}
foreach ($filters as $key => $filter) {
$names[$key] = $filter['title'];
$form['filters']['status'][$key] = array(
'#type' => 'select',
'#options' => $filter['options'],
);
}
$form['filters']['filter'] = array(
'#type' => 'radios',
'#options' => $names,
);
$form['filters']['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => (count($session) ? t('Refine') : t('Filter')),
);
if (count($session)) {
$form['filters']['buttons']['undo'] = array(
'#type' => 'submit',
'#value' => t('Undo'),
);
$form['filters']['buttons']['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset'),
);
}
drupal_add_js('misc/form.js', 'core');
return $form;
}