function api_getConstituencies_latitude($lat) { $lon = get_http_var('longitude') + 0; $d = get_http_var('distance') + 0; if (!$lat) { api_error('You must supply a latitude and longitude'); return; } $out = _api_getConstituencies_latitude($lat, $lon, $d); api_output($out); }
} $future_people = $MEMBER->future_mps(); if ($future_people) { $sidebars[] = array('type' => 'html', 'content' => '<div class="block"><h4>Succeeding Representatives in this constituency</h4><div class="blockbody"><ul>' . $future_people . '</ul></div></div>'); } } if ($MEMBER->house(1)) { $lat = null; $lon = null; $geometry = _api_getGeometry_name($MEMBER->constituency()); if (isset($geometry['centre_lat'])) { $lat = $geometry['centre_lat']; $lon = $geometry['centre_lon']; } if ($lat && $lon) { $nearby_consts = _api_getConstituencies_latitude($lat, $lon, 300); if ($nearby_consts) { $out = '<ul><!-- ' . $lat . ',' . $lon . ' -->'; for ($k = 1; $k <= min(5, count($nearby_consts) - 1); $k++) { $name = $nearby_consts[$k]['name']; $dist = $nearby_consts[$k]['distance']; $out .= '<li><a href="' . WEBPATH . 'mp/?c=' . urlencode($name) . '">'; $out .= $nearby_consts[$k]['name'] . '</a>'; $dist_miles = round($dist / 1.609344, 0); $out .= ' <small title="Centre to centre">(' . $dist_miles . ' miles)</small>'; $out .= '</li>'; } $out .= '</ul>'; $sidebars[] = array('type' => 'html', 'content' => '<div class="block"><h4>Nearby constituencies</h4><div class="blockbody">' . $out . ' </div></div>'); } }
function api_getConstituencies_latitude($lat) { api_error('Currently disabled, sorry; please get in touch if you need this function.'); return; $lon = get_http_var('longitude') + 0; $d = get_http_var('distance') + 0; if (!$lat) { api_error('You must supply a latitude and longitude'); return; } $out = _api_getConstituencies_latitude($lat, $lon, $d); api_output($out); }