function sms_user_settings_sleep_form in SMS Framework 6.2
Same name and namespace in other branches
- 5 modules/sms_user/sms_user.module \sms_user_settings_sleep_form()
- 6 modules/sms_user/sms_user.module \sms_user_settings_sleep_form()
- 7 modules/sms_user/sms_user.module \sms_user_settings_sleep_form()
1 string reference to 'sms_user_settings_sleep_form'
- sms_user_settings in modules/
sms_user/ sms_user.module - Menu callback; provides the forms for adding and confirming a user's mobile number.
File
- modules/
sms_user/ sms_user.module, line 277 - Provides integration between the SMS Framework and Drupal users.
Code
function sms_user_settings_sleep_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-hour 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 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;
}