function api_getGeometry_name($name) { $out = _api_getGeometry_name($name); if ($out) { api_output($out); } else { api_error('Name not recognised'); } }
} */ if ($MEMBER->house(1)) { $previous_people = $MEMBER->previous_mps(); if ($previous_people) { $sidebars[] = array('type' => 'html', 'content' => '<div class="block"><h4>Previous Representatives in this constituency</h4><div class="blockbody"><ul>' . $previous_people . '</ul></div></div>'); } $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>';