function _autologout_settings in Automated Logout 6
Same name and namespace in other branches
- 5 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 342 - 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('Automated 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 Automated 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 Automated Logout'),
);
$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 automatically 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 auto-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,
);
if (module_exists("countdowntimer")) {
$form['autologout']['redirect_url'] = array(
'#type' => 'textfield',
'#title' => t('Redirect URL at logout'),
'#default_value' => _autologout_local_settings('redirect_url'),
'#size' => 40,
'#description' => t('If you want to redirect users to another page when they are logged out. (FULL http:// path)'),
);
$form['autologout']['logout_message'] = array(
'#type' => 'textfield',
'#title' => t('Display a message box at logout'),
'#default_value' => _autologout_local_settings('logout_message'),
'#size' => 40,
'#description' => t('If you want to display a message to the users when they are logged out.'),
);
}
else {
// disabled if countdowntimer is loaded
$form['autologout']['refresh_delta'] = array(
'#type' => 'textfield',
'#title' => t('Browser refresh delay'),
'#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."),
);
}
return system_settings_form($form);
}