You are here

public function weather_es_citPro::__construct in Weather_es 7

Same name and namespace in other branches
  1. 6.3 weather_es.inc \weather_es_citPro::__construct()

File

./weather_es.inc, line 155
Classes to get the weather information from AEMET

Class

weather_es_citPro
Class that gets the cities of a province

Code

public function __construct($province_code) {

  // Can't use DOM because AEMET's files aren't valid XHTML files...
  $this->xprovince_code = $province_code;
  $this->xerror_message = '';
  if ($province_code == '---') {
    $this->xcities = array(
      '00' => t('Any city'),
    );
  }
  else {
    if (function_exists('fsockopen')) {
      $this
        ->cities(drupal_http_request(self::$url . $this->xprovince_code));
    }
    else {
      $this->xerror_message = t('Function fsockopen does not exist, you can\'t use this module...');
    }
  }
}