You are here

function weather_admin_places in Weather 7.3

Same name and namespace in other branches
  1. 7.2 weather.forms.inc \weather_admin_places()

Show an overview of all modified places.

1 string reference to 'weather_admin_places'
weather_menu in ./weather.module
Implements hook_menu().

File

./weather.forms.inc, line 118
Provide forms for configuration of weather displays.

Code

function weather_admin_places() {
  $output = '';

  // Create form for adding places.
  $form = drupal_get_form('weather_admin_places_form');
  $output .= drupal_render($form);

  // Create tables for modified places.
  $tables = array(
    'added' => t('Added places'),
    'modified' => t('Modified places'),
  );
  foreach ($tables as $status => $caption) {
    $header = array(
      t('GeoID'),
      t('Latitude'),
      t('Longitude'),
      t('Country'),
      t('Name'),
      t('Link'),
    );
    $rows = array();
    $result = db_query('SELECT * FROM {weather_places}
      WHERE status = :status ORDER BY country ASC, name ASC', array(
      ':status' => $status,
    ));
    foreach ($result as $place) {
      $rows[] = array(
        $place->geoid,
        $place->latitude,
        $place->longitude,
        $place->country,
        $place->name,
        $place->link,
      );
    }
    $output .= theme('table', array(
      'header' => $header,
      'rows' => $rows,
      'caption' => $caption,
      'empty' => t('No places.'),
    ));
  }
  return $output;
}