You are here

function user_restrictions_ui_overview_form in User restrictions 7

Form builder for the list of user restrictions.

See also

user_restrictions_ui_check_email_validate()

user_restrictions_ui_check_email_submit()

user_restrictions_ui_check_username_submit()

1 string reference to 'user_restrictions_ui_overview_form'
user_restrictions_ui_menu in ./user_restrictions_ui.module
Implements hook_menu().

File

./user_restrictions_ui.admin.inc, line 146
Administration pages for the user restrictions module.

Code

function user_restrictions_ui_overview_form($form, &$form_state) {
  $destination = drupal_get_destination();
  $header = array(
    'status' => array(
      'data' => t('Access type'),
      'field' => 'status',
      'sort' => 'desc',
    ),
    'type' => array(
      'data' => t('Rule type'),
      'field' => 'type',
    ),
    'mask' => array(
      'data' => t('Mask'),
      'field' => 'mask',
    ),
    'expire' => array(
      'data' => t('Expire'),
      'field' => 'expire',
    ),
    'operations' => array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = UserRestrictions::getRestrictionTable($header, $destination);
  $form['rules'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('There are currently no user restrictions.'),
  );

  // Show the fieldset only if there are restriction rules.
  if (count($rows)) {
    $form['check_rules'] = array(
      '#type' => 'fieldset',
      '#title' => t('Check rules'),
      '#attributes' => array(
        'class' => array(
          'container-inline',
        ),
      ),
    );
    $form['check_rules']['value'] = array(
      '#type' => 'textfield',
      '#size' => 30,
      '#maxlength' => USERNAME_MAX_LENGTH,
    );
    $form['check_rules']['check_username'] = array(
      '#type' => 'submit',
      '#value' => t('Check username'),
      '#submit' => array(
        'user_restrictions_ui_check_username_submit',
      ),
    );
    $form['check_rules']['check_email'] = array(
      '#type' => 'submit',
      '#value' => t('Check e-mail'),
      '#submit' => array(
        'user_restrictions_ui_check_email_submit',
      ),
      '#validate' => array(
        'user_restrictions_ui_check_email_validate',
      ),
    );
  }
  $form['pager'] = array(
    '#markup' => theme('pager', array(
      'tags' => NULL,
    )),
  );
  return $form;
}