You are here

function theme_scheduler_timecheck in Scheduler 7

Same name and namespace in other branches
  1. 5 scheduler.module \theme_scheduler_timecheck()
  2. 6 scheduler.module \theme_scheduler_timecheck()

Returns HTML the timecheck administration page.

Parameters

array $variables: An associative array containing:

  • 'now': A UNIX timestamp to format.
1 theme call to theme_scheduler_timecheck()
_scheduler_timecheck in ./scheduler.admin.inc
Page callback: Generate the timecheck admin page.

File

./scheduler.admin.inc, line 488
Administration forms for the Scheduler module.

Code

function theme_scheduler_timecheck(array $variables) {
  global $user;
  $now = $variables['now'];
  $date_default_timezone = variable_get('date_default_timezone', date_default_timezone_get());
  $t_options = array(
    // For @utc specify 'GMT' as the timezone (4th parameter) so that no
    // timezone offset is returned.
    '@utc' => format_date($now, 'custom', 'jS F Y, H:i:s P', 'GMT'),
    // For @localtime do not specify any timezone parameter so that the user or
    // site default setting is returned.
    '@localtime' => format_date($now, 'custom', 'jS F Y, H:i:s P T e'),
    '@daylight_saving' => format_date($now, 'custom', 'I') ? t('currently in daylight saving mode') : t('not in daylight saving mode'),
    '@user_account' => url('user/' . $user->uid . '/edit'),
    '@date_default_timezone' => check_plain($date_default_timezone),
    '@date_default_offset' => format_date($now, 'custom', 'P', $date_default_timezone),
    '@date_default_code' => format_date($now, 'custom', 'T', $date_default_timezone),
    '@admin_regional_settings' => url('admin/config/regional/settings'),
  );
  $output = '<h4>' . t('Time check') . '</h4><p>' . t('Your server\'s time is @utc. In most cases this should match <a href="https://www.google.com/search?q=Greenwich%20Mean%20Time">Greenwich Mean Time (GMT) / Coordinated Universal Time (UTC)</a>', $t_options) . '</p><p>' . t('The website default timezone is @date_default_timezone (@date_default_code) which is offset from GMT by @date_default_offset hours. This timezone can be <a href="@admin_regional_settings">changed by admin users</a> with the appropriate access.', $t_options) . '</p>';
  if (variable_get('configurable_timezones', 1)) {
    $output .= '<p>' . t('Your local time is @localtime (@daylight_saving). You can change this via your <a href="@user_account">user account</a>.', $t_options) . '</p>';
    if (empty($user->timezone)) {
      $output .= '<p>' . t('Note: The user timezone has not been stored, so defaulting to the website timezone.') . '</p>';
    }
  }
  else {
    $output .= '<p>' . t('Your local time is @localtime (@daylight_saving). This is not configurable by you.', $t_options) . '</p>';
  }
  return $output;
}