/** * Map element * @since 2.6.1 * @access public */ public function map() { //if item has no location, abort! if (empty($this->item_info)) { return !empty($this->args['no_location_message']) ? $this->no_location_message() : false; } //map arguments $gmw = array('ID' => $this->args['element_id'], 'prefix' => 'sl', 'addon' => 'single_location', 'results_map' => array('map_width' => $this->args['map_width'], 'map_height' => $this->args['map_height']), 'args' => $this->args, 'user_position' => $this->user_position, 'item_info' => $this->item_info, 'expand_map_on_load' => $this->args['expand_map_on_load']); //get the map element $output = gmw_get_results_map($gmw); $post_map_icon = !empty($this->args['item_map_icon']) ? $this->args['item_map_icon'] : false; $mapArgs = array('mapId' => $this->args['element_id'], 'mapType' => 'single_location', 'prefix' => 'sl', 'mapElement' => 'gmw-map-' . $this->args['element_id'], 'locations' => array(0 => array('lat' => $this->item_info->lat, 'long' => $this->item_info->long, 'info_window_content' => $this->info_window_content(), 'mapIcon' => apply_filters('gmw_sl_post_map_icon', $post_map_icon, $this->args, $this->item_info, $this->user_position))), 'zoomLevel' => !empty($this->user_position['exists']) ? 'auto' : $this->args['zoom_level'], 'mapOptions' => array('mapTypeId' => $this->args['map_type'], 'mapTypeControl' => false, 'streetViewControl' => false, 'scrollwheel' => !empty($this->args['scrollwheel_map_zoom']) ? true : false, 'panControl' => false), 'userPosition' => array('lat' => $this->user_position['lat'], 'lng' => $this->user_position['lng'], 'address' => $this->user_position['address'], 'mapIcon' => $this->args['user_map_icon'], 'iwContent' => $this->args['user_info_window'])); gmw_new_map_element($mapArgs); return $output; }
/** * @since 2.6.1 * @access public * * Create map element */ public function map() { if (!$this->user_position['exists']) { return; } //map arguments $gmw = array('ID' => $this->args['element_id'], 'prefix' => 'cl', 'addon' => 'current_location', 'results_map' => array('map_width' => $this->args['map_width'], 'map_height' => $this->args['map_height']), 'args' => $this->args, 'user_position' => $this->user_position); //get the map element $output = gmw_get_results_map($gmw); //map options - pass to via global map object to JavaScript which will display the map $mapArgs = array('mapId' => $this->args['element_id'], 'mapType' => 'current_location', 'prefix' => 'cl', 'zoomLevel' => $this->args['zoom_level'], 'mapOptions' => array('mapTypeId' => $this->args['map_type'], 'scrollwheel' => !empty($this->args['scrollwheel_map_zoom']) ? true : false, 'mapTypeControl' => false, 'streetViewControl' => false, 'panControl' => false), 'userPosition' => array('lat' => $this->user_position['lat'], 'lng' => $this->user_position['lng'], 'address' => $this->user_position['address'], 'mapIcon' => $this->args['map_marker'])); gmw_new_map_element($mapArgs); return $output; }
/** * trigger the map scripts */ public function map_element() { if (!apply_filters('gmw_trigger_map', true)) { return; } $mapArgs = array('mapId' => $this->form['ID'], 'mapType' => $this->form['addon'], 'prefix' => $this->form['prefix'], 'form' => $this->form, 'locations' => $this->form['results'], 'infoWindowType' => !empty($this->form['info_window']['iw_type']) ? $this->form['info_window']['iw_type'] : 'normal', 'zoomLevel' => $this->form['results_map']['zoom_level'], 'mapOptions' => array('mapTypeId' => $this->form['results_map']['map_type']), 'userPosition' => array('lat' => $this->form['your_lat'], 'lng' => $this->form['your_lng'], 'address' => $this->form['org_address'], 'mapIcon' => $this->form['ul_icon'], 'iwContent' => $this->form['labels']['info_window']['your_location'], 'iwOpen' => !empty($this->form['results_map']['yl_icon']) ? true : false), 'markersDisplay' => !empty($this->form['results_map']['markers_display']) ? $this->form['results_map']['markers_display'] : false, 'draggableWindow' => isset($this->form['info_window']['draggable_use']) ? true : false); $mapArgs = apply_filters("gmw_form_map_element_args", $mapArgs, $this->form); $mapArgs = apply_filters("gmw_form_map_element_args_{$this->form['ID']}", $mapArgs, $this->form); $mapArgs = apply_filters("gmw_{$this->form['prefix']}_form_map_element_args", $mapArgs, $this->form); do_action("gmw_form_map_element", $this->form, $mapArgs); gmw_new_map_element($mapArgs); }
/** * Trigger javascript to display maps and markers */ public function trigger_js_and_map() { //create the map object $mapArgs = array('mapId' => 'sd', 'mapType' => 'sweetdate_geolocation', 'prefix' => 'sd', 'triggerMap' => false, 'locations' => $this->formData['members'], 'zoomLevel' => 'auto', 'mapTypeId' => !empty($this->settings['map_type']) ? $this->settings['map_type'] : 'ROADMAP', 'userPosition' => array('lat' => $this->formData['your_lat'], 'lng' => $this->formData['your_lng'], 'address' => $this->formData['address'], 'mapIcon' => 'https://maps.google.com/mapfiles/ms/icons/blue-dot.png', 'iwContent' => 'You are here', 'iwOpen' => true), 'markersDisplay' => 'markers_clusterer'); $map_element = gmw_new_map_element($mapArgs, true); ?> <script> //pass some values to javascript jQuery(window).ready(function($) { //pass the map object to JS values = <?php print json_encode($map_element); ?> ; jQuery('#gmw-map-wrapper-sd').slideToggle(function() { //display the map gmwMapInit( values ); }); }); </script> <?php }