| 1 |
<?php |
<?php |
| 2 |
// $Id: user_stats.admin.inc,v 1.1.2.1 2009/02/07 04:10:38 liammcdermott Exp $ |
// $Id: user_stats.admin.inc,v 1.1.2.2 2009/02/14 02:49:50 liammcdermott Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 113 |
'#default_value' => variable_get('user_stats_flush_ips_timer', 31536000), |
'#default_value' => variable_get('user_stats_flush_ips_timer', 31536000), |
| 114 |
); |
); |
| 115 |
|
|
| 116 |
|
$form['online_user_options'] = array( |
| 117 |
|
'#type' => 'fieldset', |
| 118 |
|
'#title' => t('Online users'), |
| 119 |
|
'#collapsible' => TRUE, |
| 120 |
|
'#collapsed' => FALSE, |
| 121 |
|
); |
| 122 |
|
|
| 123 |
|
// Following blatantly nicked from /modules/user/user.module and should be updated if that changes. |
| 124 |
|
$period = drupal_map_assoc(array(30, 60, 120, 180, 300, 600, 900, 1800, 2700, 3600, 5400, 7200, 10800, 21600, 43200, 86400), 'format_interval'); |
| 125 |
|
$form['online_user_options']['user_block_seconds_online'] = array('#type' => 'select', '#title' => t('User activity'), '#default_value' => variable_get('user_block_seconds_online', 900), '#options' => $period, '#description' => t('A user is considered online for this long after they have last viewed a page.')); |
| 126 |
|
|
| 127 |
$form['#submit'][] = 'user_stats_settings_change'; |
$form['#submit'][] = 'user_stats_settings_change'; |
| 128 |
|
|
| 129 |
return system_settings_form($form); |
return system_settings_form($form); |
| 132 |
/** |
/** |
| 133 |
* Settings change callback. |
* Settings change callback. |
| 134 |
* TODO: make this check a setting has been changed before resetting counts. |
* TODO: make this check a setting has been changed before resetting counts. |
|
* |
|
|
* Am sure some would say this should be in a hook_validate, but it doesn't |
|
|
* actually validate anything, so it's not. |
|
| 135 |
*/ |
*/ |
| 136 |
function user_stats_settings_change($form, &$form_state) { |
function user_stats_settings_change($form, &$form_state) { |
| 137 |
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : ''; |
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : ''; |