/** * Display a map showing the originas of ones ancestors. */ private function pedigreeMap() { global $controller, $WT_TREE; $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); $controller = new ChartController(); $this->generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); $this->treesize = pow(2, $this->generations) - 1; $this->ancestors = array_values($controller->sosaAncestors($this->generations)); // Start of internal configuration variables // Limit this to match available number of icons. // 8 generations equals 255 individuals $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8); // End of internal configuration variables $controller->setPageTitle(I18N::translate('Pedigree map of %s', $controller->root->getFullName()))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet">'; echo '<div id="pedigreemap-page"> <h2>', $controller->getPageTitle(), '</h2>'; // -- print the form to change the number of displayed generations ?> <form name="people" method="get" action="?"> <input type="hidden" name="ged" value="<?php echo $WT_TREE->getNameHtml(); ?> "> <input type="hidden" name="mod" value="googlemap"> <input type="hidden" name="mod_action" value="pedigree_map"> <table class="list_table" width="555"> <tr> <td class="descriptionbox wrap"> <?php echo I18N::translate('Individual'); ?> </td> <td class="optionbox"> <input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid" size="3" value="<?php echo $controller->root->getXref(); ?> "> <?php echo FunctionsPrint::printFindIndividualLink('rootid'); ?> </td> <td class="topbottombar" rowspan="2"> <input type="submit" value="<?php echo I18N::translate('View'); ?> "> </td> </tr> <tr> <td class="descriptionbox wrap"> <?php echo I18N::translate('Generations'); ?> </td> <td class="optionbox"> <select name="PEDIGREE_GENERATIONS"> <?php for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) { echo '<option value="', $p, '" '; if ($p == $this->generations) { echo 'selected'; } echo '>', $p, '</option>'; } ?> </select> </td> </tr> </table> </form> <!-- end of form --> <!-- count records by type --> <?php $curgen = 1; $priv = 0; $count = 0; $miscount = 0; $missing = ''; $latlongval = array(); $lat = array(); $lon = array(); for ($i = 0; $i < $this->treesize; $i++) { // -- check to see if we have moved to the next generation if ($i + 1 >= pow(2, $curgen)) { $curgen++; } $person = $this->ancestors[$i]; if (!empty($person)) { $name = $person->getFullName(); if ($name == I18N::translate('Private')) { $priv++; } $place = $person->getBirthPlace(); if (empty($place)) { $latlongval[$i] = null; } else { $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace()); } if ($latlongval[$i]) { $lat[$i] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati); $lon[$i] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long); if ($lat[$i] && $lon[$i]) { $count++; } else { // The place is in the table but has empty values if ($name) { if ($missing) { $missing .= ', '; } $missing .= '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>'; $miscount++; } } } else { // There was no place, or not listed in the map table if ($name) { if ($missing) { $missing .= ', '; } $missing .= '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>'; $miscount++; } } } } //<!-- end of count records by type --> //<!-- start of map display --> echo '<div id="pedigreemap_chart">'; echo '<table class="tabs_table" cellspacing="0" cellpadding="0" border="0" width="100%">'; echo '<tr>'; echo '<td valign="top">'; echo '<div id="pm_map" style="border: 1px solid gray; height: ', $this->getSetting('GM_YSIZE'), 'px; font-size: 0.9em;'; echo '"><i class="icon-loading-large"></i></div>'; if (Auth::isAdmin()) { echo '<table width="100%">'; echo '<tr><td align="left">'; echo '<a href="module.php?mod=googlemap&mod_action=admin_config">', I18N::translate('Google Maps™ preferences'), '</a>'; echo '</td>'; echo '<td align="center">'; echo '<a href="module.php?mod=googlemap&mod_action=admin_places">', I18N::translate('Geographic data'), '</a>'; echo '</td>'; echo '<td align="right">'; echo '<a href="module.php?mod=googlemap&mod_action=admin_placecheck">', I18N::translate('Place check'), '</a>'; echo '</td></tr>'; echo '</table>'; } echo '</td><td width="15px"></td>'; echo '<td width="310px" valign="top">'; echo '<div id="side_bar" style="width:300px; font-size:0.9em; overflow:auto; overflow-x:hidden; overflow-y:auto; height:', $this->getSetting('GM_YSIZE'), 'px;"></div></td>'; echo '</tr>'; echo '</table>'; // display info under map echo '<hr>'; echo '<table cellspacing="0" cellpadding="0" border="0" width="100%">'; echo '<tr>'; echo '<td valign="top">'; // print summary statistics if (isset($curgen)) { $total = pow(2, $curgen) - 1; echo I18N::plural('%1$s individual displayed, out of the normal total of %2$s, from %3$s generations.', '%1$s individuals displayed, out of the normal total of %2$s, from %3$s generations.', $count, I18N::number($count), I18N::number($total), I18N::number($curgen)), '<br>'; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td valign="top">'; if ($priv) { echo I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '<br>'; } if ($count + $priv != $total) { if ($miscount == 0) { echo I18N::translate('No ancestors in the database.'), "<br>"; } else { echo I18N::plural('%1$s individual is missing birthplace map coordinates: %2$s.', '%1$s individuals are missing birthplace map coordinates: %2$s.', $miscount, I18N::number($miscount), $missing), '<br>'; } } } echo '</td>'; echo '</tr>'; echo '</table>'; echo '</div>'; // close #pedigreemap_chart echo '</div>'; // close #pedigreemap-page ?> <!-- end of map display --> <!-- Start of map scripts --> <?php echo '<script src="', $this->googleMapsScript(), '"></script>'; $controller->addInlineJavascript($this->pedigreeMapJavascript()); }