private function geolocation($latitude, $longitude, $geoLocation, $translator)
{
$preferencesService = $this->container->get('system_preferences_service');
if ($latitude > 90 || $latitude < -90 || $longitude > 180 || $longitude < -180) {
$this->get('session')->getFlashBag()->add('error', $translator->trans('newscoop.preferences.error.geolocation', array(), 'system_pref'));
return $this->redirect($this->generateUrl('newscoop_newscoop_systempref_index'));
} else {
$preferencesService->MapCenterLatitudeDefault = $latitude;
$preferencesService->MapCenterLongitudeDefault = $longitude;
}
foreach ($geoLocation as $key => $value) {
$name = '';
foreach (explode('_', $key) as $part) {
$name .= ucfirst($part);
$preferencesService->{$name} = $value;
}
}
}