Example #1
0
}
// query which groups have users (in order to prevent deletion of groups which have users)
global $usedgroups;
// We need this in a callback below
$usedgroups = $DB->get_col('SELECT grp_ID
                             FROM T_groups INNER JOIN T_users ON user_grp_ID = grp_ID
							 GROUP BY grp_ID');
$UserList = new UserList('admin', $UserSettings->get('results_per_page'), 'users_', array('join_city' => false));
$default_filters = array('order' => '/user_lastseen_ts/D');
$UserList->title = T_('Groups & Users') . get_manual_link('users_and_groups');
/*
 * Table icons:
 */
if ($current_User->check_perm('users', 'edit', false)) {
    // create new user/group link
    $UserList->global_icon(T_('Refresh users list...'), 'refresh', '?ctrl=users&filter=refresh', T_('Refresh') . ' »', 3, 4);
    $UserList->global_icon(T_('Create a new user...'), 'new', '?ctrl=user&action=new&user_tab=profile', T_('Add user') . ' »', 3, 4);
    $UserList->global_icon(T_('Create a new group...'), 'new', '?ctrl=groups&action=new', T_('Add group') . ' »', 3, 4);
}
$UserList->set_default_filters($default_filters);
$UserList->load_from_Request();
if ($UserList->filters['group'] != -1) {
    // List is grouped
    /*
     * Grouping params:
     */
    $UserList->group_by = 'grp_ID';
    /*
     * Group columns:
     */
    $UserList->grp_cols[] = array('td_class' => 'firstcol' . ($current_User->check_perm('users', 'edit', false) ? '' : ' lastcol'), 'td_colspan' => -1, 'td' => '<a href="?ctrl=groups&amp;grp_ID=$grp_ID$">$grp_name$</a>' . '~conditional( (#grp_ID# == ' . $Settings->get('newusers_grp_ID') . '), \' <span class="notes">(' . T_('default group for new users') . ')</span>\' )~');