You are here

function geoip_language_settings_overview in GeoIP API 7

Same name and namespace in other branches
  1. 6 geoip_language/geoip_language.admin.inc \geoip_language_settings_overview()

Create the overview table of the already existing mappgins

Parameters

array $languages:

Return value

string HTML Table

1 string reference to 'geoip_language_settings_overview'
geoip_language_menu in geoip_language/geoip_language.module
Implements hook_menu().

File

geoip_language/geoip_language.admin.inc, line 15
Admin page callbacks for the GeoIP Language module.

Code

function geoip_language_settings_overview() {
  if (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE) != GEOIP_LANGUAGE_NEGOTIATION_PATH) {
    drupal_set_message(t('The GeoIP settings will have no effect until <em>Language Negotiation</em> is set to <em>Path prefix with GeoIP detection fallback</em> on the <a href="@language-configure">Language configuration page</a>.', array(
      '@language-configure' => url('admin/settings/language/configure'),
    )), 'warning');
  }
  $countries = geoip_country_values();
  $languages = locale_language_list('name', TRUE);
  $mapping = geoip_language_mappings();
  $rows = array();
  foreach ($mapping as $country => $info) {
    $rows[] = array(
      $country,
      $countries[$country],
      $info->language,
      $languages[$info->language],
      l(t('Delete'), 'admin/settings/language/geoip/delete/' . $country, array(
        'query' => drupal_get_destination(),
      )),
    );
  }
  if (count($rows)) {
    $header = array(
      array(
        'data' => t('Country'),
        'colspan' => 2,
      ),
      array(
        'data' => t('Language'),
        'colspan' => 2,
      ),
      t('Operations'),
    );
    $output .= theme('table', $header, $rows);
  }
  else {
    drupal_set_message(t('No GeoIP language mappings defined.'));
  }
  $output .= drupal_get_form('geoip_language_settings_form');
  return $output;
}