Project

General

Profile

Download (20.7 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
// $Id$
3

    
4
/**
5
 * Copyright (C) 2007 EDIT
6
 * European Distributed Institute of Taxonomy
7
 * http://www.e-taxonomy.eu
8
 *
9
 * The contents of this file are subject to the Mozilla Public License Version 1.1
10
 * See http://www.mozilla.org/MPL/MPL-1.1.html for the full license terms.
11
 */
12

    
13
function theme_cdm_feature_nodesTOC($featureNodes){
14

    
15
	$out .= '<ul>';
16

    
17
	foreach($featureNodes as $node){
18
		// process $descriptionElements with content only
19
		if(is_array($node->descriptionElements) && count($node->descriptionElements) > 0){
20

    
21
			$featureRepresentation = isset($node->feature->representation_L10n) ? $node->feature->representation_L10n : 'Feature';
22
			// HACK to implement images for taxa, should be removed
23
			if($node->feature->uuid != UUID_IMAGE){
24
				$out .= '<li>'.l(t(theme('cdm_feature_name', $featureRepresentation)), $_GET['q'], array("class"=>"toc"), NULL, generalizeString($featureRepresentation)).'</li>';
25
			}
26
		}
27
	}
28

    
29
	$out .= '</ul>';
30
	return $out;
31
}
32

    
33
function theme_cdm_feature_name($feature_name){
34
	//TODO replace by using translations ?
35
	switch($feature_name){
36
		default: return t(ucfirst($feature_name));
37
	}
38
}
39

    
40
function theme_cdm_featureTrees($mergedTrees, $taxon){
41

    
42
	if(!$mergedTrees){
43
		return;
44
	}
45
	foreach($mergedTrees as &$mTree){
46
		//TODO diplay title and reference in case of multiple $mergedTrees -> theme
47
		$out .= theme('cdm_feature_nodes', $mTree->root->children, $taxon);
48
	}
49
	return $out;
50
}
51

    
52

    
53

    
54
function theme_cdm_featureTreeTOCs($mergedTrees){
55

    
56
	if(!$mergedTrees){
57
		return;
58
	}
59
	//FIXME
60
	$out = '<div class="featureTOC">';
61
	$out .= '<h2>' . t('Content') .'</h2>';
62

    
63
	//TODO diplay title and reference in case of multiple $mergedTrees -> theme
64

    
65
	foreach($mergedTrees as &$mTree){
66
		$out .= theme('cdm_feature_nodesTOC', $mTree->root->children);
67
	}
68

    
69
	$out .= '</div>';
70
	return $out;
71
}
72

    
73

    
74

    
75
function theme_cdm_feature_nodes($featureNodes, $taxon){
76

    
77
	RenderHints::pushToRenderStack('feature_nodes');
78
	$gallery_settings = getGallerySettings(CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME);
79

    
80
	foreach($featureNodes as $node){
81
		// process $descriptionElements with content only
82
		if(is_array($node->descriptionElements) && count($node->descriptionElements) > 0){
83

    
84
			$featureRepresentation = isset($node->feature->representation_L10n) ? $node->feature->representation_L10n : 'Feature';
85

    
86
			$block->module = 'cdm_dataportal';
87

    
88
			if($node->feature->uuid != UUID_IMAGE){
89
				$block->delta = generalizeString($featureRepresentation);
90
				$block->subject = theme('cdm_feature_name', $featureRepresentation);
91
				$block->module = "cdm_dataportal-feature";
92

    
93
				//get the text for the feature block
94
				if ($node->feature->titleCache == 'Common Name'){
95
					$block->content = theme('cdm_common_names', $node->descriptionElements);
96
				} else {
97
				  $block->content = theme('cdm_descriptionElements', $node->descriptionElements, $node->feature->uuid);
98
				}
99
				// get media for the feature block
100
				$media_list = cdm_dataportal_media_from_descriptionElements($node->descriptionElements);
101
				$captionElements = array('title', 'rights');
102
				//$block->content .= theme('cdm_media_gallerie', $media_list, "test", 150, 4, false, $captionElements);
103
				$block->content .= theme('cdm_media_gallery', $media_list,
104
				CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME.'_'.$node->feature->uuid,
105
				$gallery_settings['cdm_dataportal_media_maxextend'],
106
				$gallery_settings['cdm_dataportal_media_cols'],
107
				$gallery_settings['cdm_dataportal_media_maxRows'],
108
				$captionElements);
109

    
110
				// set anchor; FIXME put anchor in $block->subject
111
				$out .= '<a name="'.$block->delta.'"></a>';
112
				$out .= theme('block', $block);
113

    
114
				// Display cdm distribution map TODO this is a HACK to a proper generic implementation?
115
				if($node->feature->uuid == UUID_DISTRIBUTION){
116
					$out .= theme('cdm_distribution_map', $taxon);
117
				}
118

    
119
				$out .= theme('cdm_footnotes', $node->feature->uuid);
120
				$out .= theme('cdm_annotation_footnotes', $node->feature->uuid);
121
			}
122
		}
123
		// theme
124
		if(count($node->children) > 0){
125
			$out .= '<div class="nested_description_elements">';
126
			$out .= theme('cdm_feature_nodes', $node->children, $taxon);
127
			$out .= '</div>';
128
		}
129
	}
130
	RenderHints::popFromRenderStack();
131
	return $out;
132
}
133

    
134

    
135

    
136

    
137
function theme_cdm_descriptionElementArray($elementArray, $feature, $glue = '', $sortArray = false, $enclosingHtml = 'ul'){
138
	$out = '<'.$enclosingHtml.' class="description" id="'.$feature->representation_L10n.'">';
139

    
140
	if($sortArray) sort($elementArray);
141

    
142
	$out .= join($elementArray, $glue);
143

    
144
	$out .= '</'.$enclosingHtml.'>';
145
	return $out;
146
}
147

    
148

    
149
function theme_cdm_descriptionElement_CommonTaxonName($element){
150
	$out = $element->language->representation_L10n . ' (' . $element->area->titleCache . '): ' . $element->name;
151
	return $out;
152
}
153
/**
154
 * TODO: assign a new name to the function? because it is used for the citations
155
 *       textdata elements and not for all text data description elements
156
 * @param $element The description element which contains the text information
157
 * @param $asListElement A boolean which determines whether the citations should
158
 *                       be renderer as a list or not
159
 * @return unknown_type Html to be renderized in drupal
160
 */
161
function theme_cdm_descriptionElementTextData($element, $asListElement){
162

    
163
	$description = str_replace("\n", "<br/>", $element->multilanguageText_L10n->text);
164
	$sourceRefs = '';
165
	$result = array();
166
	$out;
167
	$res_author;
168
	$res_date;
169
	 
170
	foreach($element->sources as $source){
171
		$referenceCitation = theme('cdm_DescriptionElementSource', $source);
172
		if($description && strlen($description) > 0 && $referenceCitation ){
173
			$sourceRefs .= ' ('.$referenceCitation.')' ;
174
		}else if ($referenceCitation){
175
			$sourceRefs = $referenceCitation;
176
		}
177
	}
178
	if(strlen($sourceRefs) > 0){
179
		$sourceRefs = '<span class="sources">' . $sourceRefs . '</span>';
180
	}
181

    
182
	if ($source->nameUsedInSource->uuid){ //do a link to name page
183
		$name_used_in_source_link_to_show = l($source->nameUsedInSource->titleCache,
184
		path_to_name($source->nameUsedInSource->uuid),
185
		array(),
186
		NULL, NULL, FALSE ,TRUE);
187
	}else if (strlen($source->nameUsedInSource->originalNameString) > 0){ //show a text without link
188
		$name_used_in_source_link_to_show = $source->nameUsedInSource->originalNameString;
189
	}
190

    
191
	if ($asListElement){
192
		$out = '<li class="descriptionText">' . $name_used_in_source_link_to_show;
193
		//adding ":" if necesary
194
		if ($name_used_in_source_link_to_show && ($description || $sourceRefs)){
195
			$out .= ': ';
196
		}
197
		$out .= $description . $sourceRefs . theme('cdm_annotations_as_footnotekeys', $element) . '</li>';
198
	}else{
199
		if ($name_used_in_source_link_to_show){
200
			$name_used_in_source_link_to_show = ' (name in source: '. $name_used_in_source_link_to_show . ')';
201
		}
202
		$out = $description . $sourceRefs . $name_used_in_source_link_to_show;
203
		$out .= theme('cdm_annotations_as_footnotekeys', $element);
204
	}
205

    
206
	// add annotations as footnote key
207
	//$out .= theme('cdm_annotations_as_footnotekeys', $element); move above
208

    
209
	return $out;
210
}
211

    
212

    
213
function theme_cdm_common_names($elements){
214

    
215
	$out = '';
216
	$separator = ',';
217
	
218
	foreach ($elements as $element){
219
		if ($element->class == 'CommonTaxonName'){
220
			$key = '<b>' . $element->language->representation_L10n . '</b> (' . $element->area->titleCache . ')';
221
			$common_names[$key][] = $element;
222
		}
223
	}
224
	
225
	if (count($common_names) > 0){
226
		//sorting the a-array based on the area (key)
227
		ksort($common_names);
228
		//creating the output to be render by drupal
229
		foreach ($common_names as $key => $elements){
230

    
231
			$rendered_element_list = '';
232
			foreach($elements as $element){
233
				$sourcesFootnoteKeyList = '';
234
				// add footnotes for sources
235
	            foreach($element->sources as $source){
236
	                if(_is_original_source_type($source)){ 
237
	                  $_fkey = FootnoteManager::addNewFootnote(UUID_COMMON_NAME, theme('cdm_DescriptionElementSource', $source, false));
238
	                  $sourcesFootnoteKeyList .= theme('cdm_footnote_key', $_fkey, ($sourcesFootnoteKeyList ? $separator : ''));
239
	                }
240
	            }
241
				$rendered_element_list .= (strlen($rendered_element_list) > 0 ? ', ': '') . $element->name . $sourcesFootnoteKeyList;
242
			}
243
			$out .= (strlen($out) > 0 ? '; ': '') . $key . ': ' . $rendered_element_list;
244
			
245
		}
246
	}
247
	return $out;
248
}
249

    
250
/**
251
 * Theme a list of description elements, usually of a specific feature type
252
 * @param $descriptionElements
253
 * @return unknown_type
254
 */
255
function theme_cdm_descriptionElements($descriptionElements, $featureUuid){
256
	$outArray = array();
257
	$glue = '';
258
	$sortOutArray = false;
259
	$enclosingHtml = 'ul';
260
	$distributionElements = array();
261

    
262
	RenderHints::pushToRenderStack('cdm_descriptionElements');
263
	$common_names = theme('cdm_common_names', $descriptionElements);
264
	foreach($descriptionElements as $descriptionElement){
265

    
266
		if($descriptionElement->feature->uuid == UUID_DISTRIBUTION){
267
			if($descriptionElement->class == 'Distribution'){
268
				$distributionElements[]= $descriptionElement;
269
			} else if($descriptionElement->class == 'TextData'){
270
				$asListElement = false;
271
				$repr = theme ('cdm_descriptionElementTextData', $descriptionElement, $asListElement);
272
					
273
				if( !array_search($repr, $outArray)){
274
					$outArray[] = $repr;
275
					$glue = '<br/> ';
276
					$sortOutArray = true;
277
					$enclosingHtml = 'p';
278
				}
279
			}
280
		} else if($descriptionElement->class == 'TextData'){
281
			$asListElement = true;
282
			$outArray[] = theme('cdm_descriptionElementTextData', $descriptionElement, $asListElement);
283
		}else if ($descriptionElement->class == 'CommonTaxonName') {
284
			$outArray[] = theme('cdm_descriptionElement_CommonTaxonName', $descriptionElement);
285
		} else {
286
			$outArray[] = '<li>No method for rendering unknown description class: '.$descriptionElement->classType.'</li>';
287
		}
288

    
289
	}
290

    
291
	$outArray[] = theme('cdm_descriptionElementDistribution', $distributionElements);
292

    
293
	// take the feature of the last $descriptionElement
294
	$feature = $descriptionElement->feature;
295
	$out = theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
296

    
297
	RenderHints::popFromRenderStack();
298
	 
299
	return $out;
300
}
301

    
302
/**
303
 *
304
 * @param unknown_type $descriptionElements
305
 * @return unknown_type
306
 */
307
function theme_cdm_descriptionElementDistribution($descriptionElements){
308

    
309
	$out = '';
310
	$separator = ',';
311
	RenderHints::pushToRenderStack('descriptionElementDistribution');
312
	RenderHints::setFootnoteListKey(UUID_DISTRIBUTION);
313
	foreach($descriptionElements as $descriptionElement){
314
		// annotations as footnotes
315
		//$annotationFootnoteKeys = theme('cdm_annotations_as_footnotekeys', $descriptionElement);
316
		$footNoteKeys = cdm_annotations_as_footnotekeys($descriptionElement);
317
		
318
		// source references as footnotes
319
		foreach($descriptionElement->sources as $source){
320
			if(_is_original_source_type($source)){
321
			    $footNoteKeys[] = FootnoteManager::addNewFootnote(RenderHints::getFootnoteListKey(), theme('cdm_DescriptionElementSource', $source, false));
322
			}
323
		}
324
		// sort and render footnote keys
325
		$footnoteKeyListStr = '';
326
		asort($footNoteKeys);
327
        foreach($footNoteKeys as $footNoteKey){
328
			$footnoteKeyListStr .= theme('cdm_footnote_key', $footNoteKey, ($footnoteKeyListStr ? $separator : ''));
329
        }
330
		
331
        
332
		$out .= '<span class="descriptionElement descriptionElement-'.$descriptionElement->uuid.'">'.$descriptionElement->area->representation_L10n . $footnoteKeyListStr . ' </span>';
333
	}
334

    
335
	$out = substr($out, 0, strlen($out)-strlen($separator) );
336

    
337
	RenderHints::popFromRenderStack();
338
	return $out;
339

    
340
}
341

    
342

    
343
function theme_cdm_DescriptionElementSource($descriptionElementSource, $doLink = TRUE){
344

    
345
	$out = theme('cdm_reference', $descriptionElementSource->citation, $descriptionElementSource->citationMicroReference, $doLink);
346

    
347
	// add annotations as footnote key
348
	// $out .= theme('cdm_annotations_as_footnotekeys', $descriptionElementSource->citation);
349
	return $out;
350
}
351

    
352
/**
353
 * TODO
354
 * Quick-and-dirty solution to show distribution service to exemplar groups
355
 *
356
 * @param unknown_type $featureTo
357
 * @return unknown
358
 */
359
function theme_cdm_distribution_map($taxon){
360

    
361
	$fontStyles = array(0 => "plane", 1 => "italic");
362
	$server = variable_get('cdm_dataportal_geoservice_access_point', false);
363

    
364
	if(!server){
365
		return "<p>No geoservice specified</p>";
366
	}else{
367
		$map_data_parameters = cdm_ws_get(CDM_WS_GEOSERVICE_DISTRIBUTIONMAP, $taxon->uuid);
368

    
369
		//		$map_data_parameters->String = str_replace(':', "%58", $map_data_parameters->String);
370
		//		$map_data_parameters->String = str_replace(':', "%20", $map_data_parameters->String);
371
		//		$map_data_parameters->String = str_replace('(', "", $map_data_parameters->String);
372
		//		$map_data_parameters->String = str_replace(')', "", $map_data_parameters->String);
373
		//      $map_data_parameters->String = str_replace('.', "%46", $map_data_parameters->String);
374
		$map_data_parameters->String = str_replace('%3A', ":", $map_data_parameters->String);
375

    
376

    
377
		$display_width = variable_get('cdm_dataportal_geoservice_display_width', false);
378
		$bounding_box = variable_get('cdm_dataportal_geoservice_bounding_box', false);
379
		$labels_on = variable_get('cdm_dataportal_geoservice_labels_on', 0);
380

    
381
		$query_string = ($display_width ? '&img=false&ms=' . $display_width: '')
382
		. ($bounding_box ? '&bbox=' .  $bounding_box : '')
383
		. ($labels_on ? '&labels=' .  $labels_on : '');
384

    
385
		if(variable_get('cdm_dataportal_map_openlayers', 1)){
386
			// embed into openlayers viewer
387
			if (variable_get('cdm_dataportal_geoservice_legend_on', TRUE)){
388
				$query_string .= '&legend=1&mlp=3';
389
			}
390
				
391
			$map_tdwg_Uri = url($server. '/areas.php?' .$map_data_parameters->String, $query_string);
392
				
393
			$legend_url_font_size = variable_get('cdm_dataportal_geoservice_legend_font_size', 10);
394
			$legend_url_font_style = variable_get('cdm_dataportal_geoservice_legend_font_style', 1);
395
			$legend_url_font_style = $fontStyles[$legend_url_font_style];
396
			$legend_url_icon_width  = variable_get('cdm_dataportal_geoservice_legend_icon_width', 35);
397
			$legend_url_icon_height = variable_get('cdm_dataportal_geoservice_legend_icon_height', 15);
398

    
399
			//print($map_tdwg_Uri.'<br>');
400

    
401
			// get the respone from the map service
402
			$responseObj = cdm_ws_get($map_tdwg_Uri, null, null, "GET", TRUE);
403
			$responseObj = $responseObj[0];
404

    
405
			$geoserver_uri = $responseObj->geoserver;
406
			// get the sld files from the response object
407
			if(isset($responseObj->layers)){
408
				if(isset($responseObj->legend)){
409

    
410
					$sldLegend=$responseObj->legend;
411
					$legend_url  = $geoserver_uri . "/GetLegendGraphic?SERVICE=WMS&VERSION=1.1.1&format=image".urlencode('/')."png&TRANSPARENT=TRUE";
412
					$legend_url .= "&WIDTH=".$legend_url_icon_width."&HEIGHT=".$legend_url_icon_height."&";
413
					$legend_url .="layer=topp".urlencode(':')."tdwg_level_4&LEGEND_OPTIONS=forceLabels".urlencode(':')."on;fontStyle".urlencode(':').$legend_url_font_style.";fontSize".urlencode(':').$legend_url_font_size."&SLD=".urlencode($sldLegend);
414
				}
415
				$layerSlds = $responseObj->layers;
416
				foreach($layerSlds as $layer){
417
					$tdwg_sldUris[$layer->tdwg] = $layer->sld;
418
					//#print($tdwg_sldUris[$layer->tdwg].'<br>');
419
				}
420
			}
421
			// get the bbox from the response object
422
			$zoomto_bbox = ($bounding_box ? $bounding_box : ($responseObj->bbox ? $responseObj->bbox :'-180, -90, 180, 90') );
423

    
424
			$add_tdwg1 = (isset($tdwg_sldUris['tdwg1']) ? "
425
          tdwg_1.params.SLD = '".$tdwg_sldUris['tdwg1']."';
426
          map.addLayers([tdwg_1]);" : '');
427
			$add_tdwg2 = (isset($tdwg_sldUris['tdwg2']) ? "
428
          tdwg_2.params.SLD = '".$tdwg_sldUris['tdwg2']."';
429
          map.addLayers([tdwg_2]);" : '');
430
			$add_tdwg3 = (isset($tdwg_sldUris['tdwg3']) ? "
431
          tdwg_3.params.SLD = '".$tdwg_sldUris['tdwg3']."';
432
          map.addLayers([tdwg_3]);" : '');
433
			$add_tdwg4 = (isset($tdwg_sldUris['tdwg4']) ? "
434
          tdwg_4.params.SLD = '".$tdwg_sldUris['tdwg4']."';
435
          map.addLayers([tdwg_4]);" : '');
436

    
437
			//      $googleMapsApiKey_localhost = 'ABQIAAAAFho6eHAcUOTHLmH9IYHAeBRi_j0U6kJrkFvY4-OX2XYmEAa76BTsyMmEq-tn6nFNtD2UdEGvfhvoCQ';
438
			//      drupal_set_html_head(' <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$googleMapsApiKey_localhost.'"></script>');
439

    
440
			/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
441
			 * OpenLayers.js must be loaded BEFORE jQuery.
442
			 * If jQuery loaded before $.something will fail in IE8.
443
			 * Therefore we add OpenLayers.js it in the page.tpl.php
444
			 * -----------------------------------------------------
445
			 * Andreas Kohlbecker [Feb 25th 2010]:
446
			 * This problems seems to be solved somehow (a bugfix in IE8?)
447
			 * so I am removing this "hack" by uncommenting the line below
448
			 */
449
			drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/OpenLayers/OpenLayers.js', 'core', 'header');
450
			drupal_add_js('
451
 var map;
452
 
453
 var layerOptions = {
454
     maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
455
     isBaseLayer: false,
456
     displayInLayerSwitcher: false
457
  };
458
 
459
 var tdwg_1 = new OpenLayers.Layer.WMS.Untiled( 
460
    "tdwg level 1", 
461
    "'.$geoserver_uri.'/wms",
462
    {layers:"topp:tdwg_level_1",transparent:"true", format:"image/png"},
463
    layerOptions
464
  );
465
  
466
 var tdwg_2 = new OpenLayers.Layer.WMS.Untiled( 
467
    "tdwg level 2", 
468
    "'.$geoserver_uri.'/wms",
469
    {layers:"topp:tdwg_level_2",transparent:"true", format:"image/png"},
470
    layerOptions
471
  );
472
  
473
 var tdwg_3 = new OpenLayers.Layer.WMS.Untiled( 
474
    "tdwg level 3", 
475
    "'.$geoserver_uri.'/wms",
476
    {layers:"topp:tdwg_level_3", transparent:"true", format:"image/png"},
477
    layerOptions
478
  );
479
  
480
  var tdwg_4 = new OpenLayers.Layer.WMS.Untiled( 
481
    "tdwg level 4", 
482
    "'.$geoserver_uri.'/wms",
483
    {layers:"topp:tdwg_level_4",transparent:"true", format:"image/png"},
484
    layerOptions
485
  );
486
  
487
 // make baselayer
488
 layerOptions[\'isBaseLayer\'] = true; 
489
 
490
 var ol_wms = new OpenLayers.Layer.WMS( 
491
    "OpenLayers WMS",
492
    "http://labs.metacarta.com/wms/vmap0",
493
    {layers: \'basic\'}, 
494
    layerOptions
495
  );
496
  
497
  
498
  // ------------------------------
499
  
500
  
501
 function init() {
502
 
503
   var mapOptions={
504
     controls: 
505
       [ 
506
         new OpenLayers.Control.PanZoom(),
507
         new OpenLayers.Control.Navigation({zoomWheelEnabled: false, handleRightClicks:true, zoomBoxKeyMask: OpenLayers.Handler.MOD_CTRL})
508
       ],
509
       maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
510
       maxResolution: '.(360 / $display_width).',
511
       restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
512
       projection: new OpenLayers.Projection("EPSG:4326")
513
    };
514
   
515
   map = new OpenLayers.Map(\'openlayers_map\', mapOptions);
516
   map.addLayers([ol_wms]);
517
   '.$add_tdwg1.'
518
   '.$add_tdwg2.'
519
   '.$add_tdwg3.'
520
   '.$add_tdwg4.'
521
   map.zoomToExtent(new OpenLayers.Bounds('.$zoomto_bbox.'), false);
522
 }
523
 
524
$(document).ready(function(){
525
  init();
526
  $(\'#openlayers_legend\').css(\'top\', -$(\'#openlayers_map\').height());
527
  $(\'#openlayers_legend\').css(\'left\', $(\'#openlayers_map\').width()-100);
528
});'
529
			, 'inline');
530
			// showing openlayers
531
			$out = '<div id="openlayers">';
532
			$out .= '<div id="openlayers_map" class="smallmap" style="width: '.$display_width.'px; height:'.($display_width / 2).'px"></div>';
533
			// showing lengeds
534
			if (variable_get('cdm_dataportal_geoservice_legend_on', TRUE)){
535
				$out .= '<div id="openlayers_legend"><img id="legend" src="'.$legend_url.'"></div>';
536
			}
537
			// showing map caption
538
			$out .= '<div class="distribution_map_caption">' . variable_get('cdm_dataportal_geoservice_map_caption', '') . '</div>' . '<br>';
539
			$out .= '</div>';
540

    
541
		} else {
542
			// simple image
543
			$mapStaticCaption = '&mc_s=Georgia,15,blue&mc=' . variable_get('cdm_dataportal_geoservice_map_caption', '');
544
			$query_string .= '&img=true&legend=1&mlp=3' . $mapStaticCaption . '&recalculate=false';
545
			$mapUri = url($server. '/areas.php?' .$map_data_parameters->String, $query_string);
546
			$out .= '<img class="distribution_map" src="' . $mapUri . '" alt="Distribution Map" />';
547
		}
548
		/*
549
		 // add a simple legend
550
		 if(variable_get('cdm_dataportal_geoservice_legend_on', TRUE)){
551
			$legenddata = array(
552
			'native' => "4daf4a",
553
			'native_doubtfully_native' => "377eb8",
554
			'cultivated' => "984ea3",
555
			'introduced' => "ff7f00",
556
			'introduced adventitious' => "ffff33",
557
			'introduced cultivated' => "a65628",
558
			'introduced naturalized' => "f781bf"
559
			);
560

    
561
			$out .= '<div class="distribution_map_legend">';
562
			foreach($legenddata as $term => $color){
563
			$out .= '<img style="width: 3em; height: 1em; background-color: #'.$color.'" src="'.
564
			drupal_get_path('module', 'cdm_dataportal').'/images/clear.gif" />'.t($term).' ';
565
			}
566
			$out .= '</div>';
567

    
568
			}
569
			*/
570
		return $out;
571
	}
572
}
(2-2/8)