function theme_getdirections_show in Get Directions 6.2
Same name and namespace in other branches
- 6 getdirections.theme.inc \theme_getdirections_show()
- 7.3 getdirections.module \theme_getdirections_show()
- 7.2 getdirections.module \theme_getdirections_show()
Theme to use for when one or no locations are supplied.
1 theme call to theme_getdirections_show()
- getdirections_direction in ./
getdirections.module - Function to setup the map and form
File
- ./
getdirections.theme.inc, line 60 - getdirections module theming
Code
function theme_getdirections_show($form, $width, $height, $nid, $type) {
$output = '';
$getdirections_returnlink = variable_get('getdirections_returnlink', array(
'page_enable' => 0,
'page_link' => t('Return to page'),
'user_enable' => 0,
'user_link' => t('Return to page'),
));
if ($getdirections_returnlink['page_enable'] && $nid > 0 && $type == 'node') {
$node = node_load(array(
'nid' => $nid,
));
$linktext = $getdirections_returnlink['page_link'];
if (preg_match("/%t/", $linktext)) {
$linktext = preg_replace("/%t/", $node->title, $linktext);
}
$l = l($linktext, 'node/' . $node->nid);
$output .= '<div class="getdirections_returnlink">' . $l . '</div>';
}
elseif ($getdirections_returnlink['user_enable'] && $nid > 0 && $type == 'user') {
$account = user_load(array(
'uid' => $nid,
));
$linktext = $getdirections_returnlink['user_link'];
if (preg_match("/%n/", $linktext)) {
$linktext = preg_replace("/%n/", $account->name, $linktext);
}
$l = l($linktext, 'user/' . $account->uid);
$output .= '<div class="getlocations_returnlink">' . $l . '</div>';
}
elseif ($getdirections_returnlink['page_enable'] && $nid > 0 && $type == 'location') {
// $nid is actually lid
$id = getdirections_get_nid_from_lid($nid);
if ($id) {
$node = node_load(array(
'nid' => $id,
));
$linktext = $getdirections_returnlink['page_link'];
if (preg_match("/%t/", $linktext)) {
$linktext = preg_replace("/%t/", $node->title, $linktext);
}
$l = l($linktext, 'node/' . $node->nid);
$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"></div>';
}
if ($getdirections_misc['show_duration']) {
$output .= '<div id="getdirections_show_duration"></div>';
}
$help = '';
if (getdirections_is_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">' . $help . '</div>';
$header = array();
$rows[] = array(
array(
'data' => '<div id="getdirections_map_canvas" style="width: ' . $width . '; height: ' . $height . '" ></div>',
'valign' => 'top',
'align' => 'center',
'class' => 'getdirections-map',
),
array(
'data' => ($getdirections_defaults['advanced_alternate'] ? '<button id="getdirections-undo" onclick="Drupal.getdirectionsundo()">' . t('Undo') . '</button>' : '') . '<div id="getdirections_directions"></div>',
'valign' => 'top',
'align' => 'left',
'class' => 'getdirections-list',
),
);
$output .= '<div class="getdirections">' . theme('table', $header, $rows) . '</div>';
return $output;
}