| 1 |
<?php
|
| 2 |
/* $Id: geonames_cck.theme.inc,v 1.5 2008/08/04 16:34:26 thegreenman Exp $ */
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Theme functions for the geonames_cck module
|
| 7 |
*/
|
| 8 |
|
| 9 |
|
| 10 |
/**
|
| 11 |
* Themes the disambiguation form
|
| 12 |
*
|
| 13 |
* @param unknown_type $form
|
| 14 |
* @return unknown
|
| 15 |
*/
|
| 16 |
function theme_geonames_cck_disambiguate_form($form) {
|
| 17 |
$name_title = $form['search']['name']['#title'];
|
| 18 |
unset($form['search']['name']['#title']);
|
| 19 |
$name = drupal_render($form['search']['name']);
|
| 20 |
$country_title = $form['search']['country']['#title'];
|
| 21 |
unset($form['search']['country']['#title']);
|
| 22 |
$country = drupal_render($form['search']['country']);
|
| 23 |
$submit = drupal_render($form['search']['submit']);
|
| 24 |
|
| 25 |
$output .= '<table><tr>';
|
| 26 |
$output .= '<td>'.$name.'</td>';
|
| 27 |
$output .= '<td>'.$country.'</td>';
|
| 28 |
$output .= '<td>'.$submit.'</td>';
|
| 29 |
$output .= '</tr></table>';
|
| 30 |
|
| 31 |
$output .= drupal_render($form);
|
| 32 |
return $output;
|
| 33 |
}
|
| 34 |
|
| 35 |
/**
|
| 36 |
* Return custom text strings for given internal message IDs
|
| 37 |
*
|
| 38 |
* We have chosen to not create an admin interface to manage these strings so that we do not break internationalisation.
|
| 39 |
*
|
| 40 |
*
|
| 41 |
* @param string $message
|
| 42 |
* @param array $variables
|
| 43 |
* @param string $country_code
|
| 44 |
* @return t()
|
| 45 |
*/
|
| 46 |
function _geonames_cck_text($message, $variables = array(), $country_code = NULL) {
|
| 47 |
switch ($message) {
|
| 48 |
case 'disambiguation_multipleresults':
|
| 49 |
$output .= t('There are @resultcount locations matching <strong>"!location"</strong>. Click on the best match to set your location or you can search again.', $variables);
|
| 50 |
break;
|
| 51 |
case 'disambiguation_noresults':
|
| 52 |
$output .= '<p>'.t("The town <strong>\"!location\"</strong> wasn't found in the database. Please check your spelling and that the correct country is selected.", $variables).'</p>';
|
| 53 |
if ($country_code == 'GB') {
|
| 54 |
$output .= '<p>'.t('To search for a location in the UK, just give the city name without the county, e.g. "Oxford". For large cities, just search for the area name, e.g. "Chelsea".').'</p>';
|
| 55 |
}
|
| 56 |
elseif ($country_code == 'US') {
|
| 57 |
$output .= '<p>'.t('To search for a location in the United States, just give the city name or the city name, state. E.g. search for "Dallas" or "Dallas, TX".').'</p>';
|
| 58 |
}
|
| 59 |
$output .= theme('geonames_cck_country_bounding_box', $country_code);
|
| 60 |
break;
|
| 61 |
case 'disambiguation_oneresult':
|
| 62 |
$output .= t('There is 1 location matching <strong>"!location"</strong>. Click on the best match to set your location or you can search again.', $variables);
|
| 63 |
break;
|
| 64 |
case 'disambiguation_empty': // a location has never been set.
|
| 65 |
$output .= t('You have not yet set your location. Use the form below to search for your location (name of city/town).', $variables);
|
| 66 |
if ($country_code == NULL) { // for users that we don't even have a country for, assume GB
|
| 67 |
$country_code = 'GB';
|
| 68 |
}
|
| 69 |
$output .= theme('geonames_cck_country_bounding_box', $country_code);
|
| 70 |
break;
|
| 71 |
case 'location_known':
|
| 72 |
$output .= t('!location (<a href="@url">change</a>)', $variables);
|
| 73 |
break;
|
| 74 |
case 'location_nodata': // location is not yet set
|
| 75 |
$output .= t('(<a href="@url">Set your location so we can show you who is teaching or learning your subjects in your area</a>)', $variables);
|
| 76 |
break;
|
| 77 |
case 'location_unknown': // unknown location entered on signup
|
| 78 |
$output .= t('(<a href="@url">Set your location so we can show you who is teaching or learning your subjects in your area</a>)', $variables);
|
| 79 |
break;
|
| 80 |
case 'disambiguation_intro':
|
| 81 |
$output .= t('School of Everything helps people who want to learn meet people who want to teach. By entering your location (name of city/town) you will receive better matches for the subjects you want to learn and teach.');
|
| 82 |
break;
|
| 83 |
}
|
| 84 |
return $output;
|
| 85 |
}
|
| 86 |
|
| 87 |
|
| 88 |
/**
|
| 89 |
* Themes the display of an alert message to prompt user for better data
|
| 90 |
*
|
| 91 |
* @param unknown_type $key
|
| 92 |
*/
|
| 93 |
function theme_geonames_cck_alert($message) {
|
| 94 |
$output = '<div class="area area-interaction area-interaction-default">'.$message.'</div>';
|
| 95 |
return $output;
|
| 96 |
}
|
| 97 |
|
| 98 |
/**
|
| 99 |
* Theme the main disambiguation page.
|
| 100 |
*
|
| 101 |
*
|
| 102 |
*
|
| 103 |
*/
|
| 104 |
function theme_geonames_cck_disambiguate_page($original_place, $original_country, $locations, $nid, $field, $index, $icon = NULL, $shadow = NULL) {
|
| 105 |
if ($original_place) {
|
| 106 |
$values = array(
|
| 107 |
'!location' => $original_place .', '. geoapi_countries($original_country),
|
| 108 |
'@resultcount' => $locations->total_results_count,
|
| 109 |
);
|
| 110 |
//How many matches do we have for the given search string?
|
| 111 |
switch (sizeof($locations->results)) {
|
| 112 |
case 0: // no matches
|
| 113 |
$message = _geonames_cck_text('disambiguation_noresults', $values, $original_country);
|
| 114 |
break;
|
| 115 |
case 1: // only one match
|
| 116 |
$message = _geonames_cck_text('disambiguation_oneresult', $values);
|
| 117 |
$location_list = theme('geonames_cck_disambiguate_location', $original_place, $original_country, $locations, $nid, $field, $index);
|
| 118 |
break;
|
| 119 |
default: // multiple matches
|
| 120 |
$message = _geonames_cck_text('disambiguation_multipleresults', $values);
|
| 121 |
$location_list = theme('geonames_cck_disambiguate_location', $original_place, $original_country, $locations, $nid, $field, $index);
|
| 122 |
break;
|
| 123 |
}
|
| 124 |
}
|
| 125 |
else {
|
| 126 |
// no place data, maybe no country either
|
| 127 |
$message = _geonames_cck_text('disambiguation_empty', $values, $original_country);
|
| 128 |
}
|
| 129 |
$form = drupal_get_form('geonames_cck_disambiguate_form', $original_place, $original_country, $nid, $field, $index);
|
| 130 |
|
| 131 |
|
| 132 |
$output = '';
|
| 133 |
$output .= '<div id="disambiguation">';
|
| 134 |
$output .= '<div class="introduction">'. _geonames_cck_text('disambiguation_intro').'</div>';
|
| 135 |
$output .= theme('geonames_cck_alert', $message . $form);
|
| 136 |
$output .= $location_list;
|
| 137 |
$output .= '</div>';
|
| 138 |
return $output;
|
| 139 |
}
|
| 140 |
|
| 141 |
|
| 142 |
/**
|
| 143 |
* Produce disambiguation data for a specific location
|
| 144 |
*/
|
| 145 |
function theme_geonames_cck_disambiguate_location($original_place, $original_country, $locations, $nid, $field, $index) {
|
| 146 |
|
| 147 |
foreach ($locations->results as $location) {
|
| 148 |
$items[] = theme('geonames_cck_disambiguate_location_item', $location, $nid, $field, $index);
|
| 149 |
}
|
| 150 |
|
| 151 |
$title = t('Click on the best match to set your location', array('!location' => $original_place .', '. geoapi_countries($original_country)));
|
| 152 |
$output = theme('item_list', $items, $title , 'ol', array('class' => 'disambiguation-list'));
|
| 153 |
return $output;
|
| 154 |
}
|
| 155 |
|
| 156 |
/**
|
| 157 |
* Theme one item of the disambiguation list
|
| 158 |
*/
|
| 159 |
function theme_geonames_cck_disambiguate_location_item($location, $nid, $field, $index) {
|
| 160 |
$location_string = theme('geonames_cck_location_name', $location, true);
|
| 161 |
$action_url = 'services/location/geonames/insert/'. $nid .'/'. $field .'/'. $index .'/'. $location['geonameid'];
|
| 162 |
$output = l($location_string, $action_url, array(), null, null, false, true );
|
| 163 |
$output .= theme('geonames_hidden', $location['lat'], $location['lng'], $counter .' - '. $location_string);
|
| 164 |
return $output;
|
| 165 |
}
|
| 166 |
|
| 167 |
/**
|
| 168 |
* Theme the full name for a location
|
| 169 |
*/
|
| 170 |
function theme_geonames_cck_location_name($location, $full = false) {
|
| 171 |
$location_name = array();
|
| 172 |
// fix capitalisation -- EVIL!
|
| 173 |
if ($location['adminname2']) {
|
| 174 |
$location['adminName2'] = $location['adminname2'];
|
| 175 |
$location['adminName1'] = $location['adminname1'];
|
| 176 |
}
|
| 177 |
|
| 178 |
$location_name[] = $location['name'];
|
| 179 |
if ($full or strtoupper($location['country']) == 'US') {
|
| 180 |
if ($location['adminName2']) $location_name[] = $location['adminName2'];
|
| 181 |
if ($location['adminName1']) $location_name[] = $location['adminName1'];
|
| 182 |
}
|
| 183 |
else if (strtoupper($location['country']) == 'GB') {
|
| 184 |
if (!$location['adminName2']) {
|
| 185 |
$location['adminName2'] = geonames_cck_get_admin_region(null , $location['lat'], $location['lng']);
|
| 186 |
}
|
| 187 |
if ($location['adminName2'] and $location['adminName2'] != $location['name']) {
|
| 188 |
$location_name[] = $location['adminName2']; // Fix the 'London, London' issue
|
| 189 |
}
|
| 190 |
}
|
| 191 |
$result = implode(', ', $location_name);
|
| 192 |
return $result;
|
| 193 |
}
|
| 194 |
|
| 195 |
/**
|
| 196 |
* Used for default display setting
|
| 197 |
*
|
| 198 |
* //TODO: get rid of extra params - just use attributes
|
| 199 |
*/
|
| 200 |
function theme_geonames_location($lat, $lng, $name='', $item=NULL, $node=NULL, $attributes = array(), $icon = NULL, $shadow = NULL) {
|
| 201 |
$name and $location_name[] = $name;
|
| 202 |
($node) and $title = $node -> title; // we have data, but no title
|
| 203 |
if ($node) $attributes['nid'] = $node -> nid;
|
| 204 |
if ($icon) {
|
| 205 |
$attributes['gicon'] = $icon;
|
| 206 |
$attributes['draggable'] = "false";
|
| 207 |
}
|
| 208 |
if ($shadow) $attributes['gshadow'] = $shadow;
|
| 209 |
//drag&drop relocation disabled in this theming function
|
| 210 |
$attributes['title'] = $title;
|
| 211 |
|
| 212 |
if ($item) {
|
| 213 |
// this is a cck item
|
| 214 |
if (geoapi_countries($item['country'])) {
|
| 215 |
$location_name[] = geoapi_countries($item['country']);
|
| 216 |
if (is_array($location_name)) {
|
| 217 |
$output = check_plain(implode(', ', $location_name));
|
| 218 |
}
|
| 219 |
}
|
| 220 |
}
|
| 221 |
else {
|
| 222 |
if (is_array($location_name)) {
|
| 223 |
$output = check_plain(implode(', ', $location_name));
|
| 224 |
}
|
| 225 |
}
|
| 226 |
$output = theme('geonames_location_microformat', $lat, $lng, $output , $attributes );
|
| 227 |
return $output;
|
| 228 |
}
|
| 229 |
|
| 230 |
/**
|
| 231 |
* returns the basic html for a geo microformat
|
| 232 |
*
|
| 233 |
* @param unknown_type $lat
|
| 234 |
* @param unknown_type $lng
|
| 235 |
* @param unknown_type $text
|
| 236 |
* @param unknown_type $attributes
|
| 237 |
*/
|
| 238 |
function theme_geonames_location_microformat($lat, $lng, $text = '' , $attributes = array()) {
|
| 239 |
$attributes['class'] .= ' geo';
|
| 240 |
if ($lat and $lng) {
|
| 241 |
$output .= '<span class="latitude" title="'. $lat .'"></span>
|
| 242 |
<span class="longitude" title="'. $lng .'"></span>';
|
| 243 |
$output = '<div '.drupal_attributes($attributes).' >'. $output.$text .'</div>';
|
| 244 |
}
|
| 245 |
return $output;
|
| 246 |
}
|
| 247 |
/**
|
| 248 |
* Used when 'With disambiguation link' option is selected
|
| 249 |
* in fields' display setting. enables drag&drop of icons
|
| 250 |
*/
|
| 251 |
function theme_geonames_location_disambiguation($lat, $lng, $name='', $field = NULL, $item=NULL, $node=NULL, $icon = NULL, $shadow = NULL) {
|
| 252 |
$name and $location_name[] = $name;
|
| 253 |
($node) and $title = $node -> title; // we have data, but no title
|
| 254 |
if ($node) $attributes = 'nid="'. $node -> nid .'"';
|
| 255 |
if ($icon) $attributes .= ' gicon = "'. $icon .'"';
|
| 256 |
if ($shadow) $attributes .= ' gshadow = "'. $shadow .'"';
|
| 257 |
|
| 258 |
//Icons are draggable only in node view, but not in disambiguation view
|
| 259 |
//because it is meaningless to relocate multiple possible locations
|
| 260 |
$draggable = '"false"'; //this is div's attribute, so it needs to be in double-quotations.
|
| 261 |
|
| 262 |
if (arg(0) == 'node' && is_numeric(arg(1))) {
|
| 263 |
//only allow users to relocate if they have edit access
|
| 264 |
if (node_access('update', $node)) {
|
| 265 |
$draggable = '"true"';
|
| 266 |
}
|
| 267 |
}
|
| 268 |
//TODO: integrate with nodeprofile
|
| 269 |
$attributes .= ' draggable = '. $draggable .' ';
|
| 270 |
if ($field) {
|
| 271 |
$attributes .= ' cckfield = '. $field['field_name'];
|
| 272 |
$attributes .= ' cckfieldindex = 0';
|
| 273 |
}
|
| 274 |
|
| 275 |
if ($item) {
|
| 276 |
// this is a cck item
|
| 277 |
geoapi_countries($item['country']) and $location_name[] = geoapi_countries($item['country']);
|
| 278 |
$output = check_plain(implode(', ', $location_name));
|
| 279 |
if (arg(0) == 'node' && is_numeric(arg(1))) {
|
| 280 |
$output .= '<div class="disambiguate">'. l('(disambiguate)', arg(0) .'/'. arg(1) .'/disambiguate') .'</div>';
|
| 281 |
}
|
| 282 |
}
|
| 283 |
else {
|
| 284 |
$output = check_plain(implode(', ', $location_name));
|
| 285 |
}
|
| 286 |
if ($lat and $lng) {
|
| 287 |
|
| 288 |
$output .= '<span class="latitude" title="'. $lat .'"></span>
|
| 289 |
<span class="longitude" title="'. $lng .'"></span>';
|
| 290 |
$output = '<div class="geo" title="'. $title .'" '. $attributes .' >'. $output .'</div>';
|
| 291 |
}
|
| 292 |
return $output;
|
| 293 |
}
|
| 294 |
|
| 295 |
/**
|
| 296 |
* Used when <hidden> is selected in fields' display setting
|
| 297 |
* Location information is invisible as content, but
|
| 298 |
* locations get mapped
|
| 299 |
*/
|
| 300 |
function theme_geonames_hidden($lat, $lng, $title ='', $item=NULL, $node=NULL, $icon = NULL, $shadow = NULL) {
|
| 301 |
if (!$title && $node) $title = $node -> title;
|
| 302 |
if ($lat and $lng) $output = '<div class="geo" title="'. check_plain($title) .'" nid="'. $node -> nid .' ">
|
| 303 |
<span class="latitude" title="'. $lat .'"></span>
|
| 304 |
<span class="longitude" title="'. $lng .'"></span>
|
| 305 |
</div>';
|
| 306 |
if ($icon) {
|
| 307 |
$output .= '<span class="gicon" title="'. $icon .'">';
|
| 308 |
}
|
| 309 |
if ($shadow) {
|
| 310 |
$output .= '<span class="gshadow" title="'. $shadow .'">';
|
| 311 |
}
|
| 312 |
return $output;
|
| 313 |
}
|
| 314 |
|
| 315 |
function theme_geonames_location_no_geotag($lat, $lng, $name='', $item=NULL, $node=NULL) {
|
| 316 |
|
| 317 |
$name and $location_name[] = $name;
|
| 318 |
|
| 319 |
($node) and $title = $node -> title; // we have data, but no title
|
| 320 |
if ($node) $attributes = 'nid="'. $node -> nid .'"';
|
| 321 |
//drag&drop relocation disabled in this theming function
|
| 322 |
|
| 323 |
if ($item) {
|
| 324 |
// this is a cck item
|
| 325 |
geoapi_countries($item['country']) and $location_name[] = geoapi_countries($item['country']);
|
| 326 |
$output = check_plain(implode(', ', $location_name));
|
| 327 |
}
|
| 328 |
else {
|
| 329 |
$output = check_plain(implode(', ', $location_name));
|
| 330 |
}
|
| 331 |
|
| 332 |
return $output;
|
| 333 |
}
|
| 334 |
|
| 335 |
|
| 336 |
/**
|
| 337 |
* Theme the display of the locations
|
| 338 |
*@param node
|
| 339 |
* The node object
|
| 340 |
*@param $disambiguate_links
|
| 341 |
* add links to disabmiguation pages
|
| 342 |
*@param $attributes
|
| 343 |
* an array of attributes to be added to the rendered geodata
|
| 344 |
*
|
| 345 |
* */
|
| 346 |
//TODO: get title working
|
| 347 |
function theme_geonames_cck_location($node = null, $disambiguate_links = false, $attributes = array()) {
|
| 348 |
// TODO: this should not be here. check that we can remove it
|
| 349 |
if (!$node && arg(0) == 'node' && is_numeric(arg(1))) {
|
| 350 |
$node = node_load(arg(1));
|
| 351 |
}
|
| 352 |
if ($node) {
|
| 353 |
// make the geonames fields work
|
| 354 |
$geo_fields = geonames_cck_get_all_fields();
|
| 355 |
// look for all the defined fields
|
| 356 |
foreach ($geo_fields as $field_name => $geo_field_data) {
|
| 357 |
if (is_array($node->$field_name)) {
|
| 358 |
// this node uses this field
|
| 359 |
foreach ($node->$field_name as $index => $field_data) {
|
| 360 |
//get node-specific icon and shadow
|
| 361 |
//(shadow is set only if icon is set)
|
| 362 |
if ($icon = $field_data['icon']) {
|
| 363 |
$shadow = $field_data['shadow'];
|
| 364 |
}
|
| 365 |
|
| 366 |
//if node-specific icon and shadow are not set, get them from field setting
|
| 367 |
if (!$icon) {
|
| 368 |
if ($icon = $geo_field_data['icon']) {
|
| 369 |
$shadow = $geo_field_data['shadow'];
|
| 370 |
}
|
| 371 |
}
|
| 372 |
$locations['geonames'][] = theme('geonames_cck_location_item', $field_data, $node, $disambiguate_links, $icon, $shadow, $attributes);
|
| 373 |
}
|
| 374 |
}
|
| 375 |
}
|
| 376 |
if (module_exists('token')) {
|
| 377 |
token_replace($title, 'node', $node);
|
| 378 |
}
|
| 379 |
if (is_array($locations['geonames'])) {
|
| 380 |
$output = $title .'<div class="locations-geonames">'. implode(', ', $locations['geonames']) .'</div>';
|
| 381 |
}
|
| 382 |
}
|
| 383 |
if ($output) {
|
| 384 |
return '<div class="geonames-locations">'. $output .'</div>';
|
| 385 |
}
|
| 386 |
}
|
| 387 |
|
| 388 |
/**
|
| 389 |
* Theme a geonames entry in the locations list.
|
| 390 |
*/
|
| 391 |
function theme_geonames_cck_location_item($location, $node, $disambiguate_links = false, $icon = NULL, $shadow = NULL, $attributes = array() ) {
|
| 392 |
global $user;
|
| 393 |
if ($location['name'] && $location['lat']) {
|
| 394 |
// we have location data
|
| 395 |
$values = array(
|
| 396 |
'!location' => theme('geonames_location', $location['lat'], $location['lng'], theme('geonames_cck_location_name', $location), $location, $node, $attributes, $icon, $shadow),
|
| 397 |
'@country' => geoapi_countries($location['country']),
|
| 398 |
'@url' => url('node/'. $node->nid .'/disambiguate'),
|
| 399 |
);
|
| 400 |
if ( $disambiguate_links && node_access ('update', $node)) {
|
| 401 |
$output = _geonames_cck_text('location_known', $values);
|
| 402 |
}
|
| 403 |
else {
|
| 404 |
$output = theme('geonames_location', $location['lat'], $location['lng'], theme('geonames_cck_location_name', $location), $location, $node, $attributes, $icon, $shadow );
|
| 405 |
}
|
| 406 |
}
|
| 407 |
else if ($location['name'] && !$location['lat']) {
|
| 408 |
// we have a name, but can't work out where it is
|
| 409 |
$values = array(
|
| 410 |
'!location' => $location['name'],
|
| 411 |
'@country' => geoapi_countries($location['country']),
|
| 412 |
'@url' => url('node/'. $node->nid .'/disambiguate'),
|
| 413 |
);
|
| 414 |
if ($disambiguate_links && node_access('update', $node)) {
|
| 415 |
$output = _geonames_cck_text('location_unknown', $values);
|
| 416 |
}
|
| 417 |
else {
|
| 418 |
$output = geoapi_countries($location['country']);
|
| 419 |
}
|
| 420 |
// add a bounding box map
|
| 421 |
$output .= theme('geonames_cck_country_bounding_box', $location['country']);
|
| 422 |
}
|
| 423 |
else {
|
| 424 |
//no location data has been provided
|
| 425 |
if ($disambiguate_links && node_access('update', $node)) {
|
| 426 |
$values = array(
|
| 427 |
'@country' => geoapi_countries($location['country']),
|
| 428 |
'@url' => url('node/'. $node->nid .'/disambiguate'),
|
| 429 |
);
|
| 430 |
$output = _geonames_cck_text('location_nodata', $values);
|
| 431 |
}
|
| 432 |
else {
|
| 433 |
$output = geoapi_countries($location['country']);
|
| 434 |
}
|
| 435 |
$output .= theme('geonames_cck_country_bounding_box', $location['country']);
|
| 436 |
}
|
| 437 |
//print $values['test'];
|
| 438 |
return $output;
|
| 439 |
}
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
/**
|
| 444 |
* Generates a set of four hidden points that will force geomap to zoom to a country
|
| 445 |
*
|
| 446 |
* @param unknown_type $country
|
| 447 |
*/
|
| 448 |
function theme_geonames_cck_country_bounding_box($country) {
|
| 449 |
if (module_exists('geonames_countryinfo')) {
|
| 450 |
$data = _geoapi_get_country_data($country);
|
| 451 |
$output .= theme('geonames_location_microformat', $data['bboxnorth'], $data['bboxwest'], '' , array('gicon' => 'null', 'gshadow' => 'null') );
|
| 452 |
$output .= theme('geonames_location_microformat', $data['bboxsouth'], $data['bboxeast'], '' , array('gicon' => 'null', 'gshadow' => 'null') );
|
| 453 |
}
|
| 454 |
return $output;
|
| 455 |
}
|
| 456 |
|
| 457 |
|
| 458 |
function theme_geoapi_kml_item_simple($geonameid, $name = null , $description = null){
|
| 459 |
$geodata = _geoapi_get_data_for_geonameid($geonameid);
|
| 460 |
if (!$name) {
|
| 461 |
$name = $geodata['name'];
|
| 462 |
}
|
| 463 |
$output .= '<name>'.$name.'</name>'."\n";
|
| 464 |
if ($description) {
|
| 465 |
$output .= '<description>'.$description.'</description>'."\n";
|
| 466 |
}
|
| 467 |
$output.= '<Point><coordinates>'.$geodata['lat'].','.$geodata['lng'].'</coordinates></Point>'."\n";
|
| 468 |
$output = '<Placemark>'.$output.'</Placemark>';
|
| 469 |
return $output;
|
| 470 |
}
|
| 471 |
|
| 472 |
function theme_geoapi_kml_document($content) {
|
| 473 |
$output = '<?xml version="1.0" encoding="UTF-8"?>'."\n";
|
| 474 |
$output .= '<kml xmlns="http://www.opengis.net/kml/2.2">';
|
| 475 |
$output .= $content;
|
| 476 |
$output .= '</kml>';
|
| 477 |
return $output;
|
| 478 |
}
|
| 479 |
|
| 480 |
/**
|
| 481 |
* themes a description of what geonames is
|
| 482 |
*
|
| 483 |
* @return string
|
| 484 |
*/
|
| 485 |
function theme_geonames_description() {
|
| 486 |
$output = theme('everything_help', array('context' => array('object' => 'person', 'perspective' => 'disambiguate'))); // set context here
|
| 487 |
return $output;
|
| 488 |
}
|