public function findnearAction() { if ($value_id = $this->getRequest()->getParam('value_id')) { $comment = new Comment_Model_Comment(); $comments = $comment->findAllWithLocation($value_id); $latitude = $this->getRequest()->getParam('latitude'); $longitude = $this->getRequest()->getParam('longitude'); $nearComments = array(); foreach ($comments as $comment) { $distance = $this->_getDistanceFromLatLonInKm($latitude, $longitude, $comment->getLatitude(), $comment->getLongitude()); $nearRadius = 100; if ($distance < $nearRadius) { $nearComments[] = $comment; } } $this->_genericFindAction($value_id, $nearComments); } }