private function pedigreeMap() { global $controller, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS; // Default is show for both of these. $hideflags = WT_Filter::get('hideflags'); $hidelines = WT_Filter::get('hidelines'); $controller = new WT_Controller_Pedigree(); // 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(WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()))->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->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_Filter::escapeHtml(WT_GEDCOM); ?> "> <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 WT_I18N::translate('Individual'); ?> </td> <td class="descriptionbox wrap"> <?php echo WT_I18N::translate('Generations'); ?> </td> <td class="descriptionbox wrap"> <?php echo WT_I18N::translate('Hide flags'), help_link('PEDIGREE_MAP_hideflags', 'googlemap'); ?> </td> <td class="descriptionbox wrap"> <?php echo WT_I18N::translate('Hide lines'), help_link('PEDIGREE_MAP_hidelines', 'googlemap'); ?> </td> </tr> <tr> <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 print_findindi_link('rootid'); ?> </td> <td class="optionbox"> <select name="PEDIGREE_GENERATIONS"> <?php for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) { echo '<option value="', $p, '" '; if ($p == $controller->PEDIGREE_GENERATIONS) { echo 'selected="selected"'; } echo '>', $p, '</option>'; } ?> </select> </td> <td class="optionbox"> <?php echo '<input name="hideflags" type="checkbox"'; if ($hideflags) { echo ' checked="checked"'; } echo '>'; ?> </td> <td class="optionbox"> <?php echo '<input name="hidelines" type="checkbox"'; if ($hidelines) { echo ' checked="checked"'; } echo '>'; ?> </td> </tr> <tr> <td class="topbottombar" colspan="5"> <input type="submit" value="<?php echo WT_I18N::translate('View'); ?> "> </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 < $controller->treesize; $i++) { // -- check to see if we have moved to the next generation if ($i + 1 >= pow(2, $curgen)) { $curgen++; } $person = WT_Individual::getInstance($controller->treeid[$i]); if (!empty($person)) { $name = $person->getFullName(); if ($name == WT_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] != null && $lon[$i] != null) { $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">', WT_I18N::translate('Google Maps™ preferences'), '</a>'; echo '</td>'; echo '<td align="center">'; echo '<a href="module.php?mod=googlemap&mod_action=admin_places">', WT_I18N::translate('Geographic data'), '</a>'; echo '</td>'; echo '<td align="right">'; echo '<a href="module.php?mod=googlemap&mod_action=admin_placecheck">', WT_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 WT_I18N::plural('%1$d individual displayed, out of the normal total of %2$d, from %3$d generations.', '%1$d individuals displayed, out of the normal total of %2$d, from %3$d generations.', $count, $count, $total, $curgen), '<br>'; echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td valign="top">'; if ($priv) { echo WT_I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '<br>'; } if ($count + $priv != $total) { if ($miscount == 0) { echo WT_I18N::translate('No ancestors in the database.'), "<br>"; } else { echo WT_I18N::plural('%1$d individual is missing birthplace map coordinates: %2$s.', '%1$d individuals are missing birthplace map coordinates: %2$s.', $miscount, $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($hideflags, $hidelines)); }
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA define('WT_SCRIPT_NAME', 'pedigree.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Pedigree(); $controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); ?> <div id="pedigree-page"> <h2><?php echo $controller->getPageTitle(); ?> </h2> <form name="people" id="people" method="get" action="?"> <input type="hidden" name="ged" value="<?php echo WT_Filter::escapeHtml(WT_GEDCOM); ?> "> <input type="hidden" name="show_full" value="<?php echo $controller->show_full; ?>