You are here

function userpoints_filter_form in User Points 7

Same name and namespace in other branches
  1. 7.2 userpoints.module \userpoints_filter_form()

Provides a dropdown to filter by category.

4 calls to userpoints_filter_form()
userpoints_admin_points in ./userpoints.admin.inc
Provides an administrative interface for managing points.
userpoints_admin_transactions in ./userpoints.admin.inc
Displays a list of transactions.
userpoints_list_transactions in ./userpoints.pages.inc
Displays a detailed transaction report for an individual user.
userpoints_list_users in ./userpoints.pages.inc
Lists the users and their point totals by all or by category.

File

./userpoints.module, line 1344

Code

function userpoints_filter_form($account = NULL, $values = array()) {
  $categories = userpoints_get_categories($account);
  $form = array();
  if (count($categories) > 1) {
    $categories = array(
      'all' => t('Display all'),
    ) + $categories;
    $form['tid'] = array(
      '#type' => 'select',
      '#title' => t('Filter by category'),
      '#options' => $categories,
      '#default_value' => isset($values['tid']) ? $values['tid'] : 'all',
      '#ajax' => array(
        'callback' => 'userpoints_filter_form_ajax_callback',
        'wrapper' => 'userpoints_list_wrapper',
      ),
    );
  }
  return $form;
}