From: Anthony Talarico Date: Thu, 1 Aug 2019 14:13:22 +0000 (-0400) Subject: adding point of interest route to get the boundaries of the user from the mobile app X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=8afa3134e9dfbfec1a5c5047e1b4b7430d5ecc83;p=WP-Plugins%2Fglm-member-db-rest-api.git adding point of interest route to get the boundaries of the user from the mobile app --- diff --git a/setup/routes/pointsOfInterest.php b/setup/routes/pointsOfInterest.php index 950b1d4..417f6d0 100644 --- a/setup/routes/pointsOfInterest.php +++ b/setup/routes/pointsOfInterest.php @@ -35,7 +35,7 @@ class GLMA_POI_Rest_Controller public function __construct( $wpdb, $config ) { $this->namespace = 'glm/v1/'; - $this->resource_name = 'poi'; + $this->resource_name = 'pointsofinterest'; // Setup wpdb and config $this->wpdb = $wpdb; @@ -62,9 +62,61 @@ class GLMA_POI_Rest_Controller // Callback function can be a lot shorter. // You could just create a new model to get the results in an array // and use return rest_ensure_response( $data ); - + // Check if there's new area at the top of the map + // if ($latMax > $lastLatMax) { + // $poiAreas[] = array( + // 'area' => 'New at top', + // 'latMax' => $latMax, + // 'latMin' => $lastLatMax, + // 'lonMax' => $lonMax, + // 'lonMin' => $lonMin + // ); + // } - return rest_ensure_response( $request ); + // // Check if there's new area at the bottom of the map + // if ($latMin < $lastLatMin) { + // $poiAreas[] = array( + // 'area' => 'New at bottom', + // 'latMax' => $lastLatMin, + // 'latMin' => $latMin, + // 'lonMax' => $lonMax, + // 'lonMin' => $lonMin + // ); + // } + + // // Check if there's new area at the left of the map + // if ($lonMin < $lastLonMin) { + // $poiAreas[] = array( + // 'area' => 'New at left', + // 'latMax' => $latMax, + // 'latMin' => $latMin, + // 'lonMax' => $lastLonMin, + // 'lonMin' => $lonMin + // ); + // } + + // // Check if there's new area at the right of the map + // if ($lonMax > $lastLonMax) { + // $poiAreas[] = array( + // 'area' => 'New at right', + // 'latMax' => $latMax, + // 'latMin' => $latMin, + // 'lonMax' => $lonMax, + // 'lonMin' => $lastLonMax + // ); + // } + // $poiData = apply_filters( + // 'glm-hook-list-map-items-by-latlon', + // array( + // 'request' => $request, + // 'filter' => $searchText, + // 'area' => $poiAreas, + // 'sources' => array(), + // 'mapItems' => array() + // ) + // ); + $test = json_encode($request['latMax']); + return rest_ensure_response( $test ); }, ) ) @@ -111,6 +163,7 @@ class GLMA_POI_Rest_Controller add_action( 'rest_api_init', function(){ + $controller = new GLMA_POI_Rest_Controller( $this->wpdb, $this->config ); $controller->register_routes(); }