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
|
|
46
|
foreach($mergedTrees as &$mTree){
|
47
|
//TODO diplay title and reference in case of multiple $mergedTrees -> theme
|
48
|
$out .= theme('cdm_feature_nodes', $mTree->root->children, $taxon);
|
49
|
}
|
50
|
return $out;
|
51
|
}
|
52
|
|
53
|
|
54
|
|
55
|
function theme_cdm_featureTreeTOCs($mergedTrees){
|
56
|
|
57
|
if(!$mergedTrees){
|
58
|
return;
|
59
|
}
|
60
|
//FIXME
|
61
|
$out = '<div class="featureTOC">';
|
62
|
$out .= '<h2>' . t('Content') .'</h2>';
|
63
|
|
64
|
//TODO diplay title and reference in case of multiple $mergedTrees -> theme
|
65
|
|
66
|
foreach($mergedTrees as &$mTree){
|
67
|
$out .= theme('cdm_feature_nodesTOC', $mTree->root->children);
|
68
|
}
|
69
|
|
70
|
$out .= '</div>';
|
71
|
return $out;
|
72
|
}
|
73
|
|
74
|
|
75
|
|
76
|
function theme_cdm_feature_nodes($featureNodes, $taxon){
|
77
|
|
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
|
$block->content = theme('cdm_descriptionElements', $node->descriptionElements, $node->feature->uuid);
|
95
|
// get media for the feature block
|
96
|
$media_list = cdm_dataportal_media_from_descriptionElements($node->descriptionElements);
|
97
|
$captionElements = array('title', 'rights');
|
98
|
//$block->content .= theme('cdm_media_gallerie', $media_list, "test", 150, 4, false, $captionElements);
|
99
|
$block->content .= theme('cdm_media_gallery', $media_list,
|
100
|
CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME.'_'.$node->feature->uuid,
|
101
|
$gallery_settings['cdm_dataportal_media_maxextend'],
|
102
|
$gallery_settings['cdm_dataportal_media_cols'],
|
103
|
$gallery_settings['cdm_dataportal_media_maxRows'],
|
104
|
$captionElements);
|
105
|
|
106
|
// set anchor; FIXME put anchor in $block->subject
|
107
|
$out .= '<a name="'.$block->delta.'"></a>';
|
108
|
$out .= theme('block', $block);
|
109
|
|
110
|
// TODO HACK
|
111
|
if($node->feature->uuid == UUID_DISTRIBUTION){
|
112
|
$out .= theme('cdm_descriptionElements_distribution', $taxon);
|
113
|
}
|
114
|
}
|
115
|
}
|
116
|
// theme
|
117
|
if(count($node->children) > 0){
|
118
|
$out .= '<div class="nested_description_elements">';
|
119
|
$out .= theme('cdm_feature_nodes', $node->children, $taxon);
|
120
|
$out .= '</div>';
|
121
|
}
|
122
|
}
|
123
|
return $out;
|
124
|
}
|
125
|
|
126
|
|
127
|
|
128
|
|
129
|
function theme_cdm_descriptionElementArray($elementArray, $feature, $glue = '', $sortArray = false, $enclosingHtml = 'ul'){
|
130
|
$out = '<'.$enclosingHtml.' class="description" id="'.$feature->representation_L10n.'">';
|
131
|
|
132
|
if($sortArray) sort($elementArray);
|
133
|
|
134
|
$out .= join($elementArray, $glue);
|
135
|
|
136
|
$out .= '</'.$enclosingHtml.'>';
|
137
|
return $out;
|
138
|
}
|
139
|
|
140
|
/**
|
141
|
* TODO: assign a new name to the function? because it is used for the citations
|
142
|
* textdata elements and not for all text data description elements
|
143
|
* @param $element The description element which contains the text information
|
144
|
* @param $asListElement A boolean which determines whether the citations should
|
145
|
* be renderer as a list or not
|
146
|
* @return unknown_type Html to be renderized in drupal
|
147
|
*/
|
148
|
function theme_cdm_descriptionElementTextData($element, $asListElement){
|
149
|
|
150
|
$description = str_replace("\n", "<br/>", $element->multilanguageText_L10n->text);
|
151
|
$sourceRefs = '';
|
152
|
$result = array();
|
153
|
$res_text;
|
154
|
$res_author;
|
155
|
$res_date;
|
156
|
|
157
|
foreach($element->sources as $source){
|
158
|
$referenceCitation = theme('cdm_DescriptionElementSource', $source);
|
159
|
if($description && strlen($description) > 0 && $referenceCitation ){
|
160
|
$sourceRefs .= ' ('.$referenceCitation.')' ;
|
161
|
}else if ($referenceCitation){
|
162
|
$sourceRefs = $referenceCitation;
|
163
|
}
|
164
|
}
|
165
|
if(strlen($sourceRefs) > 0){
|
166
|
$sourceRefs = '<span class="sources">' . $sourceRefs . '</span>';
|
167
|
}
|
168
|
/*
|
169
|
$out = l('<span class="reference">'.$reference.'</span>'
|
170
|
, path_to_reference($descriptionElementSource->citation->uuid)
|
171
|
, array("class"=>"reference")
|
172
|
, NULL, NULL, FALSE ,TRUE);
|
173
|
*/
|
174
|
if ($source->nameUsedInSource->uuid){ //do a link to name page
|
175
|
$name_used_in_source_link_to_show = l($source->nameUsedInSource->titleCache,
|
176
|
path_to_name($source->nameUsedInSource->uuid),
|
177
|
array(),
|
178
|
NULL, NULL, FALSE ,TRUE);
|
179
|
}else if (strlen($source->nameUsedInSource->originalNameString) > 0){ //show a text without link
|
180
|
$name_used_in_source_link_to_show = $source->nameUsedInSource->originalNameString;
|
181
|
}
|
182
|
|
183
|
if ($asListElement){
|
184
|
$res_text = '<li class="descriptionText">' . $name_used_in_source_link_to_show;
|
185
|
//adding ":" if necesary
|
186
|
if ($name_used_in_source_link_to_show && ($description || $sourceRefs)){
|
187
|
$res_text .= ': ';
|
188
|
}
|
189
|
$res_text .= $description . $sourceRefs . '</li>';
|
190
|
}else{
|
191
|
$res_text = $description . $sourceRefs . ' (name in source: '. $name_used_in_source_link_to_show . ')';
|
192
|
}
|
193
|
return $res_text;
|
194
|
}
|
195
|
|
196
|
|
197
|
/**
|
198
|
* Theme a list of description elements, usually of a specific feature type
|
199
|
* @param $descriptionElements
|
200
|
* @return unknown_type
|
201
|
*/
|
202
|
function theme_cdm_descriptionElements($descriptionElements, $featureUuid){
|
203
|
$outArray = array();
|
204
|
$glue = '';
|
205
|
$sortOutArray = false;
|
206
|
$enclosingHtml = 'ul';
|
207
|
$distributionElements = array();
|
208
|
|
209
|
foreach($descriptionElements as $descriptionElement){
|
210
|
|
211
|
if($descriptionElement->feature->uuid == UUID_DISTRIBUTION){
|
212
|
if($descriptionElement->class == 'Distribution'){
|
213
|
$distributionElements[]= $descriptionElement;
|
214
|
} else if($descriptionElement->class == 'TextData'){
|
215
|
$asListElement = false;
|
216
|
$repr = theme ('cdm_descriptionElementTextData', $descriptionElement, $asListElement);
|
217
|
|
218
|
if( !array_search($repr, $outArray)){
|
219
|
$outArray[] = $repr;
|
220
|
$glue = '<br/> ';
|
221
|
$sortOutArray = true;
|
222
|
$enclosingHtml = 'p';
|
223
|
}
|
224
|
}
|
225
|
} else if($descriptionElement->class == 'TextData'){
|
226
|
$asListElement = true;
|
227
|
$outArray[] = theme('cdm_descriptionElementTextData', $descriptionElement, $asListElement);
|
228
|
} else {
|
229
|
$outArray[] = '<li>No method for rendering unknown description class: '.$descriptionElement->classType.'</li>';
|
230
|
}
|
231
|
|
232
|
}
|
233
|
|
234
|
$outArray[] = theme('cdm_descriptionElementDistribution', $distributionElements);
|
235
|
|
236
|
|
237
|
// take the feature of the last $descriptionElement
|
238
|
$feature = $descriptionElement->feature;
|
239
|
$out = theme('cdm_descriptionElementArray', $outArray, $feature, $glue, $sortOutArray, $enclosingHtml);
|
240
|
$out .= '<div class="footnote_list">'. FootnoteManager::renderFootnoteList($featureUuid) . '</div>';
|
241
|
return $out;
|
242
|
}
|
243
|
|
244
|
/**
|
245
|
*
|
246
|
* @param unknown_type $descriptionElements
|
247
|
* @return unknown_type
|
248
|
*/
|
249
|
function theme_cdm_descriptionElementDistribution($descriptionElements){
|
250
|
|
251
|
$out = '';
|
252
|
$separator = ', ';
|
253
|
|
254
|
foreach($descriptionElements as $descriptionElement){
|
255
|
//$footnoteKey = FootnoteManager::addNewFootnote($descriptionElement->feature->uuid, $descriptionElement->area->representation_L10n);
|
256
|
$footnoteKeyList = '';
|
257
|
foreach($descriptionElement->sources as $source){
|
258
|
break;
|
259
|
$footnoteKey = FootnoteManager::addNewFootnote($descriptionElement->feature->uuid, $source, 'cdm_DescriptionElementSource');
|
260
|
$footnoteKeyList .= theme('cdm_footnode_key', $footnoteKey) . ' ';
|
261
|
}
|
262
|
$out .= $descriptionElement->area->representation_L10n . $footnoteKeyList . $separator;
|
263
|
}
|
264
|
$out = substr($out, 0, strlen($out)-strlen($separator) );
|
265
|
|
266
|
$taxonTrees = cdm_ws_get(CDM_WS_PORTAL_TAXONOMY);
|
267
|
foreach($taxonTrees as $taxonTree){
|
268
|
if ($taxonTree -> uuid == variable_get('cdm_taxonomictree_uuid', FALSE)){
|
269
|
$reference = $taxonTree-> reference;
|
270
|
break;
|
271
|
}
|
272
|
}
|
273
|
|
274
|
// $referenceCitation = l('<span class="reference">('.$reference->title.')</span>', path_to_reference($reference->uuid), array("class"=>"reference"), NULL, NULL, FALSE ,TRUE);
|
275
|
// if($descriptions && strlen($descriptions) > 0 ){
|
276
|
// $sourceRefs .= ' '.$referenceCitation;
|
277
|
// }
|
278
|
|
279
|
return $out;
|
280
|
|
281
|
}
|
282
|
|
283
|
|
284
|
function theme_cdm_DescriptionElementSource($descriptionElementSource, $doLink = TRUE){
|
285
|
|
286
|
//ev. delegate to theme_cdm_ReferencedEntityBase
|
287
|
$out = '';
|
288
|
if($descriptionElementSource->citation){
|
289
|
$reference = $descriptionElementSource->citation->titleCache;
|
290
|
if($doLink){
|
291
|
$out = l('<span class="reference">'.$reference.'</span>'
|
292
|
, path_to_reference($descriptionElementSource->citation->uuid)
|
293
|
, array("class"=>"reference")
|
294
|
, NULL, NULL, FALSE ,TRUE);
|
295
|
} else {
|
296
|
$out = $reference;
|
297
|
}
|
298
|
if($descriptionElementSource->citationMicroReference){
|
299
|
$out .= ': '. $descriptionElementSource->citationMicroReference;
|
300
|
}
|
301
|
}
|
302
|
return $out;
|
303
|
}
|
304
|
|
305
|
/**
|
306
|
* TODO
|
307
|
* Quick-and-dirty solution to show distribution service to exemplar groups
|
308
|
*
|
309
|
* @param unknown_type $featureTo
|
310
|
* @return unknown
|
311
|
*/
|
312
|
function theme_cdm_descriptionElements_distribution($taxon){
|
313
|
|
314
|
$fontStyles = array(0 => "plane", 1 => "italic");
|
315
|
$server = variable_get('cdm_dataportal_geoservice_access_point', false);
|
316
|
|
317
|
if(!server){
|
318
|
return "<p>No geoservice specified</p>";
|
319
|
}else{
|
320
|
$map_data_parameters = cdm_ws_get(CDM_WS_GEOSERVICE_DISTRIBUTIONMAP, $taxon->uuid);
|
321
|
|
322
|
$display_width = variable_get('cdm_dataportal_geoservice_display_width', false);
|
323
|
$bounding_box = variable_get('cdm_dataportal_geoservice_bounding_box', false);
|
324
|
$labels_on = variable_get('cdm_dataportal_geoservice_labels_on', 0);
|
325
|
|
326
|
$query_string = ($display_width ? '&ms=' . $display_width: '')
|
327
|
. ($bounding_box ? '&bbox=' . $bounding_box : '')
|
328
|
. ($labels_on ? '&labels=' . $labels_on : '');
|
329
|
|
330
|
if(variable_get('cdm_dataportal_map_openlayers', 1)){
|
331
|
// embed into openlayers viewer
|
332
|
if (variable_get('cdm_dataportal_geoservice_legend_on', TRUE)){
|
333
|
$query_string .= '&img=false&legend=1&mlp=3';
|
334
|
}
|
335
|
$map_data_parameters->String = str_replace(': ', "%20", $map_data_parameters->String);
|
336
|
$map_data_parameters->String = str_replace('(', "", $map_data_parameters->String);
|
337
|
$map_data_parameters->String = str_replace(')', "", $map_data_parameters->String);
|
338
|
$map_tdwg_Uri = url($server. '/areas.php?' .$map_data_parameters->String, $query_string);
|
339
|
$legend_url_font_size = variable_get('cdm_dataportal_geoservice_legend_font_size', 10);
|
340
|
$legend_url_font_style = variable_get('cdm_dataportal_geoservice_legend_font_style', 1);
|
341
|
$legend_url_font_style = $fontStyles[$legend_url_font_style];
|
342
|
$legend_url_icon_width = variable_get('cdm_dataportal_geoservice_legend_icon_width', 35);
|
343
|
$legend_url_icon_height = variable_get('cdm_dataportal_geoservice_legend_icon_height', 15);
|
344
|
|
345
|
print($map_tdwg_Uri.'<br>');
|
346
|
|
347
|
// get the respone from the map service
|
348
|
$responseObj = cdm_ws_get($map_tdwg_Uri, null, null, "GET", TRUE);
|
349
|
$responseObj = $responseObj[0];
|
350
|
|
351
|
$geoserver_uri = $responseObj->geoserver;
|
352
|
// get the sld files from the response object
|
353
|
if(isset($responseObj->layers)){
|
354
|
if(isset($responseObj->legend)){
|
355
|
|
356
|
$sldLegend=$responseObj->legend;
|
357
|
$legend_url = $geoserver_uri . "/GetLegendGraphic?SERVICE=WMS&VERSION=1.1.1&format=image".urlencode('/')."png&TRANSPARENT=TRUE";
|
358
|
$legend_url .= "&WIDTH=".$legend_url_icon_width."&HEIGHT=".$legend_url_icon_height."&";
|
359
|
$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);
|
360
|
}
|
361
|
$layerSlds = $responseObj->layers;
|
362
|
foreach($layerSlds as $layer){
|
363
|
$tdwg_sldUris[$layer->tdwg] = $layer->sld;
|
364
|
//#print($tdwg_sldUris[$layer->tdwg].'<br>');
|
365
|
}
|
366
|
}
|
367
|
// get the bbox from the response object
|
368
|
$zoomto_bbox = ($bounding_box ? $bounding_box : ($responseObj->bbox ? $responseObj->bbox :'-180, -90, 180, 90') );
|
369
|
|
370
|
$add_tdwg1 = (isset($tdwg_sldUris['tdwg1']) ? "
|
371
|
tdwg_1.params.SLD = '".$tdwg_sldUris['tdwg1']."';
|
372
|
map.addLayers([tdwg_1]);" : '');
|
373
|
$add_tdwg2 = (isset($tdwg_sldUris['tdwg2']) ? "
|
374
|
tdwg_2.params.SLD = '".$tdwg_sldUris['tdwg2']."';
|
375
|
map.addLayers([tdwg_2]);" : '');
|
376
|
$add_tdwg3 = (isset($tdwg_sldUris['tdwg3']) ? "
|
377
|
tdwg_3.params.SLD = '".$tdwg_sldUris['tdwg3']."';
|
378
|
map.addLayers([tdwg_3]);" : '');
|
379
|
$add_tdwg4 = (isset($tdwg_sldUris['tdwg4']) ? "
|
380
|
tdwg_4.params.SLD = '".$tdwg_sldUris['tdwg4']."';
|
381
|
map.addLayers([tdwg_4]);" : '');
|
382
|
|
383
|
// $googleMapsApiKey_localhost = 'ABQIAAAAFho6eHAcUOTHLmH9IYHAeBRi_j0U6kJrkFvY4-OX2XYmEAa76BTsyMmEq-tn6nFNtD2UdEGvfhvoCQ';
|
384
|
// drupal_set_html_head(' <script src="http://maps.google.com/maps?file=api&v=2&key='.$googleMapsApiKey_localhost.'"></script>');
|
385
|
|
386
|
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
387
|
* OpenLayers.js must be loaded BEFORE jQuery.
|
388
|
* If jQuery loaded before $.something will fail in IE8.
|
389
|
* Therefore we add OpenLayers.js it in the page.tpl.php
|
390
|
* -----------------------------------------------------
|
391
|
* Andreas Kohlbecker [Feb 25th 2010]:
|
392
|
* This problems seems to be solved somehow (a bugfix in IE8?)
|
393
|
* so I am removing this "hack" by uncommenting the line below
|
394
|
*/
|
395
|
drupal_add_js(drupal_get_path('module', 'cdm_dataportal').'/js/OpenLayers/OpenLayers.js', 'core', 'header');
|
396
|
drupal_add_js('
|
397
|
var map;
|
398
|
|
399
|
var layerOptions = {
|
400
|
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
|
401
|
isBaseLayer: false,
|
402
|
displayInLayerSwitcher: false
|
403
|
};
|
404
|
|
405
|
var tdwg_1 = new OpenLayers.Layer.WMS.Untiled(
|
406
|
"tdwg level 1",
|
407
|
"'.$geoserver_uri.'/wms",
|
408
|
{layers:"topp:tdwg_level_1",transparent:"true", format:"image/png"},
|
409
|
layerOptions
|
410
|
);
|
411
|
|
412
|
var tdwg_2 = new OpenLayers.Layer.WMS.Untiled(
|
413
|
"tdwg level 2",
|
414
|
"'.$geoserver_uri.'/wms",
|
415
|
{layers:"topp:tdwg_level_2",transparent:"true", format:"image/png"},
|
416
|
layerOptions
|
417
|
);
|
418
|
|
419
|
var tdwg_3 = new OpenLayers.Layer.WMS.Untiled(
|
420
|
"tdwg level 3",
|
421
|
"'.$geoserver_uri.'/wms",
|
422
|
{layers:"topp:tdwg_level_3", transparent:"true", format:"image/png"},
|
423
|
layerOptions
|
424
|
);
|
425
|
|
426
|
var tdwg_4 = new OpenLayers.Layer.WMS.Untiled(
|
427
|
"tdwg level 4",
|
428
|
"'.$geoserver_uri.'/wms",
|
429
|
{layers:"topp:tdwg_level_4",transparent:"true", format:"image/png"},
|
430
|
layerOptions
|
431
|
);
|
432
|
|
433
|
// make baselayer
|
434
|
layerOptions[\'isBaseLayer\'] = true;
|
435
|
|
436
|
var ol_wms = new OpenLayers.Layer.WMS(
|
437
|
"OpenLayers WMS",
|
438
|
"http://labs.metacarta.com/wms/vmap0",
|
439
|
{layers: \'basic\'},
|
440
|
layerOptions
|
441
|
);
|
442
|
|
443
|
|
444
|
// ------------------------------
|
445
|
|
446
|
|
447
|
function init() {
|
448
|
|
449
|
var mapOptions={
|
450
|
controls:
|
451
|
[
|
452
|
new OpenLayers.Control.PanZoom(),
|
453
|
new OpenLayers.Control.Navigation({zoomWheelEnabled: false, handleRightClicks:true, zoomBoxKeyMask: OpenLayers.Handler.MOD_CTRL})
|
454
|
],
|
455
|
maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
|
456
|
maxResolution: '.(360 / $display_width).',
|
457
|
restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
|
458
|
projection: new OpenLayers.Projection("EPSG:4326")
|
459
|
};
|
460
|
|
461
|
map = new OpenLayers.Map(\'openlayers_map\', mapOptions);
|
462
|
map.addLayers([ol_wms]);
|
463
|
'.$add_tdwg1.'
|
464
|
'.$add_tdwg2.'
|
465
|
'.$add_tdwg3.'
|
466
|
'.$add_tdwg4.'
|
467
|
map.zoomToExtent(new OpenLayers.Bounds('.$zoomto_bbox.'), false);
|
468
|
}
|
469
|
|
470
|
$(document).ready(function(){
|
471
|
init();
|
472
|
$(\'#openlayers_legend\').css(\'top\', -$(\'#openlayers_map\').height());
|
473
|
$(\'#openlayers_legend\').css(\'left\', $(\'#openlayers_map\').width()-100);
|
474
|
});'
|
475
|
, 'inline');
|
476
|
// showing openlayers
|
477
|
$out = '<div id="openlayers">';
|
478
|
$out .= '<div id="openlayers_map" class="smallmap" style="width: '.$display_width.'px; height:'.($display_width / 2).'px"></div>';
|
479
|
// showing lengeds
|
480
|
if (variable_get('cdm_dataportal_geoservice_legend_on', TRUE)){
|
481
|
$out .= '<div id="openlayers_legend"><img id="legend" src="'.$legend_url.'"></div>';
|
482
|
}
|
483
|
// showing map caption
|
484
|
$out .= '<div class="distribution_map_caption">' . variable_get('cdm_dataportal_geoservice_map_caption', '') . '</div>' . '<br>';
|
485
|
$out .= '</div>';
|
486
|
|
487
|
} else {
|
488
|
// simple image
|
489
|
$mapStaticCaption = '&mc_s=Georgia,15,blue&mc=' . variable_get('cdm_dataportal_geoservice_map_caption', '');
|
490
|
$query_string .= '&img=true&legend=1&mlp=3' . $mapStaticCaption . '&recalculate=false';
|
491
|
$mapUri = url($server. '/areas.php?' .$map_data_parameters->String, $query_string);
|
492
|
$out .= '<img class="distribution_map" src="' . $mapUri . '" alt="Distribution Map" />';
|
493
|
}
|
494
|
/*
|
495
|
// add a simple legend
|
496
|
if(variable_get('cdm_dataportal_geoservice_legend_on', TRUE)){
|
497
|
$legenddata = array(
|
498
|
'native' => "4daf4a",
|
499
|
'native_doubtfully_native' => "377eb8",
|
500
|
'cultivated' => "984ea3",
|
501
|
'introduced' => "ff7f00",
|
502
|
'introduced adventitious' => "ffff33",
|
503
|
'introduced cultivated' => "a65628",
|
504
|
'introduced naturalized' => "f781bf"
|
505
|
);
|
506
|
|
507
|
$out .= '<div class="distribution_map_legend">';
|
508
|
foreach($legenddata as $term => $color){
|
509
|
$out .= '<img style="width: 3em; height: 1em; background-color: #'.$color.'" src="'.
|
510
|
drupal_get_path('module', 'cdm_dataportal').'/images/clear.gif" />'.t($term).' ';
|
511
|
}
|
512
|
$out .= '</div>';
|
513
|
|
514
|
}
|
515
|
*/
|
516
|
return $out;
|
517
|
}
|
518
|
}
|