Example #1
0
 /**
  * Prepare and render a map
  * @param array $params
  * @return string
  */
 public static function showMap($params = array())
 {
     $location = get_input('location', '');
     if (is_array($location)) {
         $find = elgg_extract('find', $location, false);
         $cached = elgg_extract('cached', $location, '');
         $location = $find ? $find : $cached;
     }
     $radius = get_input('radius', HYPEMAPS_SEARCH_RADIUS);
     $query = get_input('query', '');
     $limit = get_input('limit', 20);
     $offset = get_input('offset', 0);
     $getter = elgg_extract('getter', $params, 'elgg_get_entities');
     $defaults = array('full_view' => false, 'list_type' => 'mapbox', 'pagination' => true, 'limit' => $limit, 'offset' => $offset);
     $options = elgg_extract('options', $params);
     $options = array_merge($defaults, $options);
     $map = new ElggMap($options, $getter);
     $map->setSearchLocation($location, $radius);
     $map->setSearchQuery($query);
     return elgg_view('page/components/mapbox', array('list' => $map));
 }
Example #2
0
<?php

namespace hypeJunction\Places;

use hypeJunction\Maps\ElggMap;
echo ElggMap::showMap($vars);