function theme_getlocations_mapquest_map in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_mapquest/getlocations_mapquest.module \theme_getlocations_mapquest_map()
Function
Return value
Returns
4 theme calls to theme_getlocations_mapquest_map()
- getlocations_mapquest_entity_type_map in modules/
getlocations_mapquest/ getlocations_mapquest.module - Function
- getlocations_mapquest_field_formatter_view in modules/
getlocations_mapquest/ getlocations_mapquest.module - Implements hook_field_formatter_view(). Build a renderable array for a field value.
- template_preprocess_getlocations_mapquest_view_map in modules/
getlocations_mapquest/ views/ getlocations_mapquest.views.inc - Preprocess function for getlocations_mapquest_view_map.tpl
- theme_getlocations_mapquest_settings_form in modules/
getlocations_mapquest/ getlocations_mapquest.module - Function
File
- modules/
getlocations_mapquest/ getlocations_mapquest.module, line 2043 - getlocations_mapquest.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function theme_getlocations_mapquest_map($variables) {
drupal_add_js(GETLOCATIONS_MAPQUEST_PATH . '/js/getlocations_mapquest.js');
drupal_add_library('getlocations_mapquest', 'mapquest');
drupal_add_css(GETLOCATIONS_MAPQUEST_PATH . '/getlocations_mapquest.css');
$width = $variables['width'];
$height = $variables['height'];
$map_settings = $variables['map_settings'];
$mapid = $variables['mapid'];
$links = $variables['links'];
$datanum = $map_settings['datanum'];
$latlons = $map_settings['latlons'];
$icons = $map_settings['icons'];
$minmaxes = $map_settings['map_settings']['minmaxes'];
$show_maplinks = $map_settings['map_settings']['show_maplinks'];
unset($map_settings['datanum']);
unset($map_settings['latlons']);
unset($map_settings['icons']);
unset($map_settings['map_settings']['minmaxes']);
getlocations_mapquest_js_settings_do($map_settings, $mapid);
$output = '';
// links
if (isset($links['returnlink'])) {
$output .= '<div class="getlocations_returnlink">' . $links['returnlink'] . '</div>';
}
// wrap the map
$output .= '<div class="getlocations_mapquest_map_wrapper_inner">';
$output .= '<div id="getlocations_mapquest_wrapper_' . $mapid . '" style="width: ' . $width . '; height: ' . $height . '" >';
$output .= '<div class="getlocations_mapquest_canvas" id="getlocations_mapquest_canvas_' . $mapid . '" style="width: 100%; height: 100%" ></div>';
$output .= '</div>';
$output .= '</div>';
// give each map its own data
$localdata = json_encode(array(
'datanum' => $datanum,
'latlons' => $latlons,
'icons' => $icons,
'minmaxes' => $minmaxes,
));
$output .= "\n" . '<script type="text/javascript">' . "\n" . '<!--//--><![CDATA[//><!--' . "\n";
$output .= 'Drupal.getlocations_mapquest_data["' . $mapid . '"] = ' . $localdata . ';' . "\n";
$output .= '//--><!]]>' . "\n" . '</script>' . "\n";
// show_search_distance etc
if (module_exists('getlocations_fields') && isset($map_settings['search_dist_info'])) {
$output .= '<div id="getlocations_fields_search_views_search_wrapper_' . $mapid . '" class="js-hide">';
$output .= '<div id="getlocations_fields_search_views_search_units_' . $mapid . '">' . $map_settings['search_dist_info']['search_units'] . '</div>';
$output .= '<div id="getlocations_fields_search_views_search_latitude_' . $mapid . '">' . $map_settings['search_dist_info']['latitude'] . '</div>';
$output .= '<div id="getlocations_fields_search_views_search_longitude_' . $mapid . '">' . $map_settings['search_dist_info']['longitude'] . '</div>';
$output .= '<div id="getlocations_fields_search_views_search_distance_meters_' . $mapid . '">' . getlocations_convert_distance_to_meters($map_settings['search_dist_info']['search_distance'], $map_settings['search_dist_info']['search_units']) . '</div>';
$output .= '</div>';
}
// show maplinks if enabled
if ($show_maplinks) {
$output .= '<div class="getlocations_mapquest_map_links" id="getlocations_mapquest_map_links_' . $mapid . '" ><ul></ul></div>';
}
// buttons
$buttons = array();
// views_search_marker
if (module_exists('getlocations_fields') && isset($map_settings['search_dist_info'])) {
if ($map_settings['map_settings']['views_search_marker_enable'] && $map_settings['map_settings']['views_search_marker_toggle']) {
$buttons[] = '<input type="button" value="' . t('Search marker !t', array(
'!t' => $map_settings['map_settings']['views_search_marker_toggle_active'] ? t('Off') : t('On'),
)) . '" id="getlocations_mapquest_toggleSearchMarker_' . $mapid . '" class="form-submit" />';
}
if ($map_settings['map_settings']['views_search_radshape_enable'] && $map_settings['map_settings']['views_search_radshape_toggle']) {
$buttons[] = '<input type="button" value="' . t('Search area !t', array(
'!t' => $map_settings['map_settings']['views_search_radshape_toggle_active'] ? t('Off') : t('On'),
)) . '" id="getlocations_mapquest_toggleSearchArea_' . $mapid . '" class="form-submit" />';
}
}
if (count($buttons)) {
$output .= '<div class="getlocations_mapquest_map_buttons container-inline">';
$output .= implode(' ', $buttons);
$output .= '</div>';
}
return $output;
}