本文整理汇总了PHP中UserList::set_default_filters方法的典型用法代码示例。如果您正苦于以下问题:PHP UserList::set_default_filters方法的具体用法?PHP UserList::set_default_filters怎么用?PHP UserList::set_default_filters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserList
的用法示例。
在下文中一共展示了UserList::set_default_filters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserList
$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&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>\' )~');
function grp_actions(&$row)
{
global $usedgroups, $Settings, $current_User;
$r = '';
示例2: users_results_block
/**
* Display the users results table
*
* @param array Params
*/
function users_results_block($params = array())
{
// Make sure we are not missing any param:
$params = array_merge(array('org_ID' => NULL, 'filterset_name' => 'admin', 'results_param_prefix' => 'users_', 'results_title' => T_('Users') . get_manual_link('users_and_groups'), 'results_no_text' => T_('No users'), 'results_order' => '/user_lastseen_ts/D', 'page_url' => get_dispctrl_url('users'), 'join_group' => true, 'join_city' => false, 'join_country' => true, 'keywords_fields' => NULL, 'where_status_closed' => NULL, 'display_params' => array(), 'display_orgstatus' => false, 'display_filters' => true, 'display_btn_refresh' => true, 'display_btn_adduser' => true, 'display_btn_addgroup' => true, 'display_ID' => true, 'display_avatar' => true, 'display_login' => true, 'display_nickname' => true, 'display_name' => true, 'display_gender' => true, 'display_country' => true, 'display_city' => false, 'display_blogs' => true, 'display_source' => true, 'display_regdate' => true, 'display_regcountry' => true, 'display_update' => true, 'display_lastvisit' => true, 'display_contact' => true, 'display_reported' => true, 'display_group' => true, 'display_level' => true, 'display_status' => true, 'display_actions' => true, 'display_newsletter' => true, 'force_check_user' => false), $params);
global $current_User;
if (!$params['force_check_user']) {
if (!is_logged_in()) {
// Only logged in users can access to this function
return;
}
if (!$current_User->check_perm('users', 'view')) {
// Check minimum permission:
return;
}
}
global $DB, $UserSettings, $Settings, $action, $admin_url;
// 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');
// Create result set:
load_class('users/model/_userlist.class.php', 'UserList');
$UserList = new UserList($params['filterset_name'], $UserSettings->get('results_per_page'), $params['results_param_prefix'], array('join_group' => $params['join_group'], 'join_city' => $params['join_city'], 'join_country' => $params['join_country'], 'keywords_fields' => $params['keywords_fields'], 'where_status_closed' => $params['where_status_closed'], 'where_org_ID' => $params['org_ID']));
$default_filters = array('order' => $params['results_order'], 'org' => $params['org_ID']);
$UserList->title = $params['results_title'];
$UserList->no_results_text = $params['results_no_text'];
$UserList->set_default_filters($default_filters);
$UserList->load_from_Request();
// Initialize Results object
users_results($UserList, $params);
if ($action == 'show_recent') {
// Sort an users list by "Registered" field
$UserList->set_order('user_created_datetime');
}
// Execute query
$UserList->query();
if ($params['display_filters']) {
// Display the filters
$filter_presets = array('all' => array(T_('All users'), url_add_param($params['page_url'], 'filter=new')), 'men' => array(T_('Men'), url_add_param($params['page_url'], 'gender_men=1&filter=new')), 'women' => array(T_('Women'), url_add_param($params['page_url'], 'gender_women=1&filter=new')));
if (is_admin_page()) {
// Add show only activated users filter only on admin interface
$filter_presets['activated'] = array(T_('Activated users'), url_add_param($params['page_url'], 'status_activated=1&filter=new'));
if (is_logged_in() && $current_User->check_perm('users', 'edit')) {
// Show "Reported Users" filter only for users with edit user permission
$filter_presets['reported'] = array(T_('Reported users'), url_add_param($params['page_url'], 'reported=1&filter=new'));
}
}
if ($UserList->is_filtered()) {
// Display link to reset filters only if some filter is applied
$UserList->global_icon(T_('Reset filters'), 'reset_filters', url_add_param($params['page_url'], 'filter=reset'), T_('Reset filters'), 3, 4, array('class' => 'action_icon btn-warning'));
}
$UserList->filter_area = array('callback' => 'callback_filter_userlist', 'url_ignore' => 'users_paged,u_paged,keywords', 'presets' => $filter_presets);
}
/*
* Table icons:
*/
if ($params['display_btn_refresh']) {
// Display a button to refresh the users list
$UserList->global_icon(T_('Refresh users list...'), 'refresh', url_add_param($params['page_url'], 'filter=refresh'), T_('Refresh'), 3, 4, array('class' => 'action_icon btn-warning'));
}
if (is_logged_in() && $current_User->check_perm('users', 'edit', false)) {
if ($params['display_btn_adduser']) {
// Display a button to add user
$UserList->global_icon(T_('Create a new user...'), 'new', $admin_url . '?ctrl=user&action=new&user_tab=profile', T_('Add user') . ' »', 3, 4, array('class' => 'action_icon btn-primary'));
}
if ($params['display_btn_adduser']) {
// Display a button to add group
$UserList->global_icon(T_('Create a new group...'), 'new', $admin_url . '?ctrl=groups&action=new', T_('Add group') . ' »', 3, 4);
}
}
// Display result :
$UserList->display($params['display_params']);
if ($params['display_newsletter'] && is_logged_in() && $current_User->check_perm('emails', 'edit') && $UserList->result_num_rows > 0) {
// Newsletter button
global $admin_url;
echo '<p class="center">';
echo '<input type="button" value="' . T_('Send newsletter to the current selection') . '" onclick="location.href=\'' . $admin_url . '?ctrl=campaigns&action=users&' . url_crumb('campaign') . '\'" class="btn btn-default" />';
echo '</p>';
}
}