1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
|
<?php
// Google map module for phpGedView
//
// webtrees: Web based Family History software
// Copyright (C) 2011 webtrees development team.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// $Id$
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
exit;
}
// *** ENABLE STREETVIEW ***
$STREETVIEW=get_module_setting('googlemap', 'GM_USE_STREETVIEW');
?>
<script type="text/javascript">var ie = 0;</script>
<!--[if IE]>
<script type="text/javascript">ie = 1;</script>
<![endif]-->
<script type="text/javascript">
//<![CDATA[
// this variable will collect the html which will eventually be placed in the side_bar
var side_bar_html = '';
var map_center = new google.maps.LatLng(0,0);
var gmarkers = [];
var gicons = [];
var map = null;
var head = '';
var dir = '';
var svzoom = '';
var infowindow = new google.maps.InfoWindow( {
// size: new google.maps.Size(150,50),
// maxWidth: 600
});
<?php
echo 'gicons["red"] = new google.maps.MarkerImage("http://maps.google.com/mapfiles/marker.png",';
echo 'new google.maps.Size(20, 34),';
echo 'new google.maps.Point(0,0),';
echo 'new google.maps.Point(9, 34));';
echo 'var iconImage = new google.maps.MarkerImage("http://maps.google.com/mapfiles/marker.png",';
echo 'new google.maps.Size(20, 34),';
echo 'new google.maps.Point(0,0),';
echo 'new google.maps.Point(9, 34));';
echo 'var iconShadow = new google.maps.MarkerImage("http://www.google.com/mapfiles/shadow50.png",';
echo 'new google.maps.Size(37, 34),';
echo 'new google.maps.Point(0,0),';
echo 'new google.maps.Point(9, 34));';
echo 'var iconShape = {';
echo 'coord: [9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0],';
echo 'type: "poly"';
echo '};';
?>
function getMarkerImage(iconColor) {
if ((typeof(iconColor)=='undefined') || (iconColor==null)) {
iconColor = 'red';
}
if (!gicons[iconColor]) {
gicons[iconColor] = new google.maps.MarkerImage('http://maps.google.com/mapfiles/marker'+ iconColor +'.png',
new google.maps.Size(20, 34),
new google.maps.Point(0,0),
new google.maps.Point(9, 34));
}
return gicons[iconColor];
}
function category2color(category) {
var color = 'red';
switch(category) {
case 'theatre': color = '';
break;
case 'golf': color = '_green';
break;
case 'info': color = '_yellow';
break;
default: color = '';
break;
}
return color;
}
gicons['theatre'] = getMarkerImage(category2color('theatre'));
gicons['golf'] = getMarkerImage(category2color('golf'));
gicons['info'] = getMarkerImage(category2color('info'));
var sv2_bear = null;
var sv2_elev = null;
var sv2_zoom = null;
var placer = null;
// A function to create the marker and set up the event window
function createMarker(i, latlng, event, html, category, placed, index, tab, address, media, sv_lati, sv_long, sv_bearing, sv_elevation, sv_zoom, sv_point, marker_icon) {
var contentString = '<div id="iwcontent">'+html+'<\/div>';
// === Use flag icon (if defined) instead of regular marker icon ===
if (marker_icon) {
var icon_image = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+'googlemap/'+marker_icon,
new google.maps.Size(25, 15),
new google.maps.Point(0,0),
new google.maps.Point(0, 44));
var icon_shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+'googlemap/images/flag_shadow.png',
new google.maps.Size(35, 45), // Shadow size
new google.maps.Point(0,0), // Shadow origin
new google.maps.Point(1, 45) // Shadow anchor is base of flagpole
);
} else {
var icon_image = gicons[category];
var icon_shadow = iconShadow;
}
// === Decide if marker point is Regular (latlng) or StreetView (sv_point) derived ===
if (sv_point == '(0, 0)' || sv_point == '(null, null)') {
placer = latlng;
} else {
placer = sv_point;
}
// === Define the marker ===
var marker = new google.maps.Marker({
position: placer,
icon: icon_image,
shadow: icon_shadow,
map: map,
title: address,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
// === Store the tab, category and event info as marker properties ===
marker.myindex = index;
marker.mytab = tab;
marker.myplaced = placed;
marker.mycategory = category;
marker.myevent = event;
marker.myaddress = address;
marker.mymedia = media;
marker.sv_lati = sv_lati;
marker.sv_long = sv_long;
marker.sv_point = sv_point;
if (sv_bearing == '') {
marker.sv_bearing = 0;
} else {
marker.sv_bearing = sv_bearing;
}
if (sv_elevation == '') {
marker.sv_elevation = 5;
} else {
marker.sv_elevation = sv_elevation;
// marker.sv_elevation = 5;
}
if (sv_zoom == '' || sv_zoom == 0 || sv_zoom == 1) {
marker.sv_zoom = 1.2;
} else {
marker.sv_zoom = sv_zoom;
}
marker.sv_latlng = new google.maps.LatLng(sv_lati, sv_long);
gmarkers.push(marker);
var sv_dir = [];
sv_dir[i] = parseFloat(gmarkers[i].sv_bearing);
var sv_elev = [];
sv_elev[i] = parseFloat(gmarkers[i].sv_elevation);
var sv_zoom = [];
sv_zoom[i] = parseFloat(gmarkers[i].sv_zoom);
// == Open infowindow when marker is clicked ==
google.maps.event.addListener(marker, 'click', function() {
infowindow.close();
infowindow.setContent(contentString);
infowindow.open(map, marker);
var panoramaOptions = {
position: marker.position,
mode: 'html5',
// mode: 'webgl',
navigationControl: false,
linksControl: false,
addressControl: false,
pov: {
heading: sv_dir[i],
pitch: sv_elev[i],
// pitch: 5,
zoom: sv_zoom[i]
}
};
// === Use jquery for info window tabs ===
google.maps.event.addListener(infowindow, 'domready', function(){
//jQuery code here
jQuery('#EV').click(function() {
document.tabLayerEV = eval('document.getElementById("EV")');
document.tabLayerEV.style.background = '#ffffff';
document.tabLayerEV.style.paddingBottom = '1px';
<?php if ($STREETVIEW) { ?>
document.tabLayerSV = eval('document.getElementById("SV")');
document.tabLayerSV.style.background = '#cccccc';
document.tabLayerSV.style.paddingBottom = '0px';
<?php } ?>
// Please leave (windmillway) ==========================================
// document.tabLayerPH = eval('document.getElementById("PH")');
// document.tabLayerPH.style.background = '#cccccc';
// document.tabLayerPH.style.paddingBottom = '0px';
// =====================================================================
document.panelLayer1 = eval('document.getElementById("pane1")');
document.panelLayer1.style.display = 'block';
<?php if ($STREETVIEW) { ?>
document.panelLayer2 = eval('document.getElementById("pane2")');
document.panelLayer2.style.display = 'none';
<?php } ?>
// Please leave (windmillway) ==========================================
// document.panelLayer3 = eval('document.getElementById("pane3")');
// document.panelLayer3.style.display = 'none';
// =====================================================================
});
jQuery('#SV').click(function() {
document.tabLayerEV = eval('document.getElementById("EV")');
document.tabLayerEV.style.background = '#cccccc';
document.tabLayerEV.style.paddingBottom = '0px';
<?php if ($STREETVIEW) { ?>
document.tabLayerSV = eval('document.getElementById("SV")');
document.tabLayerSV.style.background = '#ffffff';
document.tabLayerSV.style.paddingBottom = '1px';
<?php } ?>
// Please leave (windmillway) ==========================================
// document.tabLayerPH = eval('document.getElementById("PH")');
// document.tabLayerPH.style.background = '#cccccc';
// document.tabLayerPH.style.paddingBottom = '0px';
// =====================================================================
document.panelLayer1 = eval('document.getElementById("pane1")');
document.panelLayer1.style.display = 'none';
<?php if ($STREETVIEW) { ?>
document.panelLayer2 = eval('document.getElementById("pane2")');
document.panelLayer2.style.display = 'block';
<?php } ?>
// Please leave (windmillway) ==========================================
// document.panelLayer3 = eval('document.getElementById("pane3")');
// document.panelLayer3.style.display = "none";
// =====================================================================
var panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"), panoramaOptions);
setTimeout(function() { panorama.setVisible(true); }, 100);
setTimeout(function() { panorama.setVisible(true); }, 500);
});
jQuery('#PH').click(function() {
document.tabLayerEV = eval('document.getElementById("EV")');
document.tabLayerEV.style.background = '#cccccc';
document.tabLayerEV.style.paddingBottom = '0px';
<?php if ($STREETVIEW) { ?>
document.tabLayerSV = eval('document.getElementById("SV")');
document.tabLayerSV.style.background = '#cccccc';
document.tabLayerSV.style.paddingBottom = '0px';
<?php } ?>
// Please leave (windmillway) ==========================================
// document.tabLayerPH = eval('document.getElementById("PH")');
// document.tabLayerPH.style.background = '#ffffff';
// document.tabLayerPH.style.paddingBottom = '1px';
// =================================================================
document.panelLayer1 = eval('document.getElementById("pane1")');
document.panelLayer1.style.display = 'none';
<?php if ($STREETVIEW) { ?>
document.panelLayer2 = eval('document.getElementById("pane2")');
document.panelLayer2.style.display = 'none';
<?php } ?>
// Please leave (windmillway) ==========================================
// document.panelLayer3 = eval('document.getElementById("pane3")');
// document.panelLayer3.style.display = 'block';
// =================================================================
});
});
});
}
// == shows all markers of a particular category, and ensures the checkbox is checked ==
function show(category) {
for (var i=0; i<gmarkers.length; i++) {
if (gmarkers[i].mycategory == category) {
gmarkers[i].setVisible(true);
}
}
// == close any info window for clarity
infowindow.close();
}
// == hides all markers of a particular category, and ensures the checkbox is cleared ==
function hide(category) {
for (var i=0; i<gmarkers.length; i++) {
if (gmarkers[i].mycategory == category) {
gmarkers[i].setVisible(false);
}
}
// == close the info window, in case its open on a marker that we just hid
infowindow.close();
}
// == a checkbox has been clicked ==
function boxclick(box,category) {
if (box.checked) {
show(category);
} else {
hide(category);
}
// == rebuild the side bar ==
makeSidebar();
loadMap();
}
// == Opens Marker infowindow when corresponding Sidebar item is clicked ==
function myclick(i, index, tab) {
infowindow.close();
google.maps.event.trigger(gmarkers[i], 'click');
}
// == rebuild sidebar (hidden item) when any marker's infowindow is closed ==
google.maps.event.addListener(infowindow, 'closeclick', function() {
makeSidebar();
});
// == rebuilds the sidebar (hidden item) to match the markers currently displayed ==
function makeSidebar(x) {
var html = '';
//var tab = gmarkers.mytab;
for (var i=0; i<gmarkers.length; i++) {
if (gmarkers[i].getVisible()) {
// if (x==gmarkers[i].myindex) {
if (x==i ) {
html += '<a style="text-decoration:none; color:black; background:white; " href="#" onclick="myclick('+i+', '+gmarkers[i].mytab+')">' + gmarkers[i].myevent + '<\/a><br>';
} else if (gmarkers[i].mycategory=='theatre') {
html += '<a style="text-decoration:none; color:red;" href="#" onclick="myclick('+i+', '+gmarkers[i].mytab+')">' + gmarkers[i].myevent + '<\/a><br>';
} else if (gmarkers[i].mycategory=='golf') {
html += '<a style="text-decoration:none; color:green;" href="#" onclick="myclick('+i+', '+gmarkers[i].mytab+')">' + gmarkers[i].myevent + '<\/a><br>';
} else if (gmarkers[i].mycategory=='info') {
html += '<a style="text-decoration:none; color:yellow;" href="#" onclick="myclick('+i+', '+gmarkers[i].mytab+')">' + gmarkers[i].myevent + '<\/a><br>';
} else {
html += '<a style="text-decoration:none; color:black;" href="#" onclick="myclick('+i+', '+gmarkers[i].mytab+')">'+ gmarkers[i].myevent + '<\/a><br>';
}
}
}
document.getElementById('side_bar').innerHTML = html;
x=null;
}
// Home control ====================================================================
// returns the user to the original map position ... loadMap() function
// This constructor takes the control DIV as an argument.
function HomeControl(controlDiv, map) {
// Set CSS styles for the DIV containing the control
// Setting padding to 5 px will offset the control from the edge of the map
controlDiv.style.paddingTop = '5px';
controlDiv.style.paddingRight = '0px';
// Set CSS for the control border
var controlUI = document.createElement('DIV');
controlUI.style.backgroundColor = 'white';
controlUI.style.borderStyle = 'solid';
controlUI.style.borderWidth = '2px';
controlUI.style.cursor = 'pointer';
controlUI.style.textAlign = 'center';
controlUI.title = '';
controlDiv.appendChild(controlUI);
// Set CSS for the control interior
var controlText = document.createElement('DIV');
controlText.style.fontFamily = 'Arial,sans-serif';
controlText.style.fontSize = '12px';
controlText.style.paddingLeft = '15px';
controlText.style.paddingRight = '15px';
controlText.innerHTML = '<b><?php echo WT_I18N::translate('Redraw map')?><\/b>';
controlUI.appendChild(controlText);
// Setup the click event listeners: simply set the map to original LatLng
google.maps.event.addDomListener(controlUI, 'click', function() {
loadMap();
});
}
function loadMap() {
<?php
global $GOOGLEMAP_MAP_TYPE, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS, $ENABLE_AUTOCOMPLETE, $SHOW_HIGHLIGHT_IMAGES, $WT_IMAGES, $GEDCOM;
?>
// Create the map and mapOptions
var mapOptions = {
zoom: 7,
center: map_center,
mapTypeId: google.maps.MapTypeId.<?php echo $GOOGLEMAP_MAP_TYPE; ?>, // ROADMAP, SATELLITE, HYBRID, TERRAIN
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU // DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR
},
navigationControl: true,
navigationControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT, // BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc
style: google.maps.NavigationControlStyle.SMALL // ANDROID, DEFAULT, SMALL, ZOOM_PAN
},
streetViewControl: false, // Show Pegman or not
scrollwheel: false
};
map = new google.maps.Map(document.getElementById('map_pane'), mapOptions);
// Close any infowindow when map is clicked
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
// == rebuild sidebar (hidden item) ==
makeSidebar();
});
// Create the Home DIV and call the HomeControl() constructor in this DIV.
var homeControlDiv = document.createElement('DIV');
var homeControl = new HomeControl(homeControlDiv, map);
homeControlDiv.index = 1;
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
// Add the markers to the map from the $gmarks array =======
var locations = [
<?php
foreach($gmarks as $gmark) {
// create thumbnail images of highlighted images ===
if (!empty($pid)) {
$this_person = WT_Person::getInstance($pid);
}
if (!empty($gmark['name'])) {
$person = WT_Person::getInstance($gmark['name']);
}
// The current indi ================================
if (!empty($this_person)) {
$class = 'pedigree_image';
if ($gmark['fact'] == 'Census') {
$image = "<img class='icon_cens' src='././images/pix1.gif'>";
} else if ($gmark['fact'] == 'Birth') {
$image = "<img class='icon_birt' src='././images/pix1.gif'>";
} else if ($gmark['fact'] == 'Baptism' || $gmark['fact'] == 'Christening') {
$image = "<img class='icon_bapm' src='././images/pix1.gif'>";
} else if ($gmark['fact'] == 'Military') {
$image = "<img class='icon_mili' src='././images/pix1.gif'>";
} else if ($gmark['fact'] == 'Occupation') {
$image = "<img class='icon_occu' src='././images/pix1.gif'>";
} else if ($gmark['fact'] == 'Residence') {
$image = "<img class='icon_resi' src='././images/pix1.gif'>";
} else if ($gmark['fact'] == 'Death') {
$image = "<img class='icon_deat' src='././images/pix1.gif'>";
} else if ($gmark['fact'] == 'Burial' || $gmark['fact'] == 'Cremation') {
$image = "<img class='icon_buri' src='././images/pix1.gif'>";
} else if ($gmark['fact'] == 'Retirement' ) {
$image = "<img class='icon_reti' src='././images/pix1.gif'>";
} else {
$indirec = $this_person->getGedcomRecord();
$image = '';
if ($SHOW_HIGHLIGHT_IMAGES) {
if (!empty($pid)) {
$object = find_highlighted_object($pid, WT_GED_ID, $indirec);
}
if (!empty($object)) {
$mediaobject=WT_Media::getInstance($object['mid']);
$image=$mediaobject->displayMedia(array('display_type'=>'googlemap'));
} else {
$sex=$this_person->getSex();
$image=display_silhouette(array('sex'=>$sex,'display_type'=>'googlemap')); // may return ''
}
} // end of add image
}
}
// Other people ====================================
if (!empty($person)) {
$indirec2 = $person->getGedcomRecord();
$image2 = '';
if ($SHOW_HIGHLIGHT_IMAGES) {
if (!empty($gmark['name'])) {
$object2 = find_highlighted_object($gmark['name'], WT_GED_ID, $indirec2);
}
if (!empty($object2)) {
$mediaobject=WT_Media::getInstance($object2['mid']);
$image2=$mediaobject->displayMedia(array('display_type'=>'googlemap'));
} else {
$sex=$person->getSex();
$image2=display_silhouette(array('sex'=>$sex,'display_type'=>'googlemap')); // may return ''
}
} // end of add image
}
?>
[
// Elements 0-9. Basic parameters
"<?php echo $gmark['fact'].''; ?>",
"<?php echo $gmark['lati']; ?>",
"<?php echo $gmark['lng']; ?>",
"<?php if (!empty($gmark['date'])) { $date=new WT_Date($gmark['date']); echo addslashes($date->Display(true)); } else { echo WT_I18N::translate('Date not known'); } ?>",
"<?php if (!empty($gmark['info'])) { echo $gmark['info']; } else { echo NULL; } ?>",
"<?php if (!empty($gmark['name'])) { $person=WT_Person::getInstance($gmark['name']); if ($person) { echo '<a href=\"', $person->getHtmlUrl(), '\">', addslashes($person->getFullName()), '<\/a>'; } } ?>",
"<?php if (preg_match('/2 PLAC (.*)/', $gmark['placerec']) == 0) { print_address_structure_map($gmark['placerec'], 1); } else { echo preg_replace('/\"/', '\\\"', print_fact_place_map($gmark['placerec'])); } ?>",
"<?php echo $gmark['index'].''; ?>",
"<?php echo $gmark['tabindex'].''; ?>",
"<?php echo $gmark['placed'].''; ?>",
// Element 10. location marker tooltip - extra printable item for marker title.
"<?php echo strip_tags(preg_replace('/\"/', '\\\"', print_fact_place_map($gmark['placerec']))); ?>",
// Element 11. persons Name
"<?php if (!empty($gmark['name'])) { $person=WT_Person::getInstance($gmark['name']); if ($person) { echo addslashes($person->getFullName()); } } ?>",
// Element 12. Other people's Highlighted image.
"<?php if (!empty($gmark['name'])) { echo $image2; } else { echo ''; } ?>",
// Element 13. This Individual's Highlighted image.
"<?php if (!empty($pid)) { echo $image; } else { echo ''; } ?>",
// Elements 14-20 Streetview parameters
"<?php if (!empty($gmark['media'])) { echo $gmark['media']; } ?>",
"<?php if (!empty($gmark['sv_lati'])) { echo $gmark['sv_lati']; } ?>",
"<?php if (!empty($gmark['sv_long'])) { echo $gmark['sv_long']; } ?>",
"<?php if (!empty($gmark['sv_bearing'])) { echo $gmark['sv_bearing']; } ?>",
"<?php if (!empty($gmark['sv_elevation'])) { echo $gmark['sv_elevation']; } ?>",
"<?php if (!empty($gmark['sv_zoom'])) { echo $gmark['sv_zoom']; } ?>",
"<?php if (!empty($gmark['icon'])) { echo $gmark['icon']; } ?>"
],
<?php } ?>
];
// Fix IE bug reporting one too many in locations.length statement =====
if (ie==1) {
locations.length=locations.length - 1;
}
// Set the Marker bounds ===============================================
var bounds = new google.maps.LatLngBounds ();
// Calculate tabs to be placed for each marker =========================
var np = new Array();
var numtabs = new Array();
var npo = new Array();
for (var p = 0; p < locations.length; p++) {
np[p] = ''+p+'';
numtabs[p] = 0;
npo[p] = new Array();
for (var q = 0; q < locations.length; q++) {
if (jQuery.inArray(np[p], locations[q][7])==0) {
npo[p][numtabs[p]] = q;
numtabs[p]++;
}
}
}
// Loop through all location markers ===================================
for (var i = 0; i < locations.length; i++) {
// obtain the attributes of each marker
var event = locations[i][0]; // Event or Fact
var lat = locations[i][1]; // Latitude
var lng = locations[i][2]; // Longitude
var date = locations[i][3]; // Date of event or fact
var info = ''//locations[i][4]; // info on occupation, or
var name = locations[i][5]; // Persons name
var address = locations[i][6]; // Address of event or fact
var index = locations[i][7]; // index
var tab = locations[i][8]; // tab index
var placed = locations[i][9]; // Yes indicates multitab item
var name2 = locations[i][11]; // printable name for marker title
var point = new google.maps.LatLng(lat,lng); // Place Latitude, Longitude
var media = locations[i][14]; // media item
var sv_lati = locations[i][15]; // Street View latitude
var sv_long = locations[i][16]; // Street View longitude
var sv_bearing = locations[i][17]; // Street View bearing
var sv_elevation = locations[i][18]; // Street View elevation
var sv_zoom = locations[i][19]; // Street View zoom
var marker_icon = locations[i][20]; // Marker icon image (flag)
var sv_point = new google.maps.LatLng(sv_lati,sv_long); // StreetView Latitude and Longitide
// === Employ of image tab function using an information image =====
if (media == null || media == '') {
media = WT_STATIC_URL+WT_MODULES_DIR+'googlemap/images/facts/v3_image_info.png';
} else {
media = media;
}
if (document.getElementById('golfbox').checked == false) {
var category = 'theatre'; // Category for future pedigree map use etc
var addr2 = locations[i][10]; // printable address for marker title
} else {
var category = 'golf';
var addr2 = locations[i][10]; // printable address for marker title
}
// If a fact with info or a persons name ===========================
var event_item ='';
var event_tab ='';
var tabcontid = '';
var divhead = '<h4 id="iwhead" >'+address+'<\/h4>';
for (var n = 0; n < locations.length; n++) {
//if (i==npo[n][i]) {
if (i==npo[n][0] || i==npo[n][1] || i==npo[n][2] || i==npo[n][3] || i==npo[n][4] || i==npo[n][5] || i==npo[n][6] || i==npo[n][7] || i==npo[n][8] || i==npo[n][9] || i==npo[n][10] || i==npo[n][11] || i==npo[n][12] || i==npo[n][13] || i==npo[n][14] || i==npo[n][15] || i==npo[n][16] || i==npo[n][17] || i==npo[n][18] || i==npo[n][19] || i==npo[n][20] || i==npo[n][21] || i==npo[n][22] || i==npo[n][23] || i==npo[n][24] || i==npo[n][25]) {
for (var x=0; x<numtabs[n]; x++) {
tabcontid=npo[n][x];
// If a fact with a persons name and extra info---
if (locations[tabcontid][4] && locations[tabcontid][5]) {
event_tab+= [ '<table><tr><td class="highlt_img">'+locations[tabcontid][12]+'<\/td><td><p><span id="sp1">'+locations[tabcontid][0]+'<\/span><br>'+locations[tabcontid][4]+'<br><b>'+locations[tabcontid][5]+'<\/b><br>'+locations[tabcontid][3]+'<br><\/p><\/td><\/tr><\/table>' ];
// or if a fact with a persons name ---
} else if (locations[tabcontid][5]) {
event_tab+= [ '<table><tr><td class="highlt_img">'+locations[tabcontid][12]+'<\/td><td><p><span id="sp1">'+locations[tabcontid][0]+'<\/span><br><b>'+locations[tabcontid][5]+'<\/b><br>'+locations[tabcontid][3]+'<br><\/p><\/td><\/tr><\/table>' ];
// or if a fact with extra info ---
} else if (locations[tabcontid][4]) {
event_tab+= [ '<table><tr><td class="highlt_img">'+locations[tabcontid][13]+'<\/td><td><p><span id="sp1">'+locations[tabcontid][0]+'<\/span><br>'+locations[tabcontid][4]+'<br>'+locations[tabcontid][3]+'<br><\/p><\/td><\/tr><\/table>' ];
// or just a simple fact ---
} else {
event_tab+= [ '<table><tr><td class="highlt_img">'+locations[tabcontid][13]+'<\/td><td><p><span id="sp1">'+locations[tabcontid][0]+'<\/span><br>'+locations[tabcontid][3]+'<br><\/p><\/td><\/tr><\/table>' ];
}
}
}
}
var multitabs = [
'<div class="infowindow">',
'<div id = "gmtabs">',
'<ul class="tabs" >',
'<li><a href="#event" id="EV"><?php echo WT_I18N::translate('Events'); ?><\/a><\/li>',
<?php if ($STREETVIEW) { ?>
'<li><a href="#sview" id="SV"><?php echo WT_I18N::translate('Google Street View'); ?><\/a><\/li>',
<?php } ?>
// === To be used later === Do not delete ==============
// '<li><a href="#image" id="PH">Image<\/a><\/li>',
// '<li><a href="#" id="SP">Aerial<\/a><\/li>',
// =====================================================
'<\/ul>',
'<div class="panes">',
'<div id = "pane1">',
divhead,
event_tab,
'<\/div>',
<?php if ($STREETVIEW) { ?>
'<div id = "pane2">',
divhead,
'<div id="pano"><\/div>',
'<\/div>',
<?php } ?>
// === To be used later === Do not delete ==============
// '<div id = "pane3">',
// divhead,
// '<div id = "pane3_text">',
// '<img style="margin-left: -10px; margin-top: 1px;" src="'+media+'" height= "216px" width= "298px">',
// '<\/div>',
// '<\/div>',
// '<div id = "pane4">',
// divhead,
// '<div id = "pane4_text">',
// '<br>',
// '<br> Spare Tab Content',
// '<br>',
// '<\/div>',
// '<\/div>',
// =====================================================
'<\/div>',
'<\/div>',
'<\/div>'
].join('');
// create the marker ===============================================
var html = multitabs;
var zoomLevel = <?php echo $GOOGLEMAP_MAX_ZOOM; ?>;
var marker = createMarker(i, point, event, html, category, placed, index, tab, addr2, media, sv_lati, sv_long, sv_bearing, sv_elevation, sv_zoom, sv_point, marker_icon);
// if streetview coordinates are available, use them for marker, ===
// else use the place coordinates =========
if (sv_point && sv_point != "(0, 0)") {
var myLatLng = sv_point;
} else {
var myLatLng = point;
}
// Correct zoom level when only one marker is present ==============
if (i < 1) {
bounds.extend(myLatLng);
map.setZoom(zoomLevel);
map.setCenter(myLatLng);
} else {
bounds.extend(myLatLng);
map.fitBounds(bounds);
// Correct zoom level when multiple markers have the same coordinates ==
var listener1 = google.maps.event.addListener(map, "idle", function() {
if (map.getZoom() > zoomLevel) {
map.setZoom(zoomLevel);
}
google.maps.event.removeListener(listener1);
});
}
} // end loop through location markers
} // end loadMap()
//]]>
</script>
|