function weather_admin_main_page in Weather 6.5
Same name and namespace in other branches
- 7.3 weather.forms.inc \weather_admin_main_page()
- 7 weather.forms.inc \weather_admin_main_page()
- 7.2 weather.forms.inc \weather_admin_main_page()
Show an overview of configured locations and the default location
1 string reference to 'weather_admin_main_page'
- weather_menu in ./
weather.module - Implementation of hook_menu().
File
- ./
weather.module, line 605 - Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world
Code
function weather_admin_main_page() {
$output = '';
$blocks = _weather_get_blocks_in_use();
$path = 'admin/settings/weather/';
if (!empty($blocks)) {
foreach ($blocks as $block_id) {
$header = array(
t('System-wide block !number', array(
'!number' => $block_id,
)),
t('Weight'),
array(
'data' => t('Operations'),
'colspan' => 2,
),
);
$rows = array();
$sql = "SELECT * FROM {weather_config}\n WHERE uid=%d ORDER BY weight ASC, real_name ASC";
$result = db_query($sql, -$block_id);
while ($row = db_fetch_array($result)) {
$rows[] = array(
$row['real_name'],
$row['weight'],
l(t('edit'), $path . 'edit/' . -$block_id . '/' . $row['cid']),
l(t('delete'), $path . 'delete/' . -$block_id . '/' . $row['cid']),
);
}
$output .= theme('table', $header, $rows);
if (isset($form['pager']['#value'])) {
$output .= drupal_render($form['pager']);
}
$free_cid = _weather_get_free_config(-$block_id);
$output .= '<p>' . l(t('Create new location in block !number', array(
'!number' => $block_id,
)), $path . 'edit/' . -$block_id . '/' . $free_cid) . '</p>';
}
}
// Allow creation of another system-wide block
$free_block_id = _weather_get_free_block_id();
$output .= '<p>' . l(t('Create new system-wide block'), $path . 'edit/' . $free_block_id . '/1') . '</p>';
// Add the default location
$output .= '<p>' . l(t('Configure the default location'), $path . 'default') . '</p>';
$output .= drupal_get_form('weather_main_page_form');
return $output;
}