You are here

function datex_block_view in Datex 7.3

Implements hook_block_view().

File

./datex.module, line 153
Datex main module file, Datex adds php-intl support to drupal.

Code

function datex_block_view($delta = '') {
  $bc = variable_get('datex_block_count', 1);
  $b = variable_get('datex_block', []);
  for ($i = 0; $i < $bc; $i++) {
    if ($delta === "datex_block_{$i}") {
      $cfg = _datex_block_cfg($i);
      switch ($cfg['tz']) {
        case 'site':
          $tz = variable_get('date_default_timezone', @date_default_timezone_get());
          break;
        case 'user':
          $tz = drupal_get_user_timezone();
          break;
        default:
          $tz = $cfg['tz'];
      }
      $calendar = datex_factory($tz, $cfg['cal'], NULL);
      $content = str_replace('{}', $calendar
        ->format($cfg['fmt']), $cfg['text']);
      $block['subject'] = t('Date');
      $block['content'] = $content;
      return $block;
    }
  }
}