You are here

function _autologout_settings in Automated Logout 5

Same name and namespace in other branches
  1. 6 autologout.module \_autologout_settings()

Implementation of hook_settings

1 string reference to '_autologout_settings'
autologout_menu in ./autologout.module
Implementation of hook_menu

File

./autologout.module, line 319
Used to automagically log out a user after a preset time, AjK May 2006

Code

function _autologout_settings() {
  _autologout_debug("autologout_settings()");
  if (!user_access('administer autologout')) {
    drupal_access_denied();
    return;
  }
  $form = array();
  $form['autologout'] = array(
    '#type' => 'fieldset',
    '#title' => t('auto logout settings'),
    '#tree' => TRUE,
  );
  $form['autologout']['markup1'] = array(
    '#type' => 'markup',
    '#value' => theme('autologout_generic', 1),
  );
  $form['autologout']['enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable module'),
    '#default_value' => _autologout_local_settings('enabled'),
    '#description' => t('Uncheck this and save settings to disable auto logout'),
  );
  $form['autologout']['timeout'] = array(
    '#type' => 'textfield',
    '#title' => t('Timeout value in seconds'),
    '#default_value' => _autologout_local_settings('timeout'),
    '#size' => 10,
    '#maxlength' => 12,
    '#description' => t('The length of inactivity time, in seconds, before auto logout'),
  );
  $form['autologout']['refresh_delta'] = array(
    '#type' => 'textfield',
    '#title' => t('Browser refresh delta'),
    '#default_value' => _autologout_local_settings('refresh_delta'),
    '#size' => 10,
    '#maxlength' => 12,
    '#description' => t("The length of time, in seconds, after a timeout that a browser refresh is forced. Setting this to 0 (zero) disables the browser refresh facility. Using this facility will force a browser refresh and expire the session thus sending the user's browser to the homepage, in a logged out state."),
  );
  $form['autologout']['use_watchdog'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable watchdog Automated Logout logging'),
    '#default_value' => _autologout_local_settings('use_watchdog'),
    '#description' => t('Enable logging of all logged out users'),
  );
  $form['autologout']['block_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Block title'),
    '#default_value' => _autologout_local_settings('block_title'),
    '#size' => 40,
    '#description' => t('The title of the block'),
  );
  $form['autologout']['markup2'] = array(
    '#type' => 'markup',
    '#value' => theme('autologout_generic', 0),
  );
  foreach (user_roles(TRUE) as $role) {
    $form['autologout'][$role] = array(
      '#type' => 'select',
      '#title' => $role,
      '#options' => array(
        '0' => t('Enforce'),
        '1' => t('Exclude'),
        '2' => t('By user'),
      ),
      '#default_value' => _autologout_local_settings($role),
    );
  }
  $markup3_items = array(
    t('Enforce : all users in this role will be auto-logged out'),
    t('Exclude : all users in this role are excluded from Automated Logout functionality'),
    t('By user : all users in this role can select to switch off this functionality'),
  );
  $markup3 = theme('item_list', $markup3_items, t('Policy description')) . t('Please note, if a user is found to be in a role that allows disabling this feature, this overrides any enforcement');
  $form['autologout']['markup3'] = array(
    '#type' => 'markup',
    '#value' => $markup3,
  );
  return system_settings_form($form);
}