public function __construct( $wpdb, $config )
{
$this->namespace = 'glm/v1/';
- $this->resource_name = 'poi';
+ $this->resource_name = 'pointsofinterest';
// Setup wpdb and config
$this->wpdb = $wpdb;
// 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 );
},
)
)
add_action(
'rest_api_init',
function(){
+
$controller = new GLMA_POI_Rest_Controller( $this->wpdb, $this->config );
$controller->register_routes();
}