You are here

function event_admin_timezone_settings in Event 5.2

Same name and namespace in other branches
  1. 5 event.module \event_admin_timezone_settings()

Displays and allows an administrator to change the timezone settings for this module.

Return value

the content for the timezone settings page.

Related topics

1 string reference to 'event_admin_timezone_settings'
event_menu in ./event.module
Implementation of hook_menu()

File

./event.module, line 189

Code

function event_admin_timezone_settings() {
  if (variable_get('configurable_timezones', 0)) {
    $form['event_timezone_input'] = array(
      '#type' => 'radios',
      '#title' => t('Event time zone input'),
      '#default_value' => variable_get('event_timezone_input', 'site'),
      '#options' => array(
        'site' => t('Use the sitewide time zone'),
        'user' => t('Use the time zone of the user editing or creating the event'),
        'input' => t('Allow users to set event time zones'),
      ),
      '#description' => t('Events are saved with a time zone value. This setting allows you to determine how the time zone is determined when creating or editing an event.'),
      '#required' => TRUE,
    );
    $form['event_timezone_display'] = array(
      '#type' => 'radios',
      '#title' => t('Event time zone display'),
      '#default_value' => variable_get('event_timezone_display', 'event'),
      '#options' => array(
        'event' => t("Use the event's time zone"),
        'user' => t("Use the user's time zone"),
        'site' => t('Use the sitewide time zone'),
      ),
      '#description' => t("Events are saved with a time zone value. This setting allows you to determine if the event's time zone, the sitewide time zone, or the user's personal time zone setting is used to display the time for an event."),
      '#required' => TRUE,
    );
  }
  else {
    if (variable_get('event_timezone_input', 'site') == 'user') {
      variable_set('event_timezone_input', 'site');
    }
    variable_set('event_timezone_display', 'event');
    $form['event_timezone_input'] = array(
      '#type' => 'radios',
      '#title' => t('Event time zone input'),
      '#default_value' => variable_get('event_timezone_input', 'site'),
      '#options' => array(
        'site' => t('Use the sitewide time zone'),
        'user' => t('Use the time zone of the user editing or creating the event'),
        'input' => t('Allow users to set event time zones'),
      ),
      '#description' => t("Events are saved with a time zone value. This setting allows you to determine how the time zone is determined when creating or editing an event. You must have 'Configurable time zones' enabled in the !url before you can enable user's time zones for this feature.", array(
        '!url' => l(t('date/time settings'), 'admin/settings/date-time'),
      )),
      '#required' => TRUE,
    );
    $form['event_timezone_display'] = array(
      '#type' => 'radios',
      '#title' => t('Event time zone display'),
      '#default_value' => variable_get('event_timezone_display', 'event'),
      '#options' => array(
        'event' => t("Use the event's time zone"),
        'site' => t('Use the sitewide time zone'),
      ),
      '#description' => t("Events are saved with a time zone value. This setting allows you to determine if the event's time zone, the sitewide time zone, or the user's personal time zone setting is used to display the time for an event. You must have 'Configurable time zones' enabled in the !url before you can enable user's time zones for this feature.", array(
        '!url' => l(t('date/time settings'), 'admin/settings/date-time'),
      )),
      '#required' => TRUE,
    );
  }
  $form['event_ampm'] = array(
    '#type' => 'radios',
    '#title' => t('Time notation preference'),
    '#default_value' => variable_get('event_ampm', '0'),
    '#options' => array(
      '0' => t('24h'),
      '1' => t('12h'),
    ),
    '#description' => t('The time notation system used for entering event times.'),
    '#required' => TRUE,
  );
  return system_settings_form($form);
}