function theme_getdirections_show in Get Directions 7.3
Same name and namespace in other branches
- 6.2 getdirections.theme.inc \theme_getdirections_show()
- 6 getdirections.theme.inc \theme_getdirections_show()
- 7.2 getdirections.module \theme_getdirections_show()
Theme to use for when one or no locations are supplied.
2 theme calls to theme_getdirections_show()
- getdirections_direction in ./
getdirections.module - Function to setup the map and form
- getdirections_direction_other in ./
getdirections.module - Function to setup the map and form
File
- ./
getdirections.module, line 3128 - Fetches google map directions.
Code
function theme_getdirections_show($variables) {
$form = $variables['form'];
$width = $variables['width'];
$height = $variables['height'];
$entity_id = $variables['entity_id'];
$entity_type = $variables['entity_type'];
$mapid = $variables['mapid'];
$lid = $variables['lid'];
$type = $variables['type'];
$output = '';
$getdirections_returnlink_default = getdirections_returnlink_defaults();
$getdirections_returnlink = variable_get('getdirections_returnlink', $getdirections_returnlink_default);
if ($type !== 'location') {
// entity way
// permissions first
if ($entity_id) {
if (isset($getdirections_returnlink[$entity_type . '_enable']) && $getdirections_returnlink[$entity_type . '_enable']) {
$linktext = $getdirections_returnlink[$entity_type . '_link'];
$entity_get_info = entity_get_info($entity_type);
$load_hook = $entity_get_info['load hook'];
$obj = $load_hook($entity_id);
$uri_func = $entity_get_info['uri callback'];
$uri = $uri_func($obj);
$entity_title = '';
if (isset($entity_get_info['entity keys']['label'])) {
$entity_title = $entity_get_info['entity keys']['label'];
}
elseif ($entity_type == 'user') {
$entity_title = 'name';
}
if ($entity_title && isset($obj->{$entity_title})) {
$linktext = preg_replace("/%n/", $obj->{$entity_title}, $linktext);
$l = l($linktext, $uri['path']);
$output .= '<div class="getdirections_returnlink">' . $l . '</div>';
}
}
}
}
$output .= $form;
$getdirections_defaults = getdirections_defaults();
$getdirections_misc = getdirections_misc_defaults();
if ($getdirections_misc['show_distance']) {
$output .= '<div id="getdirections_show_distance_' . $mapid . '"></div>';
}
if ($getdirections_misc['show_duration']) {
$output .= '<div id="getdirections_show_duration_' . $mapid . '"></div>';
}
$help = '';
if ($getdirections_defaults['use_advanced']) {
if ($getdirections_defaults['waypoints'] > 0 && !$getdirections_defaults['advanced_alternate']) {
$help = t('Drag <img src="http://labs.google.com/ridefinder/images/mm_20_!c.png"> to activate a waypoint', array(
'!c' => $getdirections_defaults['waypoint_color'],
));
if ($getdirections_defaults['advanced_autocomplete'] && $getdirections_defaults['advanced_autocomplete_via']) {
$help .= ' ' . t('or use the Autocomplete boxes');
}
}
elseif ($getdirections_defaults['advanced_alternate']) {
$help = t('You can drag the route to change it');
}
}
$output .= '<div id="getdirections_help_' . $mapid . '">' . $help . '</div>';
$header = array();
$rows[] = array(
array(
'data' => '<div id="getdirections_map_canvas_' . $mapid . '" style="width: ' . $width . '; height: ' . $height . '" ></div>',
'valign' => 'top',
'align' => 'center',
'class' => array(
'getdirections-map',
),
),
array(
'data' => ($getdirections_defaults['use_advanced'] && $getdirections_defaults['advanced_alternate'] ? '<button id="getdirections-undo-' . $mapid . '">' . t('Undo') . '</button>' : '') . '<div id="getdirections_directions_' . $mapid . '"></div>',
'valign' => 'top',
'align' => 'left',
'class' => array(
'getdirections-list',
),
),
);
$output .= '<div class="getdirections">' . theme('table', array(
'header' => $header,
'rows' => $rows,
)) . '</div>';
return $output;
}