function weather_es_main in Weather_es 6
Same name and namespace in other branches
- 5 weather_es.module \weather_es_main()
- 6.3 weather_es.module \weather_es_main()
- 6.2 weather_es.module \weather_es_main()
Main weather_es_page
1 string reference to 'weather_es_main'
- weather_es_menu in ./
weather_es.module - Implementation of hook_menu().
File
- ./
weather_es.module, line 124 - Non-displayable characters.
Code
function weather_es_main($wuid) {
// Table header
$header = array(
array(
'data' => t('City'),
'field' => 'city',
),
array(
'data' => t('Operation'),
),
);
$path = _weather_es_redirect($wuid);
$rows = array();
$sql = "SELECT * FROM {weather_es_config} wec WHERE wec.uid = %d";
$result = db_query(db_rewrite_sql($sql), $wuid);
while ($row = db_fetch_array($result)) {
// delete the '/' caracter from the city name (Spanish/one_of_the_other_3_official_languages) and replace it with '-'
$pos = strpos($row['cit_nam'], '/');
if ($pos != 0) {
$row['cit_nam'] = str_replace('/', '-', $row['cit_nam']);
}
$rows[] = array(
'cit_nam' => $row['cit_nam'],
l(t('delete'), $path . '/delete/' . $row['cod_pro'] . $row['cod_loc'] . '/' . $row['cit_nam']),
);
}
if (count($rows) == 0) {
$rows[] = array(
array(
'data' => '<em>' . t('There are currently no locations.') . '</em>',
'colspan' => 4,
),
);
}
$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;
}