You are here

function _weather_get_config in Weather 5

Same name and namespace in other branches
  1. 5.6 weather.module \_weather_get_config()
  2. 6.5 weather.module \_weather_get_config()

Return the configuration for the given user id.

If there is no configuration yet, get the default configuration instead. The user is 0 is used for the system weather block.

2 calls to _weather_get_config()
weather_block in ./weather.module
Generate HTML for the weather block
weather_custom_block in ./weather.module
Show a configuration page for a custom weather block

File

./weather.module, line 577
Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world

Code

function _weather_get_config($uid, $cid) {
  $sql = "SELECT * FROM {weather_config} WHERE uid=%d AND cid=%d";
  $result = db_query($sql, $uid, $cid);
  if (db_num_rows($result) != 1) {

    // there was no configuration found. Provide it here.
    $config['icao'] = 'EDDH';
    $config['real_name'] = 'Hamburg-Fuhlsbuettel';
    $config['units'] = 'metric';
  }
  else {

    // get the user's configuration
    $config = db_fetch_array($result);
  }
  return $config;
}