User geolocation

The methods of this class can be used for storing and retrieving location of both authenticated and anonymous users.

Simple usage with GeoPlugin IP address geocoding works like the following:

 $_SERVER['REMOTE_ADDR']);
    $user_location = $geocoder->geocode($location_parameters);
    if (!is_null($user_location))
    {
        // Store geocoded location to session or user's location log
        org_routamc_positioning_user::set_location($user_location);
    }
}

if (!is_null($user_location))
{
    echo sprintf('You\'re in %s, %s', $user_location['latitude'], $user_location['longitude']);
    // Will print "You're in 60.2345, 25.00456"
}
?>
package org.routamc.positioning

 Methods

get_location ($when)

Static

Parameters

$when

get_location_for_person (\midcom_db_person $person, $when)

Static

Parameters

$person

$when

set_location (array $location)

Static

Parameters

$location

set_location_for_person (array $location, \midcom_db_person $person)

Static

Parameters

$location

$person