Database Reference
In-Depth Information
#was distances provided
$distance = $app->request()->get('distance');
if (!empty($distance)) {
# use first location
$ul = $userlocations[0];
$productNodeId = $app->request()->get('productNodeId');
$lq = UserLocation::getLQ($ul,$distance);
$app->log->debug($lq);
if (!empty($productNodeId)) {
$locations = Location::locationsWithinDistanceWithProduct($lq,$ul,$productNodeId);
$app->view()->setData(array('locations' => $locations,
'mappedUserLocation'=>$userlocations));
}
else{
$locations = Location::locationsWithinDistance($lq, $ul,"business");
$app->view()->setData(array('locations' => $locations,
'mappedUserLocation'=>$userlocations));
}
}
else{
$app->view()->setData(array('mappedUserLocation'=>$userlocations));
}
$app->view()->setData(array('title'=>'Location'));
$app->render('graphs/location/index.mustache');
})->name('location');
Search for Nearby Locations
To search for nearby locations, as shown in Figure 8-16 , use the current user's location, obtained with
getUserLocation , and then use the locationsWithinDistance . The locationsWithinDistance method in Location
service class uses a method called distance to return a string value of the distance between the starting point and the
respective location (Listing 8-41).
 
Search WWH ::




Custom Search