Exemplo n.º 1
0
        }
        // Get Spouse child’s details
        $nam = $child->getAllNames();
        $fulln = rtrim($nam[0]['givn'], '*') . " " . $nam[0]['surname'];
        $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
        $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
        $givn = rtrim($nam[0]['givn'], '*');
        $surn = $nam[0]['surname'];
        $chfulmn = null;
        $chnam = $child->getAllNames();
        for ($i = 0; $i < count($nam); $i++) {
            if ($chnam[$i]['type'] == '_MARNM') {
                $chfulmn = rtrim($chnam[$i]['givn'], '*') . "&nbsp;" . $chnam[$i]['surname'];
            }
        }
        $label = get_close_relationship_name($person, $child);
        $menu = new WT_Menu($label);
        $slabel = print_pedigree_person_nav2($child->getXref(), $label, $censyear);
        $slabel .= $spouselinks;
        $submenu = new WT_Menu($slabel);
        $menu->addSubmenu($submenu);
        ?>
							<tr>
								<td align="left" class="linkcell optionbox">
									<?php 
        echo $menu->getMenu();
        ?>
								</td>
								<td align="left" class="facts_value">
									<?php 
        echo "<a href=\"edit_interface.php?action=addnewnote_assisted&amp;noteid=newnote&amp;xref=" . $child->getXref() . "&amp;gedcom=" . WT_GEDURL . "\">";
Exemplo n.º 2
0
    function printFamily(WT_Family $family, $type, $label)
    {
        global $controller;
        global $personcount;
        // TODO: use a unique id instead?
        global $SHOW_PRIVATE_RELATIONSHIPS;
        if ($SHOW_PRIVATE_RELATIONSHIPS) {
            $access_level = WT_PRIV_HIDE;
        } else {
            $access_level = WT_USER_ACCESS_LEVEL;
        }
        ?>
		<table>
			<tr>
				<td>
					<i class="icon-cfamily"></i>
				</td>
				<td>
					<span class="subheaders"> <?php 
        echo $label;
        ?>
 </span> -
					<a href="<?php 
        echo $family->getHtmlUrl();
        ?>
"><?php 
        echo WT_I18N::translate('View family');
        ?>
</a>
				</td>
			</tr>
		</table>
		<table class="facts_table">
		<?php 
        ///// HUSB /////
        $found = false;
        foreach ($family->getFacts('HUSB', false, $access_level) as $fact) {
            $found |= !$fact->isOld();
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                if ($fact->isNew()) {
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
					<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
					</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label">&nbsp;</td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'HUSB');"><?php 
            echo WT_I18N::translate('Add a husband to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// WIFE /////
        $found = false;
        foreach ($family->getFacts('WIFE', false, $access_level) as $fact) {
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                $found |= !$fact->isOld();
                if ($fact->isNew()) {
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
				</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label">&nbsp;</td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'WIFE');"><?php 
            echo WT_I18N::translate('Add a wife to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// MARR /////
        $found = false;
        $prev = new WT_Date('');
        foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
            $found |= !$fact->isOld();
            if ($fact->isNew()) {
                $class = ' new';
            } elseif ($fact->isOld()) {
                $class = ' old';
            } else {
                $class = '';
            }
            ?>
			<tr>
				<td class="facts_label">
					&nbsp;
				</td>
				<td class="facts_value<?php 
            echo $class;
            ?>
">
					<?php 
            echo WT_Gedcom_Tag::getLabelValue($fact->getTag(), $fact->getDate()->Display(false) . ' — ' . $fact->getPlace()->getFullName());
            ?>
				</td>
			</tr>
			<?php 
            if (!$prev->isOK() && $fact->getDate()->isOK()) {
                $prev = $fact->getDate();
            }
        }
        if (!$found && $family->canShow() && $family->canEdit()) {
            // Add a new marriage
            ?>
			<tr>
				<td class="facts_label">
					&nbsp;
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_new_record('<?php 
            echo $family->getXref();
            ?>
', 'MARR');">
						<?php 
            echo WT_I18N::translate('Add marriage details');
            ?>
					</a>
				</td>
			</tr>
			<?php 
        }
        ///// CHIL /////
        $child_number = 0;
        foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                if ($fact->isNew()) {
                    $child_number++;
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $child_number++;
                    $class = 'facts_label';
                }
                $next = new WT_Date('');
                foreach ($person->getFacts(WT_EVENTS_BIRT) as $bfact) {
                    if ($bfact->getDate()->isOK()) {
                        $next = $bfact->getDate();
                        break;
                    }
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo self::ageDifference($prev, $next, $child_number);
                ?>
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
				</tr>
				<?php 
                $prev = $next;
            }
        }
        // Re-order children / add a new child
        if ($family->canEdit()) {
            if ($type == 'FAMS') {
                $child_u = WT_I18N::translate('Add a new son or daughter');
                $child_m = WT_I18N::translate('son');
                $child_f = WT_I18N::translate('daughter');
            } else {
                $child_u = WT_I18N::translate('Add a new brother or sister');
                $child_m = WT_I18N::translate('brother');
                $child_f = WT_I18N::translate('sister');
            }
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            if (count($family->getChildren()) > 1) {
                ?>
					<a href="#" onclick="reorder_children('<?php 
                echo $family->getXref();
                ?>
');tabswitch(5);"><i class="icon-media-shuffle"></i> <?php 
                echo WT_I18N::translate('Re-order children');
                ?>
</a>
					<?php 
            }
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
');"><?php 
            echo $child_u;
            ?>
</a>
					<span style='white-space:nowrap;'>
						<a href="#" class="icon-sex_m_15x15" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
','M');"></a>
						<a href="#" class="icon-sex_f_15x15" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
','F');"></a>
					</span>
				</td>
			</tr>
			<?php 
        }
        echo '</table>';
        return;
    }
Exemplo n.º 3
0
    private function pedigreeMapJavascript($hideflags, $hidelines)
    {
        global $controller, $SHOW_HIGHLIGHT_IMAGES, $PEDIGREE_GENERATIONS;
        // The HomeControl returns the map to the original position and style
        $js = 'function HomeControl(controlDiv, pm_map) {' . 'controlDiv.style.paddingTop = "5px";
			controlDiv.style.paddingRight = "0px";' . 'var controlUI = document.createElement("DIV");
			controlUI.style.backgroundColor = "white";
			controlUI.style.color = "black";
			controlUI.style.borderColor = "black";
			controlUI.style.borderColor = "black";
			controlUI.style.borderStyle = "solid";
			controlUI.style.borderWidth = "2px";
			controlUI.style.cursor = "pointer";
			controlUI.style.textAlign = "center";
			controlUI.title = "";
			controlDiv.appendChild(controlUI);' . '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>' . WT_I18N::translate('Redraw map') . '<\\/b>";
			controlUI.appendChild(controlText);' . 'google.maps.event.addDomListener(controlUI, "click", function() {
				pm_map.setMapTypeId(google.maps.MapTypeId.TERRAIN),
				pm_map.fitBounds(bounds),
				pm_map.setCenter(bounds.getCenter()),
				infowindow.close()
				if (document.getElementById(lastlinkid) != null) {
					document.getElementById(lastlinkid).className = "person_box:target";
				}
			});
		}' . 'function myclick(i) {
			if (document.getElementById(lastlinkid) != null) {
				document.getElementById(lastlinkid).className = "person_box:target";
			}
			google.maps.event.trigger(gmarkers[i], "click");
		}' . 'var side_bar_html = "";' . 'var gmarkers = [];
		var i = 0;
		var lastlinkid;
		var infowindow = new google.maps.InfoWindow({});' . 'var gicons = [];
		gicons["1"]        = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon1.png")
		gicons["1"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png",
									new google.maps.Size(37, 34), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(10, 34) // Shadow anchor is base of image
								);
		gicons["2"]         = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2.png")
		gicons["2"].shadow  = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png",
									new google.maps.Size(37, 34), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(10, 34) // Shadow anchor is base of image
								);
		gicons["2L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2L.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(28, 28) // Image anchor
								);
		gicons["2L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(32, 27) // Shadow anchor is base of image
								);
		gicons["2R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2R.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(4, 28)  // Image anchor
								);
		gicons["2R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(15, 27) // Shadow anchor is base of image
								);
		gicons["2Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2Ls.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(22, 22) // Image anchor
								);
		gicons["2Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2Rs.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(2, 22)  // Image anchor
								);
		gicons["3"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3.png")
		gicons["3"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png",
									new google.maps.Size(37, 34), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(10, 34) // Shadow anchor is base of image
								);
		gicons["3L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3L.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(28, 28) // Image anchor
								);
		gicons["3L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(32, 27) // Shadow anchor is base of image
								);
		gicons["3R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3R.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(4, 28)  // Image anchor
								);
		gicons["3R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(15, 27) // Shadow anchor is base of image
								);
		gicons["3Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3Ls.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(22, 22) // Image anchor
								);
		gicons["3Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3Rs.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(2, 22)  // Image anchor
								);
		gicons["4"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4.png")
		gicons["4"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png",
									new google.maps.Size(37, 34), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(10, 34) // Shadow anchor is base of image
								);
		gicons["4L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4L.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(28, 28) // Image anchor
								);
		gicons["4L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(32, 27) // Shadow anchor is base of image
								);
		gicons["4R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4R.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(4, 28)  // Image anchor
								);
		gicons["4R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(15, 27) // Shadow anchor is base of image
								);
		gicons["4Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4Ls.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(22, 22) // Image anchor
								);
		gicons["4Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4Rs.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(2, 22)  // Image anchor
								);
		gicons["5"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5.png")
		gicons["5"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png",
									new google.maps.Size(37, 34), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(10, 34) // Shadow anchor is base of image
								);
		gicons["5L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5L.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(28, 28) // Image anchor
								);
		gicons["5L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(32, 27) // Shadow anchor is base of image
								);
		gicons["5R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5R.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(4, 28)  // Image anchor
								);
		gicons["5R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(15, 27) // Shadow anchor is base of image
								);
		gicons["5Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5Ls.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(22, 22) // Image anchor
								);
		gicons["5Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5Rs.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(2, 22)  // Image anchor
								);
		gicons["6"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6.png")
		gicons["6"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png",
									new google.maps.Size(37, 34), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(10, 34) // Shadow anchor is base of image
								);
		gicons["6L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6L.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(28, 28) // Image anchor
								);
		gicons["6L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(32, 27) // Shadow anchor is base of image
								);
		gicons["6R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6R.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(4, 28)  // Image anchor
								);
		gicons["6R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(15, 27) // Shadow anchor is base of image
								);
		gicons["6Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6Ls.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(22, 22) // Image anchor
								);
		gicons["6Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6Rs.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(2, 22)  // Image anchor
								);
		gicons["7"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7.png")
		gicons["7"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png",
									new google.maps.Size(37, 34), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(10, 34) // Shadow anchor is base of image
								);
		gicons["7L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7L.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(28, 28) // Image anchor
								);
		gicons["7L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(32, 27) // Shadow anchor is base of image
								);
		gicons["7R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7R.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(4, 28)  // Image anchor
								);
		gicons["7R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(15, 27) // Shadow anchor is base of image
								);
		gicons["7Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7Ls.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(22, 22) // Image anchor
								);
		gicons["7Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7Rs.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(2, 22)  // Image anchor
								);
		gicons["8"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8.png")
		gicons["8"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png",
									new google.maps.Size(37, 34), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(10, 34) // Shadow anchor is base of image
								);
		gicons["8L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8L.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(28, 28) // Image anchor
								);
		gicons["8L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(32, 27) // Shadow anchor is base of image
								);
		gicons["8R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8R.png",
									new google.maps.Size(32, 32), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(4, 28)  // Image anchor
								);
		gicons["8R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png",
									new google.maps.Size(49, 32), // Shadow size
									new google.maps.Point(0, 0),  // Shadow origin
									new google.maps.Point(15, 27) // Shadow anchor is base of image
								);
		gicons["8Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8Ls.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(22, 22) // Image anchor
								);
		gicons["8Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8Rs.png",
									new google.maps.Size(24, 24), // Image size
									new google.maps.Point(0, 0),  // Image origin
									new google.maps.Point(2, 22)  // Image anchor
								);' . 'function createMarker(point, name, html, mhtml, icontype) {
			var contentString = "<div id=\'iwcontent_edit\'>"+mhtml+"<\\/div>";' . 'var marker = new google.maps.Marker({
				icon:     gicons[icontype],
				shadow:   gicons[icontype].shadow,
				map:      pm_map,
				position: point,
				zIndex:   0
			});
			var linkid = "link"+i;
			google.maps.event.addListener(marker, "click", function() {
				infowindow.close();
				infowindow.setContent(contentString);
				infowindow.open(pm_map, marker);
				document.getElementById(linkid).className = "person_box";
				if (document.getElementById(lastlinkid) != null) {
					document.getElementById(lastlinkid).className = "person_box:target";
				}
				lastlinkid=linkid;
			});' . 'gmarkers[i] = marker;' . 'side_bar_html += "<br><div id=\'"+linkid+"\' onclick=\'myclick(" + i + ")\'>" + html +"<br></div>";
			i++;
			return marker;
		};' . 'var myOptions = {
			zoom: 6,
			center: new google.maps.LatLng(0, 0),
			mapTypeId: google.maps.MapTypeId.TERRAIN,  // ROADMAP, SATELLITE, HYBRID, TERRAIN
			mapTypeControlOptions: {
				style: google.maps.MapTypeControlStyle.DROPDOWN_MENU  // DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR
			},
			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: true
		};
		var pm_map = new google.maps.Map(document.getElementById("pm_map"), myOptions);
		google.maps.event.addListener(pm_map, "click", function() {
			if (document.getElementById(lastlinkid) != null) {
				document.getElementById(lastlinkid).className = "person_box:target";
			}
		infowindow.close();
		});' . 'var homeControlDiv = document.createElement("DIV");
		var homeControl = new HomeControl(homeControlDiv, pm_map);
		homeControlDiv.index = 1;
		pm_map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);' . 'var bounds = new google.maps.LatLngBounds();';
        // add the points
        $curgen = 1;
        $count = 0;
        $colored_line = array('1' => '#FF0000', '2' => '#0000FF', '3' => '#00FF00', '4' => '#FFFF00', '5' => '#00FFFF', '6' => '#FF00FF', '7' => '#C0C0FF', '8' => '#808000');
        $lat = array();
        $lon = array();
        $latlongval = array();
        $flags = array();
        for ($i = 0; $i < $controller->treesize; $i++) {
            // moved up to grab the sex of the individuals
            $person = WT_Individual::getInstance($controller->treeid[$i]);
            if ($person) {
                $name = $person->getFullName();
                // -- check to see if we have moved to the next generation
                if ($i + 1 >= pow(2, $curgen)) {
                    $curgen++;
                }
                $relationship = get_close_relationship_name($controller->root, $person);
                $event = '<img src="' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/sq' . $curgen . '.png" width="10" height="10"> ' . '<strong>' . $relationship . '</strong>';
                // add thumbnail image
                if ($SHOW_HIGHLIGHT_IMAGES) {
                    $image = $person->displayImage();
                } else {
                    $image = '';
                }
                // end of add image
                $dataleft = WT_Filter::escapeJs($image . $event . ' — ' . $name);
                $datamid = WT_Filter::escapeJs(' <span><a href="' . $person->getHtmlUrl() . '">(' . WT_I18N::translate('View person') . ')</a></span>');
                $dataright = WT_Filter::escapeJs('<br><strong>' . WT_I18N::translate('Birth:') . '&nbsp;</strong>' . $person->getBirthDate()->Display(false) . ' — ' . $person->getBirthPlace());
                $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace());
                if ($latlongval[$i]) {
                    $lat[$i] = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati);
                    $lon[$i] = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long);
                    if ($lat[$i] || $lon[$i]) {
                        if (!$hideflags && $latlongval[$i]->pl_icon) {
                            $flags[$i] = $latlongval[$i]->pl_icon;
                            $ffile = strrchr($latlongval[$i]->pl_icon, '/');
                            $ffile = substr($ffile, 1, strpos($ffile, '.') - 1);
                            if (empty($flags[$ffile])) {
                                $flags[$ffile] = $i;
                                // Only generate the flag once
                                $js .= 'var point = new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . ');';
                                $js .= 'var Marker1_0_flag = new google.maps.MarkerImage();';
                                $js .= 'Marker1_0_flag.image = "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/' . $flags[$i] . '";';
                                $js .= 'Marker1_0_flag.shadow = "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/images/flag_shadow.png";';
                                $js .= 'Marker1_0_flag.iconSize = new google.maps.Size(25, 15);';
                                $js .= 'Marker1_0_flag.shadowSize = new google.maps.Size(35, 45);';
                                $js .= 'Marker1_0_flag.iconAnchor = new google.maps.Point(1, 45);';
                                $js .= 'var Marker1_0 = new google.maps.LatLng(point, {icon:Marker1_0_flag});';
                            }
                        }
                        $marker_number = $curgen;
                        $dups = 0;
                        for ($k = 0; $k < $i; $k++) {
                            if ($latlongval[$i] == $latlongval[$k]) {
                                $dups++;
                                switch ($dups) {
                                    case 1:
                                        $marker_number = $curgen . 'L';
                                        break;
                                    case 2:
                                        $marker_number = $curgen . 'R';
                                        break;
                                    case 3:
                                        $marker_number = $curgen . 'Ls';
                                        break;
                                    case 4:
                                        $marker_number = $curgen . 'Rs';
                                        break;
                                    case 5:
                                        //adjust position where markers have same coodinates
                                    //adjust position where markers have same coodinates
                                    default:
                                        $marker_number = $curgen;
                                        $lon[$i] = $lon[$i] + 0.0025;
                                        $lat[$i] = $lat[$i] + 0.0025;
                                        break;
                                }
                            }
                        }
                        $js .= 'var point = new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . ');';
                        $js .= "var marker = createMarker(point, \"" . WT_Filter::escapeJs($name) . "\",\"<div>" . $dataleft . $datamid . $dataright . "</div>\", \"";
                        $js .= "<div class='iwstyle'>";
                        $js .= "<a href='module.php?ged=" . WT_GEDURL . "&amp;mod=googlemap&amp;mod_action=pedigree_map&amp;rootid=" . $person->getXref() . "&amp;PEDIGREE_GENERATIONS={$PEDIGREE_GENERATIONS}";
                        if ($hideflags) {
                            $js .= '&amp;hideflags=1';
                        }
                        if ($hidelines) {
                            $js .= '&amp;hidelines=1';
                        }
                        $js .= "' title='" . WT_I18N::translate('Pedigree map') . "'>" . $dataleft . "</a>" . $datamid . $dataright . "</div>\", \"" . $marker_number . "\");";
                        // Construct the polygon lines
                        if (!$hidelines) {
                            $to_child = intval(($i - 1) / 2);
                            // Draw a line from parent to child
                            if (array_key_exists($to_child, $lat) && $lat[$to_child] != 0 && $lon[$to_child] != 0) {
                                $js .= '
								var linecolor;
								var plines;
								var lines = [new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i] . '),
									new google.maps.LatLng(' . $lat[$to_child] . ',' . $lon[$to_child] . ')];
								linecolor = "' . $colored_line[$curgen] . '";
								plines = new google.maps.Polygon({
									paths: lines,
									strokeColor: linecolor,
									strokeOpacity: 0.8,
									strokeWeight: 3,
									fillColor: "#FF0000",
									fillOpacity: 0.1
								});
								plines.setMap(pm_map);';
                            }
                        }
                        // Extend and fit marker bounds
                        $js .= 'bounds.extend(point);';
                        $js .= 'pm_map.fitBounds(bounds);';
                        $count++;
                    }
                }
            } else {
                $latlongval[$i] = null;
            }
        }
        $js .= 'pm_map.setCenter(bounds.getCenter());' . 'google.maps.event.addListener(infowindow, "closeclick", function() {
			document.getElementById(lastlinkid).className = "person_box:target";
		});' . 'document.getElementById("side_bar").innerHTML = side_bar_html;' . 'var contextmenu = document.createElement("div");
			contextmenu.style.visibility="hidden";
			contextmenu.innerHTML = "<a href=\'#\' onclick=\'zoomIn()\'><div class=\'optionbox\'>&nbsp;&nbsp;' . WT_I18N::translate('Zoom in') . '&nbsp;&nbsp;</div></a>"
								+ "<a href=\'#\' onclick=\'zoomOut()\'><div class=\'optionbox\'>&nbsp;&nbsp;' . WT_I18N::translate('Zoom out') . '&nbsp;&nbsp;</div></a>"
								+ "<a href=\'#\' onclick=\'zoomInHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;' . WT_I18N::translate('Zoom in here') . '</div></a>"
								+ "<a href=\'#\' onclick=\'zoomOutHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;' . WT_I18N::translate('Zoom out here') . '&nbsp;&nbsp;</div></a>"
								+ "<a href=\'#\' onclick=\'centreMapHere()\'><div class=\'optionbox\'>&nbsp;&nbsp;' . WT_I18N::translate('Center map here') . '&nbsp;&nbsp;</div></a>";' . 'google.maps.event.addListener(pm_map,"singlerightclick", function(pixel,tile) {' . 'clickedPixel = pixel;
			var x=pixel.x;
			var y=pixel.y;
			if (x > pm_map.getSize().width - 120) { x = pm_map.getSize().width - 120 }
			if (y > pm_map.getSize().height - 100) { y = pm_map.getSize().height - 100 }
			var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x,y));
			pos.apply(contextmenu);
			contextmenu.style.visibility = "visible";
		});
		' . 'function zoomIn() {' . 'pm_map.zoomIn();' . 'contextmenu.style.visibility="hidden";
		}
		function zoomOut() {' . 'pm_map.zoomOut();' . 'contextmenu.style.visibility="hidden";
		}
		function zoomInHere() {' . 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel)
			pm_map.zoomIn(point,true);' . 'contextmenu.style.visibility="hidden";
		}
		function zoomOutHere() {' . 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel)
			pm_map.setCenter(point,pm_map.getZoom()-1);' . 'contextmenu.style.visibility="hidden";
		}
		function centreMapHere() {' . 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel)
			pm_map.setCenter(point);' . 'contextmenu.style.visibility="hidden";
		}' . 'google.maps.event.addListener(pm_map, "click", function() {
			contextmenu.style.visibility="hidden";
		});';
        return $js;
    }
Exemplo n.º 4
0
    private function drawFamily(WT_Family $family, $title)
    {
        global $controller, $SHOW_PRIVATE_RELATIONSHIPS;
        ?>
		<tr>
			<td class="center" colspan="2">
				<a class="famnav_title" href="<?php 
        echo $family->getHtmlUrl();
        ?>
">
					<?php 
        echo $title;
        ?>
				</a>
			</td>
		</tr>
		<?php 
        $access_level = $SHOW_PRIVATE_RELATIONSHIPS ? WT_PRIV_HIDE : WT_USER_ACCESS_LEVEL;
        $facts = array_merge($family->getFacts('HUSB', false, $access_level), $family->getFacts('WIFE', false, $access_level));
        foreach ($facts as $fact) {
            $spouse = $fact->getTarget();
            if ($this->isPerson($spouse)) {
                $menu = new WT_Menu(get_close_relationship_name($controller->record, $spouse));
                $menu->addClass('', 'submenu flyout');
                $menu->addSubMenu(new WT_Menu($this->getParents($spouse)));
                ?>
				<tr>
					<td class="facts_label">
						<?php 
                echo $menu->getMenu();
                ?>
					</td>
					<td class="center <?php 
                echo $controller->getPersonStyle($spouse);
                ?>
 nam">
						<a class="famnav_link" href="<?php 
                echo $spouse->getHtmlUrl();
                ?>
">
							<?php 
                echo $spouse->getFullName();
                ?>
						</a>
						<div class="font9">
							<?php 
                echo $spouse->getLifeSpan();
                ?>
						</div>
					</td>
				</tr>
				<?php 
            }
        }
        foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
            $child = $fact->getTarget();
            if ($this->isPerson($child)) {
                $menu = new WT_Menu(get_close_relationship_name($controller->record, $child));
                $menu->addClass('', 'submenu flyout');
                $menu->addSubMenu(new WT_Menu($this->getFamily($child)));
                ?>
				<tr>
					<td class="facts_label">
						<?php 
                echo $menu->getMenu();
                ?>
					</td>
					<td class="center <?php 
                echo $controller->getPersonStyle($child);
                ?>
 nam">
						<a class="famnav_link" href="<?php 
                echo $child->getHtmlUrl();
                ?>
">
							<?php 
                echo $child->getFullName();
                ?>
						</a>
						<div class="font9">
							<?php 
                echo $child->getLifeSpan();
                ?>
						</div>
					</td>
				</tr>
				<?php 
            }
        }
    }