You are here

function weather_es_main in Weather_es 6.3

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

Main weather_es_page. Show the cities you want to know the weather if there're selected...

@author jmsirvent

1 string reference to 'weather_es_main'
weather_es_menu in ./weather_es.module
hook_menu

File

./weather_es.module, line 115

Code

function weather_es_main($wid) {
  $path = _weather_es_redirect($wid);

  // Table header
  $header = array(
    array(
      'data' => t('City'),
      'field' => 'cit_nam',
    ),
    array(
      'data' => t('Languaje'),
    ),
    array(
      'data' => t('Operation'),
    ),
  );
  $sql = "SELECT wed.cit_nam, wed.cit_cod, wec.lan FROM {weather_es_data} wed INNER JOIN {weather_es_conf} wec ON (wec.cit_cod = wed.cit_cod) WHERE wec.wid = %d" . tablesort_sql($header);
  $result = db_query($sql, $wid);
  while ($row = db_fetch_array($result)) {
    $rows[] = array(
      'cit_nam' => $row['cit_nam'],
      'lan' => $row['lan'],
      l(t('delete'), $path . '/delete/' . $row['cit_cod'] . '/' . $row['cit_nam']),
    );
  }

  //if (count($rows) == 0) {
  if (!$rows) {
    $rows[] = array(
      array(
        'data' => '<em>' . t('There are currently no locations.') . '</em>',
        'colspan' => 3,
      ),
    );
  }
  $output = theme('table', $header, $rows);

  // Create a new location
  $output .= '<p>' . l(t('Create a new configuration or add a new location to an exisiting configuration.'), $path . '/edit') . '</p>';
  return $output;
}