You are here

function weather_es_block in Weather_es 6.2

Same name and namespace in other branches
  1. 5 weather_es.module \weather_es_block()
  2. 6.3 weather_es.module \weather_es_block()
  3. 6 weather_es.module \weather_es_block()

Implementation of hook_block().

File

./weather_es.module, line 377
Shows weather data of Spain (by AEMET)

Code

function weather_es_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $blocks[0]['info'] = t('Weather_es: system-wide');
      $blocks[1]['info'] = t('Weather_es: custom user');
      return $blocks;
    case 'configure':
      return $form;
    case 'view':
    default:
      drupal_add_js(drupal_get_path('module', 'weather_es') . '/js/weather_es.js');
      if ($delta == 0 and user_access('access content')) {

        // Show the system weather_es block
        $title = t('System weather');
        $content = weather_es_first_load(0);
      }
      else {
        if ($delta == 1 and user_access('administer custom weather_es block')) {

          // Show the user weather_es block
          $title = t('User weather');
          $content = weather_es_first_load(1);
        }
      }
      $block['subject'] = $title;
      $block['content'] = $content;
      return $block;
  }
}