18c2e8227SGreg Roach<?php 28c2e8227SGreg Roach/** 38c2e8227SGreg Roach * webtrees: online genealogy 46bdf7674SGreg Roach * Copyright (C) 2017 webtrees development team 58c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify 68c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by 78c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or 88c2e8227SGreg Roach * (at your option) any later version. 98c2e8227SGreg Roach * This program is distributed in the hope that it will be useful, 108c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 118c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 128c2e8227SGreg Roach * GNU General Public License for more details. 138c2e8227SGreg Roach * You should have received a copy of the GNU General Public License 148c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 158c2e8227SGreg Roach */ 1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module; 1776692c8bSGreg Roach 180e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth; 190e62c4b8SGreg Roachuse Fisharebest\Webtrees\Date; 200e62c4b8SGreg Roachuse Fisharebest\Webtrees\Family; 213d7a8a4cSGreg Roachuse Fisharebest\Webtrees\Functions\Functions; 220e62c4b8SGreg Roachuse Fisharebest\Webtrees\GedcomTag; 230e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 240e62c4b8SGreg Roachuse Fisharebest\Webtrees\Individual; 250e62c4b8SGreg Roachuse Fisharebest\Webtrees\Theme; 268c2e8227SGreg Roach 278c2e8227SGreg Roach/** 288c2e8227SGreg Roach * Class RelativesTabModule 298c2e8227SGreg Roach */ 30e2a378d3SGreg Roachclass RelativesTabModule extends AbstractModule implements ModuleTabInterface { 3176692c8bSGreg Roach /** 3276692c8bSGreg Roach * How should this module be labelled on tabs, menus, etc.? 3376692c8bSGreg Roach * 3476692c8bSGreg Roach * @return string 3576692c8bSGreg Roach */ 368c2e8227SGreg Roach public function getTitle() { 378c2e8227SGreg Roach return /* I18N: Name of a module */ I18N::translate('Families'); 388c2e8227SGreg Roach } 398c2e8227SGreg Roach 4076692c8bSGreg Roach /** 4176692c8bSGreg Roach * A sentence describing what this module does. 4276692c8bSGreg Roach * 4376692c8bSGreg Roach * @return string 4476692c8bSGreg Roach */ 458c2e8227SGreg Roach public function getDescription() { 468c2e8227SGreg Roach return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); 478c2e8227SGreg Roach } 488c2e8227SGreg Roach 4976692c8bSGreg Roach /** 5076692c8bSGreg Roach * The user can re-arrange the tab order, but until they do, this 5176692c8bSGreg Roach * is the order in which tabs are shown. 5276692c8bSGreg Roach * 5376692c8bSGreg Roach * @return int 5476692c8bSGreg Roach */ 558c2e8227SGreg Roach public function defaultTabOrder() { 568c2e8227SGreg Roach return 20; 578c2e8227SGreg Roach } 588c2e8227SGreg Roach 598c2e8227SGreg Roach /** 6076692c8bSGreg Roach * Display the age difference between marriages and the births of children. 6176692c8bSGreg Roach * 628c2e8227SGreg Roach * @param Date $prev 638c2e8227SGreg Roach * @param Date $next 64cbc1590aSGreg Roach * @param int $child_number 658c2e8227SGreg Roach * 668c2e8227SGreg Roach * @return string 678c2e8227SGreg Roach */ 68ffd703eaSGreg Roach private static function ageDifference(Date $prev, Date $next, $child_number = 0) { 698c2e8227SGreg Roach if ($prev->isOK() && $next->isOK()) { 708c2e8227SGreg Roach $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); 718c2e8227SGreg Roach if ($days < 0) { 728c2e8227SGreg Roach // Show warning triangle if dates in reverse order 738c2e8227SGreg Roach $diff = '<i class="icon-warning"></i> '; 748c2e8227SGreg Roach } elseif ($child_number > 1 && $days > 1 && $days < 240) { 758c2e8227SGreg Roach // Show warning triangle if children born too close together 768c2e8227SGreg Roach $diff = '<i class="icon-warning"></i> '; 778c2e8227SGreg Roach } else { 788c2e8227SGreg Roach $diff = ''; 798c2e8227SGreg Roach } 808c2e8227SGreg Roach 818c2e8227SGreg Roach $months = round($days * 12 / 365.25); // Approximate - we do not know the calendar 828c2e8227SGreg Roach if (abs($months) == 12 || abs($months) >= 24) { 83def7396fSGreg Roach $diff .= I18N::plural('%s year', '%s years', round($months / 12), I18N::number(round($months / 12))); 848c2e8227SGreg Roach } elseif ($months != 0) { 85def7396fSGreg Roach $diff .= I18N::plural('%s month', '%s months', $months, I18N::number($months)); 868c2e8227SGreg Roach } 878c2e8227SGreg Roach 888c2e8227SGreg Roach return '<div class="elderdate age">' . $diff . '</div>'; 898c2e8227SGreg Roach } else { 908c2e8227SGreg Roach return ''; 918c2e8227SGreg Roach } 928c2e8227SGreg Roach } 938c2e8227SGreg Roach 948c2e8227SGreg Roach /** 9576692c8bSGreg Roach * Print a family group. 9676692c8bSGreg Roach * 978c2e8227SGreg Roach * @param Family $family 988c2e8227SGreg Roach * @param string $type 998c2e8227SGreg Roach * @param string $label 1008c2e8227SGreg Roach */ 101ffd703eaSGreg Roach private function printFamily(Family $family, $type, $label) { 1028c2e8227SGreg Roach global $controller; 1038c2e8227SGreg Roach 1044b9ff166SGreg Roach if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { 1054b9ff166SGreg Roach $access_level = Auth::PRIV_HIDE; 1068c2e8227SGreg Roach } else { 1074b9ff166SGreg Roach $access_level = Auth::accessLevel($family->getTree()); 1088c2e8227SGreg Roach } 1098c2e8227SGreg Roach 1108c2e8227SGreg Roach ?> 1118c2e8227SGreg Roach <table> 1128c2e8227SGreg Roach <tr> 1138c2e8227SGreg Roach <td> 1148c2e8227SGreg Roach <i class="icon-cfamily"></i> 1158c2e8227SGreg Roach </td> 1168c2e8227SGreg Roach <td> 11715d603e7SGreg Roach <span class="subheaders"> <?= $label ?></span> 11815d603e7SGreg Roach <a href="<?= $family->getHtmlUrl() ?>"> - <?= I18N::translate('View this family') ?></a> 1198c2e8227SGreg Roach </td> 1208c2e8227SGreg Roach </tr> 1218c2e8227SGreg Roach </table> 1228c2e8227SGreg Roach <table class="facts_table"> 1238c2e8227SGreg Roach <?php 1248c2e8227SGreg Roach 1258c2e8227SGreg Roach ///// HUSB ///// 1268c2e8227SGreg Roach $found = false; 1278c2e8227SGreg Roach foreach ($family->getFacts('HUSB', false, $access_level) as $fact) { 1288c2e8227SGreg Roach $found |= !$fact->isPendingDeletion(); 1298c2e8227SGreg Roach $person = $fact->getTarget(); 1308c2e8227SGreg Roach if ($person instanceof Individual) { 1318c2e8227SGreg Roach if ($fact->isPendingAddition()) { 1328c2e8227SGreg Roach $class = 'facts_label new'; 1338c2e8227SGreg Roach } elseif ($fact->isPendingDeletion()) { 1348c2e8227SGreg Roach $class = 'facts_label old'; 1358c2e8227SGreg Roach } else { 1368c2e8227SGreg Roach $class = 'facts_label'; 1378c2e8227SGreg Roach } 1388c2e8227SGreg Roach ?> 1398c2e8227SGreg Roach <tr> 14015d603e7SGreg Roach <td class="<?= $class ?>"> 14115d603e7SGreg Roach <?= Functions::getCloseRelationshipName($controller->record, $person) ?> 1428c2e8227SGreg Roach </td> 14315d603e7SGreg Roach <td class="<?= $controller->getPersonStyle($person) ?>"> 14415d603e7SGreg Roach <?= Theme::theme()->individualBoxLarge($person) ?> 1458c2e8227SGreg Roach </td> 1468c2e8227SGreg Roach </tr> 1478c2e8227SGreg Roach <?php 1488c2e8227SGreg Roach } 1498c2e8227SGreg Roach } 1508c2e8227SGreg Roach if (!$found && $family->canEdit()) { 1518c2e8227SGreg Roach ?> 1528c2e8227SGreg Roach <tr> 1538c2e8227SGreg Roach <td class="facts_label"></td> 15415d603e7SGreg Roach <td class="facts_value"> 15515d603e7SGreg Roach <a href="edit_interface.php?action=add_spouse_to_family&ged=<?= $family->getTree()->getNameHtml() ?>&xref=<?= $family->getXref() ?>&famtag=HUSB"> 15615d603e7SGreg Roach <?= I18N::translate('Add a husband to this family') ?> 15715d603e7SGreg Roach </a> 15815d603e7SGreg Roach </td> 1598c2e8227SGreg Roach </tr> 1608c2e8227SGreg Roach <?php 1618c2e8227SGreg Roach } 1628c2e8227SGreg Roach 1638c2e8227SGreg Roach ///// WIFE ///// 1648c2e8227SGreg Roach $found = false; 1658c2e8227SGreg Roach foreach ($family->getFacts('WIFE', false, $access_level) as $fact) { 1668c2e8227SGreg Roach $person = $fact->getTarget(); 1678c2e8227SGreg Roach if ($person instanceof Individual) { 1688c2e8227SGreg Roach $found |= !$fact->isPendingDeletion(); 1698c2e8227SGreg Roach if ($fact->isPendingAddition()) { 1708c2e8227SGreg Roach $class = 'facts_label new'; 1718c2e8227SGreg Roach } elseif ($fact->isPendingDeletion()) { 1728c2e8227SGreg Roach $class = 'facts_label old'; 1738c2e8227SGreg Roach } else { 1748c2e8227SGreg Roach $class = 'facts_label'; 1758c2e8227SGreg Roach } 1768c2e8227SGreg Roach ?> 1778c2e8227SGreg Roach <tr> 17815d603e7SGreg Roach <td class="<?= $class ?>"> 17915d603e7SGreg Roach <?= Functions::getCloseRelationshipName($controller->record, $person) ?> 1808c2e8227SGreg Roach </td> 18115d603e7SGreg Roach <td class="<?= $controller->getPersonStyle($person) ?>"> 18215d603e7SGreg Roach <?= Theme::theme()->individualBoxLarge($person) ?> 1838c2e8227SGreg Roach </td> 1848c2e8227SGreg Roach </tr> 1858c2e8227SGreg Roach <?php 1868c2e8227SGreg Roach } 1878c2e8227SGreg Roach } 1888c2e8227SGreg Roach if (!$found && $family->canEdit()) { 1898c2e8227SGreg Roach ?> 1908c2e8227SGreg Roach <tr> 1918c2e8227SGreg Roach <td class="facts_label"></td> 19215d603e7SGreg Roach <td class="facts_value"> 19315d603e7SGreg Roach <a href="edit_interface.php?action=add_spouse_to_family&ged=<?= $family->getTree()->getNameHtml() ?>&xref=<?= $family->getXref() ?>&famtag=WIFE"> 19415d603e7SGreg Roach <?= I18N::translate('Add a wife to this family') ?> 19515d603e7SGreg Roach </a> 19615d603e7SGreg Roach </td> 1978c2e8227SGreg Roach </tr> 1988c2e8227SGreg Roach <?php 1998c2e8227SGreg Roach } 2008c2e8227SGreg Roach 2018c2e8227SGreg Roach ///// MARR ///// 2028c2e8227SGreg Roach $found = false; 2038c2e8227SGreg Roach $prev = new Date(''); 204a35df85eSGreg Roach foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) { 2058c2e8227SGreg Roach $found |= !$fact->isPendingDeletion(); 2068c2e8227SGreg Roach if ($fact->isPendingAddition()) { 2078c2e8227SGreg Roach $class = ' new'; 2088c2e8227SGreg Roach } elseif ($fact->isPendingDeletion()) { 2098c2e8227SGreg Roach $class = ' old'; 2108c2e8227SGreg Roach } else { 2118c2e8227SGreg Roach $class = ''; 2128c2e8227SGreg Roach } 2138c2e8227SGreg Roach ?> 2148c2e8227SGreg Roach <tr> 2158c2e8227SGreg Roach <td class="facts_label"> 2168c2e8227SGreg Roach </td> 21715d603e7SGreg Roach <td class="facts_value<?= $class ?>"> 21815d603e7SGreg Roach <?= GedcomTag::getLabelValue($fact->getTag(), $fact->getDate()->display() . ' — ' . $fact->getPlace()->getFullName()) ?> 2198c2e8227SGreg Roach </td> 2208c2e8227SGreg Roach </tr> 2218c2e8227SGreg Roach <?php 2228c2e8227SGreg Roach if (!$prev->isOK() && $fact->getDate()->isOK()) { 2238c2e8227SGreg Roach $prev = $fact->getDate(); 2248c2e8227SGreg Roach } 2258c2e8227SGreg Roach } 2268c2e8227SGreg Roach if (!$found && $family->canShow() && $family->canEdit()) { 2278c2e8227SGreg Roach // Add a new marriage 2288c2e8227SGreg Roach ?> 2298c2e8227SGreg Roach <tr> 2308c2e8227SGreg Roach <td class="facts_label"> 2318c2e8227SGreg Roach </td> 2328c2e8227SGreg Roach <td class="facts_value"> 23315d603e7SGreg Roach <a href="edit_interface.php?action=add&ged=<?= $family->getTree()->getNameHtml() ?>&xref=<?= $family->getXref() ?>&fact=MARR"> 23415d603e7SGreg Roach <?= I18N::translate('Add marriage details') ?> 2358c2e8227SGreg Roach </a> 2368c2e8227SGreg Roach </td> 2378c2e8227SGreg Roach </tr> 2388c2e8227SGreg Roach <?php 2398c2e8227SGreg Roach } 2408c2e8227SGreg Roach 2418c2e8227SGreg Roach ///// CHIL ///// 2428c2e8227SGreg Roach $child_number = 0; 2438c2e8227SGreg Roach foreach ($family->getFacts('CHIL', false, $access_level) as $fact) { 2448c2e8227SGreg Roach $person = $fact->getTarget(); 2458c2e8227SGreg Roach if ($person instanceof Individual) { 2468c2e8227SGreg Roach if ($fact->isPendingAddition()) { 2478c2e8227SGreg Roach $child_number++; 2488c2e8227SGreg Roach $class = 'facts_label new'; 2498c2e8227SGreg Roach } elseif ($fact->isPendingDeletion()) { 2508c2e8227SGreg Roach $class = 'facts_label old'; 2518c2e8227SGreg Roach } else { 2528c2e8227SGreg Roach $child_number++; 2538c2e8227SGreg Roach $class = 'facts_label'; 2548c2e8227SGreg Roach } 2558c2e8227SGreg Roach $next = new Date(''); 256fd0dfcc2SGreg Roach foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) { 2578c2e8227SGreg Roach if ($bfact->getDate()->isOK()) { 2588c2e8227SGreg Roach $next = $bfact->getDate(); 2598c2e8227SGreg Roach break; 2608c2e8227SGreg Roach } 2618c2e8227SGreg Roach } 2628c2e8227SGreg Roach ?> 2638c2e8227SGreg Roach <tr> 26415d603e7SGreg Roach <td class="<?= $class ?>"> 26515d603e7SGreg Roach <?= self::ageDifference($prev, $next, $child_number) ?> 26615d603e7SGreg Roach <?= Functions::getCloseRelationshipName($controller->record, $person) ?> 2678c2e8227SGreg Roach </td> 26815d603e7SGreg Roach <td class="<?= $controller->getPersonStyle($person) ?>"> 26915d603e7SGreg Roach <?= Theme::theme()->individualBoxLarge($person) ?> 2708c2e8227SGreg Roach </td> 2718c2e8227SGreg Roach </tr> 2728c2e8227SGreg Roach <?php 2738c2e8227SGreg Roach $prev = $next; 2748c2e8227SGreg Roach } 2758c2e8227SGreg Roach } 2768c2e8227SGreg Roach // Re-order children / add a new child 2778c2e8227SGreg Roach if ($family->canEdit()) { 2788c2e8227SGreg Roach if ($type == 'FAMS') { 27929bb8efbSGreg Roach $add_child_text = I18N::translate('Add a son or daughter'); 2808c2e8227SGreg Roach } else { 28129bb8efbSGreg Roach $add_child_text = I18N::translate('Add a brother or sister'); 2828c2e8227SGreg Roach } 2838c2e8227SGreg Roach ?> 28415d603e7SGreg Roach <tr> 2858c2e8227SGreg Roach <td class="facts_label"> 28615d603e7SGreg Roach <?php if (count($family->getChildren()) > 1): ?> 287*68b32ba8SGreg Roach <a href="edit_interface.php?action=reorder-children&ged=<?= $family->getTree()->getNameHtml() ?>&xref=<?= $family->getXref() ?>"> 28815d603e7SGreg Roach <i class="icon-media-shuffle"></i> <?= I18N::translate('Re-order children') ?> 28915d603e7SGreg Roach </a> 29015d603e7SGreg Roach <?php endif; ?> 2918c2e8227SGreg Roach </td> 2928c2e8227SGreg Roach <td class="facts_value"> 29315d603e7SGreg Roach <a href="edit_interface.php?action=add_child_to_family&ged=<?= $family->getTree()->getNameHtml() ?>&xref=<?= $family->getXref() ?>&gender=U"> 29415d603e7SGreg Roach <?= $add_child_text ?> 29515d603e7SGreg Roach </a> 2968c2e8227SGreg Roach <span style='white-space:nowrap;'> 29715d603e7SGreg Roach <a href="edit_interface.php?action=add_child_to_family&ged=<?= $family->getTree()->getNameHtml() ?>&xref=<?= $family->getXref() ?>&gender=M" class="icon-sex_m_15x15"></a> 29815d603e7SGreg Roach <a href="edit_interface.php?action=add_child_to_family&ged=<?= $family->getTree()->getNameHtml() ?>&xref=<?= $family->getXref() ?>&gender=F" class="icon-sex_f_15x15"></a> 2998c2e8227SGreg Roach </span> 3008c2e8227SGreg Roach </td> 3018c2e8227SGreg Roach </tr> 3028c2e8227SGreg Roach <?php 3038c2e8227SGreg Roach } 3048c2e8227SGreg Roach 3058c2e8227SGreg Roach echo '</table>'; 3068c2e8227SGreg Roach } 3078c2e8227SGreg Roach 3088c2e8227SGreg Roach /** {@inheritdoc} */ 3098c2e8227SGreg Roach public function getTabContent() { 31015d603e7SGreg Roach global $controller; 3118c2e8227SGreg Roach 3128c2e8227SGreg Roach ob_start(); 3138c2e8227SGreg Roach ?> 31407660c67SGreg Roach <table class="facts_table"> 31515d603e7SGreg Roach <tr> 31607660c67SGreg Roach <td class="descriptionbox rela"> 317877e7017SGreg Roach <label> 31823c362a9SGreg Roach <input id="show-date-differences" type="checkbox" checked> 31915d603e7SGreg Roach <?= I18N::translate('Date differences') ?> 32007660c67SGreg Roach </label> 32107660c67SGreg Roach </td> 32207660c67SGreg Roach </tr> 32307660c67SGreg Roach </table> 3248c2e8227SGreg Roach <?php 3258c2e8227SGreg Roach $families = $controller->record->getChildFamilies(); 3268c2e8227SGreg Roach if (!$families && $controller->record->canEdit()) { 3278c2e8227SGreg Roach ?> 3288c2e8227SGreg Roach <table class="facts_table"> 3298c2e8227SGreg Roach <tr> 33015d603e7SGreg Roach <td class="facts_value"> 33115d603e7SGreg Roach <a href="edit_interface.php?action=add_parent_to_individual&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>&gender=M"> 33215d603e7SGreg Roach <?= I18N::translate('Add a father') ?> 33315d603e7SGreg Roach </a> 33415d603e7SGreg Roach </td> 3358c2e8227SGreg Roach </tr> 3368c2e8227SGreg Roach <tr> 33715d603e7SGreg Roach <td class="facts_value"> 33815d603e7SGreg Roach <a href="edit_interface.php?action=add_parent_to_individual&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>&gender=F"> 33915d603e7SGreg Roach <?= I18N::translate('Add a mother') ?> 34015d603e7SGreg Roach </a> 34115d603e7SGreg Roach </td> 3428c2e8227SGreg Roach </tr> 3438c2e8227SGreg Roach </table> 3448c2e8227SGreg Roach <?php 3458c2e8227SGreg Roach } 3468c2e8227SGreg Roach 3478c2e8227SGreg Roach // parents 3488c2e8227SGreg Roach foreach ($families as $family) { 3498c2e8227SGreg Roach $this->printFamily($family, 'FAMC', $controller->record->getChildFamilyLabel($family)); 3508c2e8227SGreg Roach } 3518c2e8227SGreg Roach 3528c2e8227SGreg Roach // step-parents 3538c2e8227SGreg Roach foreach ($controller->record->getChildStepFamilies() as $family) { 3548c2e8227SGreg Roach $this->printFamily($family, 'FAMC', $controller->record->getStepFamilyLabel($family)); 3558c2e8227SGreg Roach } 3568c2e8227SGreg Roach 3578c2e8227SGreg Roach // spouses 3588c2e8227SGreg Roach $families = $controller->record->getSpouseFamilies(); 3598c2e8227SGreg Roach foreach ($families as $family) { 360268bcb45SGreg Roach $this->printFamily($family, 'FAMS', $controller->getSpouseFamilyLabel($family, $controller->record)); 3618c2e8227SGreg Roach } 3628c2e8227SGreg Roach 3638c2e8227SGreg Roach // step-children 3648c2e8227SGreg Roach foreach ($controller->record->getSpouseStepFamilies() as $family) { 3658c2e8227SGreg Roach $this->printFamily($family, 'FAMS', $family->getFullName()); 3668c2e8227SGreg Roach } 3678c2e8227SGreg Roach 3688c2e8227SGreg Roach if ($controller->record->canEdit()) { 3698c2e8227SGreg Roach ?> 37015d603e7SGreg Roach <br><table class="facts_table"> 3718c2e8227SGreg Roach <?php 3728c2e8227SGreg Roach if (count($families) > 1) { ?> 3738c2e8227SGreg Roach <tr> 3748c2e8227SGreg Roach <td class="facts_value"> 375*68b32ba8SGreg Roach <a href="edit_interface.php?action=reorder-spouses&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>"> 37615d603e7SGreg Roach <?= I18N::translate('Re-order families') ?> 37715d603e7SGreg Roach </a> 3788c2e8227SGreg Roach </td> 3798c2e8227SGreg Roach </tr> 3808c2e8227SGreg Roach <?php } ?> 3818c2e8227SGreg Roach <tr> 3828c2e8227SGreg Roach <td class="facts_value"> 38315d603e7SGreg Roach <a href="edit_interface.php?action=addfamlink&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>"><?= I18N::translate('Link this individual to an existing family as a child') ?></a> 3848c2e8227SGreg Roach </td> 3858c2e8227SGreg Roach </tr> 38615d603e7SGreg Roach <?php if ($controller->record->getSex() !== 'F') { ?> 3878c2e8227SGreg Roach <tr> 3888c2e8227SGreg Roach <td class="facts_value"> 38915d603e7SGreg Roach <a href="edit_interface.php?action=add_spouse_to_individual&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>&sex=F"><?= I18N::translate('Add a wife') ?></a> 3908c2e8227SGreg Roach </td> 3918c2e8227SGreg Roach </tr> 3928c2e8227SGreg Roach <tr> 3938c2e8227SGreg Roach <td class="facts_value"> 39415d603e7SGreg Roach <a href="edit_interface.php?action=linkspouse&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>&famtag=WIFE"><?= I18N::translate('Add a wife using an existing individual') ?></a> 3958c2e8227SGreg Roach </td> 3968c2e8227SGreg Roach </tr> 3978c2e8227SGreg Roach <?php } 39815d603e7SGreg Roach if ($controller->record->getSex() !== 'M') { ?> 3998c2e8227SGreg Roach <tr> 4008c2e8227SGreg Roach <td class="facts_value"> 40115d603e7SGreg Roach <a href="edit_interface.php?action=add_spouse_to_individual&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>&sex=M"><?= I18N::translate('Add a husband') ?></a> 4028c2e8227SGreg Roach </td> 4038c2e8227SGreg Roach </tr> 4048c2e8227SGreg Roach <tr> 4058c2e8227SGreg Roach <td class="facts_value"> 40615d603e7SGreg Roach <a href="edit_interface.php?action=linkspouse&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>&famtag=HUSB"><?= I18N::translate('Add a husband using an existing individual') ?></a> 4078c2e8227SGreg Roach </td> 4088c2e8227SGreg Roach </tr> 4098c2e8227SGreg Roach <?php } ?> 4108c2e8227SGreg Roach <tr> 4118c2e8227SGreg Roach <td class="facts_value"> 41215d603e7SGreg Roach <a href="edit_interface.php?action=add_child_to_individual&ged=<?= $controller->record->getTree()->getNameHtml() ?>&xref=<?= $controller->record->getXref() ?>&gender=U"> 41315d603e7SGreg Roach <?= I18N::translate('Add a child to create a one-parent family') ?> 41415d603e7SGreg Roach </a> 4158c2e8227SGreg Roach </td> 4168c2e8227SGreg Roach </tr> 4178c2e8227SGreg Roach </table> 4188c2e8227SGreg Roach <?php } ?> 4198c2e8227SGreg Roach <br> 420f591304fSGreg Roach <script> 42115d603e7SGreg Roach //persistent_toggle("show-date-differences", ".elderdate"); 422f591304fSGreg Roach </script> 4238c2e8227SGreg Roach <?php 4248c2e8227SGreg Roach 4258c2e8227SGreg Roach return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; 4268c2e8227SGreg Roach } 4278c2e8227SGreg Roach 4288c2e8227SGreg Roach /** {@inheritdoc} */ 4298c2e8227SGreg Roach public function hasTabContent() { 4308c2e8227SGreg Roach return true; 4318c2e8227SGreg Roach } 4328c2e8227SGreg Roach /** {@inheritdoc} */ 4338c2e8227SGreg Roach public function isGrayedOut() { 4348c2e8227SGreg Roach return false; 4358c2e8227SGreg Roach } 4368c2e8227SGreg Roach /** {@inheritdoc} */ 4378c2e8227SGreg Roach public function canLoadAjax() { 43815d603e7SGreg Roach return false; 4398c2e8227SGreg Roach } 4408c2e8227SGreg Roach 4418c2e8227SGreg Roach /** {@inheritdoc} */ 4428c2e8227SGreg Roach public function getPreLoadContent() { 4438c2e8227SGreg Roach return ''; 4448c2e8227SGreg Roach } 4458c2e8227SGreg Roach} 446