size="12" name="gedcomid<?php echo $tree->getTreeId(); ?> " id="gedcomid<?php echo $tree->getTreeId(); ?> " value="<?php echo Filter::escapeHtml($tree->getUserPreference($user, 'gedcomid')); ?> " > <?php echo FunctionsPrint::printFindIndividualLink('gedcomid' . $tree->getTreeId(), '', $tree); ?> </td> <td> <select name="RELATIONSHIP_PATH_LENGTH<?php echo $tree->getTreeId(); ?> " id="RELATIONSHIP_PATH_LENGTH<?php echo $tree->getTreeId(); ?> " class="relpath"> <?php for ($n = 0; $n <= 10; ++$n) { ?> <option value="<?php echo $n;
<table class="list_table"> <tbody> <tr> <td class="descriptionbox"> <label for="rootid"><?php echo I18N::translate('Individual'); ?> </label> </td> <td class="optionbox"> <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->root->getXref(); ?> "> <?php echo FunctionsPrint::printFindIndividualLink('rootid'); ?> </td> <td rowspan="3" class="descriptionbox"> <label><?php echo I18N::translate('Layout'); ?> </label> </td> <td rowspan="3" class="optionbox"> <div> <label> <input type="radio" name="chart_style" value="0" onclick="statusDisable('cousins');" <?php echo $controller->chart_style == 0 ? 'checked' : ''; ?> >
/** * 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()); }
?> "> <?php echo Filter::getCsrf(); ?> <table class="facts_table"> <tr> <td class="facts_label"> <?php echo $label; ?> </td> <td class="facts_value"> <input data-autocomplete-type="INDI" id="spouseid" type="text" name="spid" size="8"> <?php echo FunctionsPrint::printFindIndividualLink('spouseid'); ?> </td> </tr> <?php FunctionsEdit::addSimpleTag('0 MARR Y'); ?> <?php FunctionsEdit::addSimpleTag('0 DATE', 'MARR'); ?> <?php FunctionsEdit::addSimpleTag('0 PLAC', 'MARR'); ?> <?php echo keep_chan($person); ?>
/** * This is a general purpose hook, allowing modules to respond to routes * of the form module.php?mod=FOO&mod_action=BAR * * @param string $mod_action */ public function modAction($mod_action) { switch ($mod_action) { case 'ajax': $html = $this->getSidebarAjaxContent(); header('Content-Type: text/html; charset=UTF-8'); echo $html; break; case 'index': global $controller, $WT_TREE; $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); $clip_ctrl = new ClippingsCartController(); $cart = Session::get('cart'); $controller = new PageController(); $controller->setPageTitle($this->getTitle())->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); echo '<script>'; echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}'; echo '</script>'; if (!$cart[$WT_TREE->getTreeId()]) { echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>'; } if ($clip_ctrl->action == 'add') { $record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE); if ($clip_ctrl->type === 'FAM') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"> <table> <thead> <tr> <td class="topbottombar"> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <input type="radio" name="others" value="parents"> <?php echo $record->getFullName(); ?> </td> </tr> <tr> <td class="optionbox"> <input type="radio" name="others" value="members" checked> <?php echo I18N::translate('%s and their children', $record->getFullName()); ?> </td> </tr> <tr> <td class="optionbox"> <input type="radio" name="others" value="descendants"> <?php echo I18N::translate('%s and their descendants', $record->getFullName()); ?> </td> </tr> </tbody> <tfoot> <tr> <td class="topbottombar"><input type="submit" value="<?php echo I18N::translate('continue'); ?> "> </td> </tr> </tfoot> </table> </form> <?php } elseif ($clip_ctrl->type === 'INDI') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"> <table> <thead> <tr> <td class="topbottombar"> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <label> <input type="radio" name="others" checked value="none"> <?php echo $record->getFullName(); ?> </label> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="parents"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s, her parents and siblings', $record->getFullName()); } else { echo I18N::translate('%s, his parents and siblings', $record->getFullName()); } ?> </label> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="members"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s, her spouses and children', $record->getFullName()); } else { echo I18N::translate('%s, his spouses and children', $record->getFullName()); } ?> </label> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="ancestors" id="ancestors"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s and her ancestors', $record->getFullName()); } else { echo I18N::translate('%s and his ancestors', $record->getFullName()); } ?> </label> <br> <?php echo I18N::translate('Number of generations'); ?> <input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('ancestors');"> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s, her ancestors and their families', $record->getFullName()); } else { echo I18N::translate('%s, his ancestors and their families', $record->getFullName()); } ?> </label> <br> <?php echo I18N::translate('Number of generations'); ?> <input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('ancestorsfamilies');"> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="descendants" id="descendants"> <?php if ($record->getSex() === 'F') { echo I18N::translate('%s, her spouses and descendants', $record->getFullName()); } else { echo I18N::translate('%s, his spouses and descendants', $record->getFullName()); } ?> </label> <br> <?php echo I18N::translate('Number of generations'); ?> <input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('descendants');"> </td> </tr> </tbody> <tfoot> <tr> <td class="topbottombar"> <input type="submit" value="<?php echo I18N::translate('continue'); ?> "> </td> </tr> </tfoot> </table> </form> <?php } elseif ($clip_ctrl->type === 'SOUR') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"> <table> <thead> <tr> <td class="topbottombar"> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <label> <input type="radio" name="others" checked value="none"> <?php echo $record->getFullName(); ?> </label> </td> </tr> <tr> <td class="optionbox"> <label> <input type="radio" name="others" value="linked"> <?php echo I18N::translate('%s and the individuals that reference it.', $record->getFullName()); ?> </label> </td> </tr> </tbody> <tfoot> <tr> <td class="topbottombar"> <input type="submit" value="<?php echo I18N::translate('continue'); ?> "> </td> </tr> </tfoot> </table> </form> <?php } } if (!$cart[$WT_TREE->getTreeId()]) { if ($clip_ctrl->action != 'add') { echo I18N::translate('The clippings cart allows you to take extracts (“clippings”) from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program. The downloadable file is recorded in GEDCOM format.<br><ul><li>How to take clippings?<br>This is really simple. Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name. There you will see the <b>Add to clippings cart</b> option. When you click that link you will be offered several options to download.</li><li>How to download?<br>Once you have items in your cart, you can download them just by clicking the “Download” link. Follow the instructions and links.</li></ul>'); ?> <form method="get" name="addin" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <thead> <tr> <td colspan="2" class="topbottombar"> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <input type="hidden" name="action" value="add"> <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5"> </td> <td class="optionbox"> <?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?> <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> <?php echo FunctionsPrint::printFindSourceLink('cart_item_id', ''); ?> <input type="submit" value="<?php echo I18N::translate('Add'); ?> "> </td> </tr> </tbody> </table> </form> <?php } // -- end new lines echo I18N::translate('Your clippings cart is empty.'); } else { // Keep track of the INDI from the parent page, otherwise it will // get lost after ajax updates $pid = Filter::get('pid', WT_REGEX_XREF); if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') { ?> <form method="get" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="action" value="download"> <input type="hidden" name="pid" value="<?php echo $pid; ?> "> <table> <tr> <td colspan="2" class="topbottombar"> <h2><?php echo I18N::translate('Download'); ?> </h2> </td> </tr> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('To reduce the size of the download, you can compress the data into a .ZIP file. You will need to uncompress the .ZIP file before you can use it.'); ?> </td> <td class="optionbox wrap"> <input type="checkbox" name="Zip" value="yes"> <?php echo I18N::translate('Zip file(s)'); ?> </td> </tr> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Include media (automatically zips files)'); ?> </td> <td class="optionbox"> <input type="checkbox" name="IncludeMedia" value="yes"> </td> </tr> <?php if (Auth::isManager($WT_TREE)) { ?> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Apply privacy settings'); ?> </td> <td class="optionbox"> <input type="radio" name="privatize_export" value="none" checked> <?php echo I18N::translate('None'); ?> <br> <input type="radio" name="privatize_export" value="gedadmin"> <?php echo I18N::translate('Manager'); ?> <br> <input type="radio" name="privatize_export" value="user"> <?php echo I18N::translate('Member'); ?> <br> <input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?> </td> </tr> <?php } elseif (Auth::isMember($WT_TREE)) { ?> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Apply privacy settings'); ?> </td> <td class="optionbox"> <input type="radio" name="privatize_export" value="user" checked> <?php echo I18N::translate('Member'); ?> <br> <input type="radio" name="privatize_export" value="visitor"> <?php echo I18N::translate('Visitor'); ?> </td> </tr> <?php } ?> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Convert from UTF-8 to ISO-8859-1'); ?> </td> <td class="optionbox"> <input type="checkbox" name="convert" value="yes"> </td> </tr> <tr> <td class="descriptionbox width50 wrap"> <?php echo I18N::translate('Add the GEDCOM media path to filenames'); ?> </td> <td class="optionbox"> <input type="checkbox" name="conv_path" value="<?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?> "> <span dir="auto"><?php echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH')); ?> </span> </td> </tr> <tr> <td class="topbottombar" colspan="2"> <input type="submit" value="<?php echo I18N::translate('Download'); ?> "> </td> </tr> </table> </form> <br> <form method="get" name="addin" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <thead> <tr> <td colspan="2" class="topbottombar" style="text-align:center; "> <?php echo I18N::translate('Add to the clippings cart'); ?> </td> </tr> </thead> <tbody> <tr> <td class="optionbox"> <input type="hidden" name="action" value="add"> <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8"> </td> <td class="optionbox"> <?php echo FunctionsPrint::printFindIndividualLink('cart_item_id'); ?> <?php echo FunctionsPrint::printFindFamilyLink('cart_item_id'); ?> <?php echo FunctionsPrint::printFindSourceLink('cart_item_id'); ?> <input type="submit" value="<?php echo I18N::translate('Add'); ?> "> </td> </tr> </tbody> <tfoot> <tr> <th colspan="2"> <a href="module.php?mod=clippings&mod_action=index&action=empty"> <?php echo I18N::translate('Empty the clippings cart'); ?> </a> </th> </tr> </tfoot> </table> </form> <?php } ?> <h2> <?php echo I18N::translate('Family tree clippings cart'); ?> </h2> <table id="mycart" class="sortable list_table width100"> <thead> <tr> <th class="list_label"><?php echo I18N::translate('Record'); ?> </th> <th class="list_label"><?php echo I18N::translate('Remove'); ?> </th> </tr> </thead> <tbody> <?php foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) { $record = GedcomRecord::getInstance($xref, $WT_TREE); if ($record) { switch ($record::RECORD_TYPE) { case 'INDI': $icon = 'icon-indis'; break; case 'FAM': $icon = 'icon-sfamily'; break; case 'SOUR': $icon = 'icon-source'; break; case 'REPO': $icon = 'icon-repository'; break; case 'NOTE': $icon = 'icon-note'; break; case 'OBJE': $icon = 'icon-media'; break; default: $icon = 'icon-clippings'; break; } ?> <tr> <td class="list_value"> <i class="<?php echo $icon; ?> "></i> <?php echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>'; ?> </td> <td class="list_value center vmiddle"><a href="module.php?mod=clippings&mod_action=index&action=remove&id=<?php echo $xref; ?> " class="icon-remove" title="<?php echo I18N::translate('Remove'); ?> "></a></td> </tr> <?php } } ?> </table> <?php } break; default: http_response_code(404); break; } }
echo '<form method="post" name="newmedia" action="addmedia.php" enctype="multipart/form-data">'; echo '<input type="hidden" name="action" value="', $action, '">'; echo '<input type="hidden" name="ged" value="', $WT_TREE->getNameHtml(), '">'; echo '<input type="hidden" name="pid" value="', $pid, '">'; if ($linktoid) { echo '<input type="hidden" name="linktoid" value="', $linktoid, '">'; } echo '<table class="facts_table">'; echo '<tr><td class="topbottombar" colspan="2">'; echo $controller->getPageTitle(), FunctionsPrint::helpLink('OBJE'); echo '</td></tr>'; if (!$linktoid && $action == 'create') { echo '<tr><td class="descriptionbox wrap width25">'; echo I18N::translate('Enter an individual, family, or source ID'); echo '</td><td class="optionbox wrap"><input type="text" data-autocomplete-type="IFS" name="linktoid" id="linktoid" size="6" value="">'; echo ' ', FunctionsPrint::printFindIndividualLink('linktoid'); echo ' ', FunctionsPrint::printFindFamilyLink('linktoid'); echo ' ', FunctionsPrint::printFindSourceLink('linktoid'); echo '<p class="small text-muted">', I18N::translate('Enter or search for the ID of the individual, family, or source to which this media object should be linked.'), '</p></td></tr>'; } if ($media) { $gedrec = $media->getGedcom(); } else { $gedrec = ''; } // 1 FILE if (preg_match('/\\n\\d (FILE.*)/', $gedrec, $match)) { $gedfile = $match[1]; } elseif ($filename) { $gedfile = 'FILE ' . $filename; } else {
?> </label> </td> <td class="optionbox" colspan="3"> <input id="place" data-autocomplete-type="PLAC" type="text" size="30" name="place"> </td> <td class="optionbox"> <label for="newpid"> <?php echo I18N::translate('Individual'); ?> </label> </td> <td class="optionbox"> <input id="newpid" class="pedigree_form" data-autocomplete-type="INDI" type="text" size="5" name="newpid"><?php echo FunctionsPrint::printFindIndividualLink('newpid'); ?> </td> </tr> <tr> <td class="optionbox"> <label for="beginYear"> <?php echo I18N::translate('Start year'); ?> </label> </td> <td class="optionbox"> <input id="beginYear" type="text" name="beginYear" size="5"> </td>
"> </td> </tr> <tr> <td class="descriptionbox"> <?php echo I18N::translate('Individual 2'); ?> </td> <td class="optionbox"> <input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="pid2" id="pid2" size="3" value="<?php echo $pid2; ?> "> <?php echo FunctionsPrint::printFindIndividualLink('pid2'); ?> <br> <a href="#" onclick="var x = jQuery('#pid1').val(); jQuery('#pid1').val(jQuery('#pid2').val()); jQuery('#pid2').val(x); return false;"><?php echo I18N::translate('Swap individuals'); ?> </a> </td> <td class="optionbox"> <label> <input type="radio" name="find_all" value="0" <?php echo $find_all ? '' : 'checked'; ?> > <?php echo I18N::translate('Find the closest relationships');
} } else { echo '<input data-autocomplete-type="OBJE" type="text" name="mediaid" id="mediaid" size="5">'; echo ' ', FunctionsPrint::printFindMediaLink('mediaid', '1media'); echo '</td></tr>'; } if (!isset($linktoid)) { $linktoid = ''; } echo '<tr><td class="descriptionbox">'; if ($linkto == "person") { echo I18N::translate('Individual'), "</td>"; echo '<td class="optionbox wrap">'; if ($linktoid == "") { echo '<input class="pedigree_form" type="text" name="linktoid" id="linktopid" size="3" value="', $linktoid, '"> '; echo FunctionsPrint::printFindIndividualLink('linktopid'); } else { $record = Individual::getInstance($linktoid, $WT_TREE); echo $record->formatList('span', false, $record->getFullName()); } } if ($linkto == "family") { echo I18N::translate('Family'), '</td>'; echo '<td class="optionbox wrap">'; if ($linktoid == "") { echo '<input class="pedigree_form" type="text" name="linktoid" id="linktofamid" size="3" value="', $linktoid, '"> '; echo FunctionsPrint::printFindFamilyLink('linktofamid'); } else { $record = Family::getInstance($linktoid, $WT_TREE); echo $record->formatList('span', false, $record->getFullName()); }
/** * An HTML form to edit block settings * * @param int $block_id */ public function configureBlock($block_id) { global $WT_TREE, $controller; $PEDIGREE_ROOT_ID = $WT_TREE->getPreference('PEDIGREE_ROOT_ID'); $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid'); if (Filter::postBool('save') && Filter::checkCsrf()) { $this->setBlockSetting($block_id, 'details', Filter::postBool('details')); $this->setBlockSetting($block_id, 'type', Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree')); $this->setBlockSetting($block_id, 'pid', Filter::post('pid', WT_REGEX_XREF)); } $details = $this->getBlockSetting($block_id, 'details', '0'); $type = $this->getBlockSetting($block_id, 'type', 'pedigree'); $pid = $this->getBlockSetting($block_id, 'pid', Auth::check() ? $gedcomid ? $gedcomid : $PEDIGREE_ROOT_ID : $PEDIGREE_ROOT_ID); $controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); ?> <tr> <td class="descriptionbox wrap width33"><?php echo I18N::translate('Chart type'); ?> </td> <td class="optionbox"> <?php echo FunctionsEdit::selectEditControl('type', array('pedigree' => I18N::translate('Pedigree'), 'descendants' => I18N::translate('Descendants'), 'hourglass' => I18N::translate('Hourglass chart'), 'treenav' => I18N::translate('Interactive tree')), null, $type); ?> </td> </tr> <tr> <td class="descriptionbox wrap width33"><?php echo I18N::translate('Show details'); ?> </td> <td class="optionbox"> <?php echo FunctionsEdit::editFieldYesNo('details', $details); ?> </td> </tr> <tr> <td class="descriptionbox wrap width33"><?php echo I18N::translate('Individual'); ?> </td> <td class="optionbox"> <input data-autocomplete-type="INDI" type="text" name="pid" id="pid" value="<?php echo $pid; ?> " size="5"> <?php echo FunctionsPrint::printFindIndividualLink('pid'); $root = Individual::getInstance($pid, $WT_TREE); if ($root) { echo ' <span class="list_item">', $root->getFullName(), $root->formatFirstMajorFact(WT_EVENTS_BIRT, 1), '</span>'; } ?> </td> </tr> <?php }
/** * Show and process a form to edit a story. */ private function edit() { global $WT_TREE; if (Auth::isEditor($WT_TREE)) { if (Filter::postBool('save') && Filter::checkCsrf()) { $block_id = Filter::postInteger('block_id'); if ($block_id) { Database::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $block_id)); } else { Database::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(Filter::postInteger('gedcom_id'), Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0)); $block_id = Database::getInstance()->lastInsertId(); } $this->setBlockSetting($block_id, 'title', Filter::post('title')); $this->setBlockSetting($block_id, 'story_body', Filter::post('story_body')); $languages = Filter::postArray('lang'); $this->setBlockSetting($block_id, 'languages', implode(',', $languages)); $this->config(); } else { $block_id = Filter::getInteger('block_id'); $controller = new PageController(); if ($block_id) { $controller->setPageTitle(I18N::translate('Edit story')); $title = $this->getBlockSetting($block_id, 'title'); $story_body = $this->getBlockSetting($block_id, 'story_body'); $xref = Database::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); } else { $controller->setPageTitle(I18N::translate('Add a story')); $title = ''; $story_body = ''; $xref = Filter::get('xref', WT_REGEX_XREF); } $controller->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); if (Module::getModuleByName('ckeditor')) { CkeditorModule::enableEditor($controller); } $individual = Individual::getInstance($xref, $WT_TREE); ?> <ol class="breadcrumb small"> <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?> </a></li> <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?> </a></li> <li><a href="module.php?mod=<?php echo $this->getName(); ?> &mod_action=admin_config"><?php echo $this->getTitle(); ?> </a></li> <li class="active"><?php echo $controller->getPageTitle(); ?> </li> </ol> <h1><?php echo $controller->getPageTitle(); ?> </h1> <form class="form-horizontal" method="post" action="module.php?mod=<?php echo $this->getName(); ?> &mod_action=admin_edit"> <?php echo Filter::getCsrf(); ?> <input type="hidden" name="save" value="1"> <input type="hidden" name="block_id" value="<?php echo $block_id; ?> "> <input type="hidden" name="gedcom_id" value="<?php echo $WT_TREE->getTreeId(); ?> "> <div class="form-group"> <label for="title" class="col-sm-3 control-label"> <?php echo I18N::translate('Story title'); ?> </label> <div class="col-sm-9"> <input type="text" class="form-control" name="title" id="title" value="<?php echo Filter::escapeHtml($title); ?> "> </div> </div> <div class="form-group"> <label for="story_body" class="col-sm-3 control-label"> <?php echo I18N::translate('Story'); ?> </label> <div class="col-sm-9"> <textarea name="story_body" id="story_body" class="html-edit form-control" rows="10"><?php echo Filter::escapeHtml($story_body); ?> </textarea> </div> </div> <div class="form-group"> <label for="xref" class="col-sm-3 control-label"> <?php echo I18N::translate('Individual'); ?> </label> <div class="col-sm-9"> <input data-autocomplete-type="INDI" type="text" name="xref" id="xref" size="4" value="<?php echo $xref; ?> "> <?php echo FunctionsPrint::printFindIndividualLink('xref'); ?> <?php if ($individual) { ?> <?php echo $individual->formatList('span'); ?> <?php } ?> </div> </div> <div class="form-group"> <label for="xref" class="col-sm-3 control-label"> <?php echo I18N::translate('Show this block for which languages?'); ?> </label> <div class="col-sm-9"> <?php echo FunctionsEdit::editLanguageCheckboxes('lang', explode(',', $this->getBlockSetting($block_id, 'languages'))); ?> </div> </div> <div class="form-group"> <div class="col-sm-offset-3 col-sm-9"> <button type="submit" class="btn btn-primary"> <i class="fa fa-check"></i> <?php echo I18N::translate('save'); ?> </button> </div> </div> </form> <?php } } else { header('Location: ' . WT_BASE_URL); } }
/** * Display a map showing the origins of ones ancestors. */ private function pedigreeMap() { global $controller, $WT_TREE; $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); // Limit this to match available number of icons. // 8 generations equals 255 individuals $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8); $controller = new ChartController(); $generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); $this->treesize = pow(2, $generations) - 1; $this->ancestors = array_values($controller->sosaAncestors($generations)); $controller->setPageTitle(I18N::translate('Pedigree map of %s', $controller->root->getFullName()))->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript("\n\t\t\t\tjQuery('head').prepend('<link type=\"text/css\" href =\"" . WT_STATIC_URL . WT_MODULES_DIR . "googlemap/css/wt_v3_googlemap.css\" rel=\"stylesheet\">');\n\t\t\t\tautocomplete();" . $this->pedigreeMapJavascript()); 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"> <tr> <td class="descriptionbox wrap"> <label for="rootid"> <?php echo I18N::translate('Individual'); ?> </label> </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"> <label for="PEDIGREE_GENERATIONS"> <?php echo I18N::translate('Generations'); ?> </label> </td> <td class="optionbox"> <select name="PEDIGREE_GENERATIONS" id="PEDIGREE_GENERATIONS"> <?php for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) { echo '<option value="', $p, '" '; if ($p == $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 = array(); $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] = strtr($latlongval[$i]->pl_lati, array('N' => '', 'S' => '-', ',' => '.')); $lon[$i] = strtr($latlongval[$i]->pl_long, array('N' => '', 'S' => '-', ',' => '.')); if ($lat[$i] && $lon[$i]) { $count++; } else { // The place is in the table but has empty values if ($name) { $missing[] = '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>'; $miscount++; } } } else { // There was no place, or not listed in the map table if ($name) { $missing[] = '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>'; $miscount++; } } } } //<!-- end of count records by type --> //<!-- start of map display --> echo '<div class="gm-pedigree-map">'; echo '<div class="gm-wrapper">'; echo '<div class="gm-map"><i class="icon-loading-large"></i></div>'; echo '<div class="gm-ancestors"></div>'; echo '</div>'; if (Auth::isAdmin()) { echo '<div class="gm-options noprint">'; echo '<a href="module.php?mod=' . $this->getName() . '&mod_action=admin_config">' . I18N::translate('Google Maps™ preferences') . '</a>'; echo ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_places">' . I18N::translate('Geographic data') . '</a>'; echo ' | <a href="module.php?mod=' . $this->getName() . '&mod_action=admin_placecheck">' . I18N::translate('Place check') . '</a>'; echo '</div>'; } // display info under map echo '<hr>'; // print summary statistics if (isset($curgen)) { $total = pow(2, $curgen) - 1; echo '<div>'; 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)); echo '</div>'; if ($priv) { echo '<div>' . I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '</div>'; } if ($count + $priv != $total) { if ($miscount == 0) { echo '<div>' . I18N::translate('No ancestors in the database.'), '</div>'; } else { echo '<div>' . 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), implode(I18N::$list_separator, $missing)), '</div>'; } } } echo '</div>'; echo '</div>'; echo '<script src="', $this->googleMapsScript(), '"></script>'; }
/** * Generate the HTML content of this block. * * @param int $block_id * @param bool $template * @param string[] $cfg * * @return string */ public function getBlock($block_id, $template = true, $cfg = array()) { global $ctype, $controller, $WT_TREE; $action = Filter::get('action'); switch ($action) { case 'deletefav': $favorite_id = Filter::getInteger('favorite_id'); if ($favorite_id) { self::deleteFavorite($favorite_id); } break; case 'addfav': $gid = Filter::get('gid', WT_REGEX_XREF); $favnote = Filter::get('favnote'); $url = Filter::getUrl('url'); $favtitle = Filter::get('favtitle'); if ($gid) { $record = GedcomRecord::getInstance($gid, $WT_TREE); if ($record && $record->canShow()) { self::addFavorite(array('user_id' => $ctype === 'user' ? Auth::id() : null, 'gedcom_id' => $WT_TREE->getTreeId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => $favnote, 'title' => $favtitle)); } } elseif ($url) { self::addFavorite(array('user_id' => $ctype === 'user' ? Auth::id() : null, 'gedcom_id' => $WT_TREE->getTreeId(), 'gid' => null, 'type' => 'URL', 'url' => $url, 'note' => $favnote, 'title' => $favtitle ? $favtitle : $url)); } break; } $block = $this->getBlockSetting($block_id, 'block', '0'); foreach (array('block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } $userfavs = $this->getFavorites($ctype === 'user' ? Auth::id() : $WT_TREE->getTreeId()); if (!is_array($userfavs)) { $userfavs = array(); } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = $this->getTitle(); if (Auth::check()) { $controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); } $content = ''; if ($userfavs) { foreach ($userfavs as $key => $favorite) { if (isset($favorite['id'])) { $key = $favorite['id']; } $removeFavourite = '<a class="font9" href="index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameHtml() . '&action=deletefav&favorite_id=' . $key . '" onclick="return confirm(\'' . I18N::translate('Are you sure you want to remove this item from your list of favorites?') . '\');">' . I18N::translate('Remove') . '</a> '; if ($favorite['type'] == 'URL') { $content .= '<div id="boxurl' . $key . '.0" class="person_box">'; if ($ctype == 'user' || Auth::isManager($WT_TREE)) { $content .= $removeFavourite; } $content .= '<a href="' . $favorite['url'] . '"><b>' . $favorite['title'] . '</b></a>'; $content .= '<br>' . $favorite['note']; $content .= '</div>'; } else { $record = GedcomRecord::getInstance($favorite['gid'], $WT_TREE); if ($record && $record->canShow()) { if ($record instanceof Individual) { $content .= '<div id="box' . $favorite["gid"] . '.0" class="person_box action_header'; switch ($record->getsex()) { case 'M': break; case 'F': $content .= 'F'; break; default: $content .= 'NN'; break; } $content .= '">'; if ($ctype == "user" || Auth::isManager($WT_TREE)) { $content .= $removeFavourite; } $content .= Theme::theme()->individualBoxLarge($record); $content .= $favorite['note']; $content .= '</div>'; } else { $content .= '<div id="box' . $favorite['gid'] . '.0" class="person_box">'; if ($ctype == 'user' || Auth::isManager($WT_TREE)) { $content .= $removeFavourite; } $content .= $record->formatList('span'); $content .= '<br>' . $favorite['note']; $content .= '</div>'; } } } } } if ($ctype == 'user' || Auth::isManager($WT_TREE)) { $uniqueID = Uuid::uuid4(); // This block can theoretically appear multiple times, so use a unique ID. $content .= '<div class="add_fav_head">'; $content .= '<a href="#" onclick="return expand_layer(\'add_fav' . $uniqueID . '\');">' . I18N::translate('Add a new favorite') . '<i id="add_fav' . $uniqueID . '_img" class="icon-plus"></i></a>'; $content .= '</div>'; $content .= '<div id="add_fav' . $uniqueID . '" style="display: none;">'; $content .= '<form name="addfavform" method="get" action="index.php">'; $content .= '<input type="hidden" name="action" value="addfav">'; $content .= '<input type="hidden" name="ctype" value="' . $ctype . '">'; $content .= '<input type="hidden" name="ged" value="' . $WT_TREE->getNameHtml() . '">'; $content .= '<div class="add_fav_ref">'; $content .= '<input type="radio" name="fav_category" value="record" checked onclick="jQuery(\'#gid' . $uniqueID . '\').removeAttr(\'disabled\'); jQuery(\'#url, #favtitle\').attr(\'disabled\',\'disabled\').val(\'\');">'; $content .= '<label for="gid' . $uniqueID . '">' . I18N::translate('Enter an individual, family, or source ID') . '</label>'; $content .= '<input class="pedigree_form" data-autocomplete-type="IFSRO" type="text" name="gid" id="gid' . $uniqueID . '" size="5" value="">'; $content .= ' ' . FunctionsPrint::printFindIndividualLink('gid' . $uniqueID); $content .= ' ' . FunctionsPrint::printFindFamilyLink('gid' . $uniqueID); $content .= ' ' . FunctionsPrint::printFindSourceLink('gid' . $uniqueID); $content .= ' ' . FunctionsPrint::printFindRepositoryLink('gid' . $uniqueID); $content .= ' ' . FunctionsPrint::printFindNoteLink('gid' . $uniqueID); $content .= ' ' . FunctionsPrint::printFindMediaLink('gid' . $uniqueID); $content .= '</div>'; $content .= '<div class="add_fav_url">'; $content .= '<input type="radio" name="fav_category" value="url" onclick="jQuery(\'#url, #favtitle\').removeAttr(\'disabled\'); jQuery(\'#gid' . $uniqueID . '\').attr(\'disabled\',\'disabled\').val(\'\');">'; $content .= '<input type="text" name="url" id="url" size="20" value="" placeholder="' . GedcomTag::getLabel('URL') . '" disabled> '; $content .= '<input type="text" name="favtitle" id="favtitle" size="20" value="" placeholder="' . I18N::translate('Title') . '" disabled>'; $content .= '<p>' . I18N::translate('Enter an optional note about this favorite') . '</p>'; $content .= '<textarea name="favnote" rows="6" cols="50"></textarea>'; $content .= '</div>'; $content .= '<input type="submit" value="' . I18N::translate('Add') . '">'; $content .= '</form></div>'; } if ($template) { if ($block) { $class .= ' small_inner_block'; } return Theme::theme()->formatBlock($id, $title, $class, $content); } else { return $content; } }
/** * add a new tag input field * * called for each fact to be edited on a form. * Fact level=0 means a new empty form : data are POSTed by name * else data are POSTed using arrays : * glevels[] : tag level * islink[] : tag is a link * tag[] : tag name * text[] : tag value * * @param string $tag fact record to edit (eg 2 DATE xxxxx) * @param string $upperlevel optional upper level tag (eg BIRT) * @param string $label An optional label to echo instead of the default * @param string $extra optional text to display after the input field * @param Individual $person For male/female translations * * @return string */ public static function addSimpleTag($tag, $upperlevel = '', $label = '', $extra = null, Individual $person = null) { global $tags, $main_fact, $xref, $bdm, $action, $WT_TREE; // Keep track of SOUR fields, so we can reference them in subsequent PAGE fields. static $source_element_id; $subnamefacts = array('NPFX', 'GIVN', 'SPFX', 'SURN', 'NSFX', '_MARNM_SURN'); preg_match('/^(?:(\\d+) (' . WT_REGEX_TAG . ') ?(.*))/', $tag, $match); list(, $level, $fact, $value) = $match; $level = (int) $level; // element name : used to POST data if ($level === 0) { if ($upperlevel) { $element_name = $upperlevel . '_' . $fact; } else { $element_name = $fact; } } else { $element_name = 'text[]'; } if ($level === 1) { $main_fact = $fact; } // element id : used by javascript functions if ($level === 0) { $element_id = $fact; } else { $element_id = $fact . Uuid::uuid4(); } if ($upperlevel) { $element_id = $upperlevel . '_' . $fact . Uuid::uuid4(); } // field value $islink = substr($value, 0, 1) === '@' && substr($value, 0, 2) !== '@#'; if ($islink) { $value = trim(substr($tag, strlen($fact) + 3), ' @\\r'); } else { $value = (string) substr($tag, strlen($fact) + 3); } if ($fact === 'REPO' || $fact === 'SOUR' || $fact === 'OBJE' || $fact === 'FAMC') { $islink = true; } if ($fact === 'SHARED_NOTE_EDIT' || $fact === 'SHARED_NOTE') { $islink = true; $fact = 'NOTE'; } // label echo '<tr id="', $element_id, '_tr"'; if ($fact === 'MAP' || ($fact === 'LATI' || $fact === 'LONG') && $value === '') { echo ' style="display:none;"'; } echo '>'; if (in_array($fact, $subnamefacts) || $fact === 'LATI' || $fact === 'LONG') { echo '<td class="optionbox wrap width25">'; } else { echo '<td class="descriptionbox wrap width25">'; } // tag name if ($label) { echo $label; } elseif ($upperlevel) { echo GedcomTag::getLabel($upperlevel . ':' . $fact); } else { echo GedcomTag::getLabel($fact); } // If using GEDFact-assistant window if ($action === 'addnewnote_assisted') { // Do not print on GEDFact Assistant window } else { // Not all facts have help text. switch ($fact) { case 'NAME': if ($upperlevel !== 'REPO' && $upperlevel !== 'UNKNOWN') { echo FunctionsPrint::helpLink($fact); } break; case 'DATE': case 'PLAC': case 'RESN': case 'ROMN': case 'SURN': case '_HEB': echo FunctionsPrint::helpLink($fact); break; } } // tag level if ($level > 0) { if ($fact === 'TEXT' && $level > 1) { echo '<input type="hidden" name="glevels[]" value="', $level - 1, '">'; echo '<input type="hidden" name="islink[]" value="0">'; echo '<input type="hidden" name="tag[]" value="DATA">'; // leave data text[] value empty because the following TEXT line will cause the DATA to be added echo '<input type="hidden" name="text[]" value="">'; } echo '<input type="hidden" name="glevels[]" value="', $level, '">'; echo '<input type="hidden" name="islink[]" value="', $islink, '">'; echo '<input type="hidden" name="tag[]" value="', $fact, '">'; } echo '</td>'; // value echo '<td class="optionbox wrap">'; // retrieve linked NOTE if ($fact === 'NOTE' && $islink) { $note1 = Note::getInstance($value, $WT_TREE); if ($note1) { $noterec = $note1->getGedcom(); preg_match('/' . $value . '/i', $noterec, $notematch); $value = $notematch[0]; } } // Show names for spouses in MARR/HUSB/AGE and MARR/WIFE/AGE if ($fact === 'HUSB' || $fact === 'WIFE') { $family = Family::getInstance($xref, $WT_TREE); if ($family) { $spouse_link = $family->getFirstFact($fact); if ($spouse_link) { $spouse = $spouse_link->getTarget(); if ($spouse) { echo $spouse->getFullName(); } } } } if (in_array($fact, Config::emptyFacts()) && ($value === '' || $value === 'Y' || $value === 'y')) { echo '<input type="hidden" id="', $element_id, '" name="', $element_name, '" value="', $value, '">'; if ($level <= 1) { echo '<input type="checkbox" '; if ($value) { echo 'checked'; } echo ' onclick="document.getElementById(\'' . $element_id . '\').value = (this.checked) ? \'Y\' : \'\';">'; echo I18N::translate('yes'); } if ($fact === 'CENS' && $value === 'Y') { echo self::censusDateSelector(WT_LOCALE, $xref); if (Module::getModuleByName('GEDFact_assistant') && GedcomRecord::getInstance($xref, $WT_TREE) instanceof Individual) { echo '<div></div><a href="#" style="display: none;" id="assistant-link" onclick="return activateCensusAssistant();">' . I18N::translate('Create a new shared note using assistant') . '</a></div>'; } } } elseif ($fact === 'TEMP') { echo self::selectEditControl($element_name, GedcomCodeTemp::templeNames(), I18N::translate('No temple - living ordinance'), $value); } elseif ($fact === 'ADOP') { echo self::editFieldAdoption($element_name, $value, '', $person); } elseif ($fact === 'PEDI') { echo self::editFieldPedigree($element_name, $value, '', $person); } elseif ($fact === 'STAT') { echo self::selectEditControl($element_name, GedcomCodeStat::statusNames($upperlevel), '', $value); } elseif ($fact === 'RELA') { echo self::editFieldRelationship($element_name, strtolower($value)); } elseif ($fact === 'QUAY') { echo self::selectEditControl($element_name, GedcomCodeQuay::getValues(), '', $value); } elseif ($fact === '_WT_USER') { echo self::editFieldUsername($element_name, $value); } elseif ($fact === 'RESN') { echo self::editFieldRestriction($element_name, $value); } elseif ($fact === '_PRIM') { echo '<select id="', $element_id, '" name="', $element_name, '" >'; echo '<option value=""></option>'; echo '<option value="Y" '; if ($value === 'Y') { echo ' selected'; } echo '>', I18N::translate('always'), '</option>'; echo '<option value="N" '; if ($value === 'N') { echo 'selected'; } echo '>', I18N::translate('never'), '</option>'; echo '</select>'; echo '<p class="small text-muted">', I18N::translate('Use this image for charts and on the individual’s page.'), '</p>'; } elseif ($fact === 'SEX') { echo '<select id="', $element_id, '" name="', $element_name, '"><option value="M" '; if ($value === 'M') { echo 'selected'; } echo '>', I18N::translate('Male'), '</option><option value="F" '; if ($value === 'F') { echo 'selected'; } echo '>', I18N::translate('Female'), '</option><option value="U" '; if ($value === 'U' || empty($value)) { echo 'selected'; } echo '>', I18N::translateContext('unknown gender', 'Unknown'), '</option></select>'; } elseif ($fact === 'TYPE' && $level === 3) { //-- Build the selector for the Media 'TYPE' Fact echo '<select name="text[]"><option selected value="" ></option>'; $selectedValue = strtolower($value); if (!array_key_exists($selectedValue, GedcomTag::getFileFormTypes())) { echo '<option selected value="', Filter::escapeHtml($value), '" >', Filter::escapeHtml($value), '</option>'; } foreach (GedcomTag::getFileFormTypes() as $typeName => $typeValue) { echo '<option value="', $typeName, '" '; if ($selectedValue === $typeName) { echo 'selected'; } echo '>', $typeValue, '</option>'; } echo '</select>'; } elseif ($fact === 'NAME' && $upperlevel !== 'REPO' && $upperlevel !== 'UNKNOWN' || $fact === '_MARNM') { // Populated in javascript from sub-tags echo '<input type="hidden" id="', $element_id, '" name="', $element_name, '" onchange="updateTextName(\'', $element_id, '\');" value="', Filter::escapeHtml($value), '" class="', $fact, '">'; echo '<span id="', $element_id, '_display" dir="auto">', Filter::escapeHtml($value), '</span>'; echo ' <a href="#edit_name" onclick="convertHidden(\'', $element_id, '\'); return false;" class="icon-edit_indi" title="' . I18N::translate('Edit name') . '"></a>'; } else { // textarea if ($fact === 'TEXT' || $fact === 'ADDR' || $fact === 'NOTE' && !$islink) { echo '<textarea id="', $element_id, '" name="', $element_name, '" dir="auto">', Filter::escapeHtml($value), '</textarea><br>'; } else { // text // If using GEDFact-assistant window if ($action === 'addnewnote_assisted') { echo '<input type="text" id="', $element_id, '" name="', $element_name, '" value="', Filter::escapeHtml($value), '" style="width:4.1em;" dir="ltr"'; } else { echo '<input type="text" id="', $element_id, '" name="', $element_name, '" value="', Filter::escapeHtml($value), '" dir="ltr"'; } echo ' class="', $fact, '"'; if (in_array($fact, $subnamefacts)) { echo ' onblur="updatewholename();" onkeyup="updatewholename();"'; } // Extra markup for specific fact types switch ($fact) { case 'ALIA': case 'ASSO': case '_ASSO': echo ' data-autocomplete-type="ASSO" data-autocomplete-extra="input.DATE"'; break; case 'DATE': echo ' onblur="valid_date(this);" onmouseout="valid_date(this);"'; break; case 'GIVN': echo ' autofocus data-autocomplete-type="GIVN"'; break; case 'LATI': echo ' onblur="valid_lati_long(this, \'N\', \'S\');" onmouseout="valid_lati_long(this, \'N\', \'S\');"'; break; case 'LONG': echo ' onblur="valid_lati_long(this, \'E\', \'W\');" onmouseout="valid_lati_long(this, \'E\', \'W\');"'; break; case 'NOTE': // Shared notes. Inline notes are handled elsewhere. echo ' data-autocomplete-type="NOTE"'; break; case 'OBJE': echo ' data-autocomplete-type="OBJE"'; break; case 'PAGE': echo ' data-autocomplete-type="PAGE" data-autocomplete-extra="#' . $source_element_id . '"'; break; case 'PLAC': echo ' data-autocomplete-type="PLAC"'; break; case 'REPO': echo ' data-autocomplete-type="REPO"'; break; case 'SOUR': $source_element_id = $element_id; echo ' data-autocomplete-type="SOUR"'; break; case 'SURN': case '_MARNM_SURN': echo ' data-autocomplete-type="SURN"'; break; case 'TIME': echo ' pattern="([0-1][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?" dir="ltr" placeholder="' . I18N::translate('hh:mm or hh:mm:ss') . '"'; break; } echo '>'; } $tmp_array = array('TYPE', 'TIME', 'NOTE', 'SOUR', 'REPO', 'OBJE', 'ASSO', '_ASSO', 'AGE'); // split PLAC if ($fact === 'PLAC') { echo '<div id="', $element_id, '_pop" style="display: inline;">'; echo FunctionsPrint::printSpecialCharacterLink($element_id), ' ', FunctionsPrint::printFindPlaceLink($element_id); echo '<span onclick="jQuery(\'tr[id^=', $upperlevel, '_LATI],tr[id^=', $upperlevel, '_LONG],tr[id^=LATI],tr[id^=LONG]\').toggle(\'fast\'); return false;" class="icon-target" title="', GedcomTag::getLabel('LATI'), ' / ', GedcomTag::getLabel('LONG'), '"></span>'; echo '</div>'; if (Module::getModuleByName('places_assistant')) { \PlacesAssistantModule::setup_place_subfields($element_id); \PlacesAssistantModule::print_place_subfields($element_id); } } elseif (!in_array($fact, $tmp_array)) { echo FunctionsPrint::printSpecialCharacterLink($element_id); } } // MARRiage TYPE : hide text field and show a selection list if ($fact === 'TYPE' && $level === 2 && $tags[0] === 'MARR') { echo '<script>'; echo 'document.getElementById(\'', $element_id, '\').style.display=\'none\''; echo '</script>'; echo '<select id="', $element_id, '_sel" onchange="document.getElementById(\'', $element_id, '\').value=this.value;" >'; foreach (array('Unknown', 'Civil', 'Religious', 'Partners') as $key) { if ($key === 'Unknown') { echo '<option value="" '; } else { echo '<option value="', $key, '" '; } $a = strtolower($key); $b = strtolower($value); if ($b !== '' && strpos($a, $b) !== false || strpos($b, $a) !== false) { echo 'selected'; } echo '>', GedcomTag::getLabel('MARR_' . strtoupper($key)), '</option>'; } echo '</select>'; } elseif ($fact === 'TYPE' && $level === 0) { // NAME TYPE : hide text field and show a selection list $onchange = 'onchange="document.getElementById(\'' . $element_id . '\').value=this.value;"'; echo self::editFieldNameType($element_name, $value, $onchange, $person); echo '<script>document.getElementById("', $element_id, '").style.display="none";</script>'; } // popup links switch ($fact) { case 'DATE': echo self::printCalendarPopup($element_id); break; case 'FAMC': case 'FAMS': echo FunctionsPrint::printFindFamilyLink($element_id); break; case 'ALIA': case 'ASSO': case '_ASSO': echo FunctionsPrint::printFindIndividualLink($element_id, $element_id . '_description'); break; case 'FILE': FunctionsPrint::printFindMediaLink($element_id, '0file'); break; case 'SOUR': echo FunctionsPrint::printFindSourceLink($element_id, $element_id . '_description'), ' ', self::printAddNewSourceLink($element_id); //-- checkboxes to apply '1 SOUR' to BIRT/MARR/DEAT as '2 SOUR' if ($level === 1) { echo '<br>'; switch ($WT_TREE->getPreference('PREFER_LEVEL2_SOURCES')) { case '2': // records $level1_checked = 'checked'; $level2_checked = ''; break; case '1': // facts $level1_checked = ''; $level2_checked = 'checked'; break; case '0': // none // none default: $level1_checked = ''; $level2_checked = ''; break; } if (strpos($bdm, 'B') !== false) { echo ' <label><input type="checkbox" name="SOUR_INDI" ', $level1_checked, ' value="1">', I18N::translate('Individual'), '</label>'; if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { if (!in_array($match, explode('|', WT_EVENTS_DEAT))) { echo ' <label><input type="checkbox" name="SOUR_', $match, '" ', $level2_checked, ' value="1">', GedcomTag::getLabel($match), '</label>'; } } } } if (strpos($bdm, 'D') !== false) { if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { foreach ($matches[1] as $match) { if (in_array($match, explode('|', WT_EVENTS_DEAT))) { echo ' <label><input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">', GedcomTag::getLabel($match), '</label>'; } } } } if (strpos($bdm, 'M') !== false) { echo ' <label><input type="checkbox" name="SOUR_FAM" ', $level1_checked, ' value="1">', I18N::translate('Family'), '</label>'; if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) { foreach ($matches[1] as $match) { echo ' <label><input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">', GedcomTag::getLabel($match), '</label>'; } } } } break; case 'REPO': echo FunctionsPrint::printFindRepositoryLink($element_id), ' ', self::printAddNewRepositoryLink($element_id); break; case 'NOTE': // Shared Notes Icons ======================================== if ($islink) { // Print regular Shared Note icons --------------------------- echo ' ', FunctionsPrint::printFindNoteLink($element_id, $element_id . '_description'), ' ', self::printAddNewNoteLink($element_id); if ($value) { echo ' ', self::printEditNoteLink($value); } } break; case 'OBJE': echo FunctionsPrint::printFindMediaLink($element_id, '1media'); if (!$value) { echo ' ', self::printAddNewMediaLink($element_id); $value = 'new'; } break; } echo '<div id="' . $element_id . '_description">'; // current value if ($fact === 'DATE') { $date = new Date($value); echo $date->display(); } if (($fact === 'ASSO' || $fact === '_ASSO') && $value === '') { if ($level === 1) { echo '<p class="small text-muted">' . I18N::translate('An associate is another individual who was involved with this individual, such as a friend or an employer.') . '</p>'; } else { echo '<p class="small text-muted">' . I18N::translate('An associate is another individual who was involved with this fact or event, such as a witness or a priest.') . '</p>'; } } if ($value && $value !== 'new' && $islink) { switch ($fact) { case 'ALIA': case 'ASSO': case '_ASSO': $tmp = Individual::getInstance($value, $WT_TREE); if ($tmp) { echo ' ', $tmp->getFullName(); } break; case 'SOUR': $tmp = Source::getInstance($value, $WT_TREE); if ($tmp) { echo ' ', $tmp->getFullName(); } break; case 'NOTE': $tmp = Note::getInstance($value, $WT_TREE); if ($tmp) { echo ' ', $tmp->getFullName(); } break; case 'OBJE': $tmp = Media::getInstance($value, $WT_TREE); if ($tmp) { echo ' ', $tmp->getFullName(); } break; case 'REPO': $tmp = Repository::getInstance($value, $WT_TREE); if ($tmp) { echo ' ', $tmp->getFullName(); } break; } } // pastable values if ($fact === 'FORM' && $upperlevel === 'OBJE') { FunctionsPrint::printAutoPasteLink($element_id, Config::fileFormats()); } echo '</div>', $extra, '</td></tr>'; return $element_id; }
/** * {@inhericDoc} * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() */ protected function renderContent() { ?> <div id="maj-sosa-config-page"> <h2><?php echo $this->data->get('title'); ?> </h2> <form name="maj-sosa-config-form" method="post" action="<?php echo $this->data->get('form_url'); ?> "> <input type="hidden" name="action" value="update"> <?php echo Filter::getCsrf(); ?> <div id="maj-sosa-config-page-table"> <div class="label"> <?php echo I18N::translate('Tree'); ?> </div> <div class="value"> <label><?php echo $this->data->get('tree')->getTitleHtml(); ?> </label> </div> <div class="label"> <?php echo I18N::translate('For user'); ?> </div> <div class="value"> <?php $users = $this->data->get('users_settings'); if (count($users) == 1) { $root_indi = $users[0]['rootid']; ?> <label> <input id="maj_sosa_input_userid" type="hidden" name="userid" value="<?php echo $users[0]['user']->getUserId(); ?> " /> <?php echo $users[0]['user']->getRealNameHtml(); ?> </label> <?php } else { if (count($users) > 1) { ?> <select id='maj-sosa-config-select' name="userid"> <?php $root_indi = $users[0]['rootid']; foreach ($this->data->get('users_settings') as $user) { ?> <option value="<?php echo $user['user']->getUserId(); ?> "><?php echo $user['user']->getRealNameHtml(); ?> </option> <?php } ?> </select> <?php } } ?> </div> <div class="label"> <?php echo I18N::translate('Root individual'); ?> </div> <div class="value"> <input data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $root_indi; ?> "> <?php echo FunctionsPrint::printFindIndividualLink('rootid'); ?> </div> <div class="label"></div> <div class="value"> <input type="submit" value="<?php echo I18N::translate('Save'); ?> "> <input type="button" value="<?php echo I18N::translate('Compute'); ?> " id="bt_sosa_compute"> <span id="bt_sosa_computing"></span> </div> </div> </form> <?php }