function sms_user_settings_sleep_form in SMS Framework 7
Same name and namespace in other branches
- 5 modules/sms_user/sms_user.module \sms_user_settings_sleep_form()
- 6.2 modules/sms_user/sms_user.module \sms_user_settings_sleep_form()
- 6 modules/sms_user/sms_user.module \sms_user_settings_sleep_form()
Form constructor for the user sleep settings form.
Parameters
object $account: The user account object.
See also
sms_user_settings_sleep_form_submit()
1 string reference to 'sms_user_settings_sleep_form'
- sms_user_settings in modules/
sms_user/ sms_user.module - Menu callback for user profile settings form.
File
- modules/
sms_user/ sms_user.module, line 462 - Provides integration between the SMS Framework and Drupal users.
Code
function sms_user_settings_sleep_form($form, &$form_state, $account) {
$form['uid'] = array(
'#type' => 'hidden',
'#value' => $account->uid,
);
$form['sleep'] = array(
'#type' => 'fieldset',
'#title' => t('Sleep Time'),
'#collapsible' => TRUE,
);
$form['sleep']['sleep_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Disable messages between these hours'),
'#description' => t('If enabled, you will not receive messages between the specified hours.'),
'#default_value' => isset($account->sms_user['sleep_enabled']) ? $account->sms_user['sleep_enabled'] : NULL,
);
// Determine whether to use the 24- or 12-hour clock based on site settings.
if (strpos(variable_get('date_format_short', 'm/d/Y - H:i'), 'g')) {
$format = 'g A';
}
else {
$format = 'H:00';
}
// Build the list of options based on date format.
$hour = 0;
while ($hour < 24) {
$options[$hour] = date($format, mktime($hour));
$hour++;
}
$form['sleep']['sleep_start_time'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#options' => $options,
'#default_value' => isset($account->sms_user['sleep_start_time']) ? $account->sms_user['sleep_start_time'] : NULL,
);
$form['sleep']['sleep_end_time'] = array(
'#type' => 'select',
'#multiple' => FALSE,
'#options' => $options,
'#default_value' => isset($account->sms_user['sleep_end_time']) ? $account->sms_user['sleep_end_time'] : NULL,
);
$form['sleep']['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}