function advuser_admin_users_form in Advanced User 5
1 string reference to 'advuser_admin_users_form'
File
- ./
advuser.module, line 430
Code
function advuser_admin_users_form() {
global $form_values;
$op = $form_values['op'];
if ($op == 'Update all') {
$all = TRUE;
}
foreach (advuser_admin_users_operations() as $key => $value) {
if ($value[2] == 'confirm') {
if ($_POST['edit']['options_all']['operation'] == $key && $all || $_POST['edit']['options_sel']['operation'] == $key && count($_POST['edit']['users']) > 0 || $_POST['edit']['operation'] == $key) {
return advuser_multiple_confirm($all, $key, $value[1]);
//return call_user_func($value[1], $all);
//return advuser_multiple_delete_confirm($all);
}
}
}
$filter = advuser_admin_user_build_filter_query();
$listno = variable_get('advuser_listno', ADVUSER_DEFAULT_LISTNO);
$result = pager_query('SELECT u.* FROM {users} u ' . $filter['join'] . ' LEFT JOIN {profile_values} pv ON u.uid = pv.uid LEFT JOIN {profile_fields} pf on pv.fid = pf.fid ' . $filter['where'] . ' GROUP BY u.uid ' . $filter['having'] . ' ORDER BY u.login DESC', $listno, 0, NULL, $filter['args']);
//$result = 'SELECT u.* FROM {users} u '. $filter['join'] .' LEFT JOIN {profile_values} pv ON u.uid = pv.uid LEFT JOIN {profile_fields} pf on pv.fid = pf.fid '. $filter['where'] .' GROUP BY u.uid ' . $filter['having'] . ' ORDER BY u.login DESC', $listno, 0, $filter['args'];
//$result .= tablesort_sql($header);
$form['options_all'] = array(
'#type' => 'fieldset',
'#title' => t('Mass update on every record'),
'#prefix' => "<div class=\"container-inline\">",
'#suffix' => "</div>",
'#tree' => TRUE,
);
$options = array();
foreach (advuser_admin_users_operations() as $key => $value) {
$options[$key] = $value[0];
}
$form['options_all']['operation'] = array(
'#type' => 'select',
'#options' => $options,
);
$form['options_all']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update all'),
);
$form['options_sel'] = array(
'#type' => 'fieldset',
'#title' => t('Update on selected records only'),
'#prefix' => "<div class=\"container-inline\">",
'#suffix' => "</div>",
'#tree' => TRUE,
);
$options = array();
foreach (advuser_admin_users_operations() as $key => $value) {
$options[$key] = $value[0];
}
$form['options_sel']['operation'] = array(
'#type' => 'select',
'#options' => $options,
);
$form['options_sel']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
$destination = drupal_get_destination();
$status = array(
t('blocked'),
t('active'),
);
while ($usr = db_fetch_object($result)) {
$users[$usr->uid] = '';
$form['name'][$usr->uid] = array(
'#value' => theme('username', $usr),
);
$form['status'][$account->uid] = array(
'#value' => $status[$account->status],
);
$form['access'][$usr->uid] = array(
'#value' => $usr->access ? t('%time ago', array(
'%time' => format_interval(time() - $usr->access),
)) : t('never'),
);
//$form['access'][$usr->access] = array('#value' => ($usr->access ? format_interval(time() - $usr->access)));
$form['operations'][$usr->uid] = array(
'#value' => l(t('edit'), 'user/' . $usr->uid . '/edit', array(), $destination),
);
$form['refcode'][$usr->uid] = array(
'#value' => $usr->uid,
);
}
$form['users'] = array(
'#type' => 'checkboxes',
'#options' => $users,
);
$form['pager'] = array(
'#value' => theme('pager', NULL, 50, 0),
);
$form['#method'] = 'post';
$form['#action'] = url('admin/user/advuser/action');
return $form;
}