xref: /webtrees/app/Module/RelativesTabModule.php (revision 024989f8bf959620d881be695265fc70813403b7)
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>
122e0486a06SGreg Roach
123e0486a06SGreg Roach		<table class="table table-sm wt-facts-table">
124e0486a06SGreg Roach		<caption></caption>
125e0486a06SGreg Roach		<tbody>
1268c2e8227SGreg Roach		<?php
1278c2e8227SGreg Roach
1288c2e8227SGreg Roach		///// HUSB /////
1298c2e8227SGreg Roach		$found = false;
1308c2e8227SGreg Roach		foreach ($family->getFacts('HUSB', false, $access_level) as $fact) {
1318c2e8227SGreg Roach			$found |= !$fact->isPendingDeletion();
1328c2e8227SGreg Roach			$person = $fact->getTarget();
1338c2e8227SGreg Roach			if ($person instanceof Individual) {
134e0486a06SGreg Roach				$row_class = 'wt-gender-' . $person->getSex();
1358c2e8227SGreg Roach				if ($fact->isPendingAddition()) {
136e0486a06SGreg Roach					$row_class .= ' new';
1378c2e8227SGreg Roach				} elseif ($fact->isPendingDeletion()) {
138e0486a06SGreg Roach					$row_class .= ' old';
1398c2e8227SGreg Roach				}
1408c2e8227SGreg Roach				?>
141e0486a06SGreg Roach					<tr class="<?= $row_class ?>">
142e0486a06SGreg Roach						<th scope="row">
14315d603e7SGreg Roach							<?= Functions::getCloseRelationshipName($controller->record, $person) ?>
144e0486a06SGreg Roach						</th>
145e0486a06SGreg Roach						<td class="border-0 p-0">
14615d603e7SGreg Roach							<?= Theme::theme()->individualBoxLarge($person) ?>
1478c2e8227SGreg Roach						</td>
1488c2e8227SGreg Roach					</tr>
1498c2e8227SGreg Roach				<?php
1508c2e8227SGreg Roach			}
1518c2e8227SGreg Roach		}
1528c2e8227SGreg Roach		if (!$found && $family->canEdit()) {
1538c2e8227SGreg Roach			?>
1548c2e8227SGreg Roach			<tr>
155e0486a06SGreg Roach				<th></th>
156e0486a06SGreg Roach				<td scope="row">
15715d603e7SGreg Roach					<a href="edit_interface.php?action=add_spouse_to_family&amp;ged=<?= $family->getTree()->getNameHtml() ?>&amp;xref=<?= $family->getXref() ?>&amp;famtag=HUSB">
15815d603e7SGreg Roach						<?= I18N::translate('Add a husband to this family') ?>
15915d603e7SGreg Roach					</a>
16015d603e7SGreg Roach					</td>
1618c2e8227SGreg Roach			</tr>
1628c2e8227SGreg Roach			<?php
1638c2e8227SGreg Roach		}
1648c2e8227SGreg Roach
1658c2e8227SGreg Roach		///// WIFE /////
1668c2e8227SGreg Roach		$found = false;
1678c2e8227SGreg Roach		foreach ($family->getFacts('WIFE', false, $access_level) as $fact) {
1688c2e8227SGreg Roach			$person = $fact->getTarget();
1698c2e8227SGreg Roach			if ($person instanceof Individual) {
1708c2e8227SGreg Roach				$found |= !$fact->isPendingDeletion();
171e0486a06SGreg Roach				$row_class = 'wt-gender-' . $person->getSex();
1728c2e8227SGreg Roach				if ($fact->isPendingAddition()) {
173e0486a06SGreg Roach					$row_class .= ' new';
1748c2e8227SGreg Roach				} elseif ($fact->isPendingDeletion()) {
175e0486a06SGreg Roach					$row_class .= ' old';
1768c2e8227SGreg Roach				}
1778c2e8227SGreg Roach				?>
178e0486a06SGreg Roach				<tr class="<?= $row_class ?>">
179e0486a06SGreg Roach					<th scope="row">
18015d603e7SGreg Roach						<?= Functions::getCloseRelationshipName($controller->record, $person) ?>
181e0486a06SGreg Roach					</th>
182e0486a06SGreg Roach					<td class="border-0 p-0">
18315d603e7SGreg Roach						<?= Theme::theme()->individualBoxLarge($person) ?>
1848c2e8227SGreg Roach					</td>
1858c2e8227SGreg Roach				</tr>
1868c2e8227SGreg Roach				<?php
1878c2e8227SGreg Roach			}
1888c2e8227SGreg Roach		}
1898c2e8227SGreg Roach		if (!$found && $family->canEdit()) {
1908c2e8227SGreg Roach			?>
1918c2e8227SGreg Roach			<tr>
192e0486a06SGreg Roach				<th scope="row"></th>
193e0486a06SGreg Roach				<td>
19415d603e7SGreg Roach					<a href="edit_interface.php?action=add_spouse_to_family&amp;ged=<?= $family->getTree()->getNameHtml() ?>&amp;xref=<?= $family->getXref() ?>&amp;famtag=WIFE">
19515d603e7SGreg Roach						<?= I18N::translate('Add a wife to this family') ?>
19615d603e7SGreg Roach					</a>
19715d603e7SGreg Roach				</td>
1988c2e8227SGreg Roach			</tr>
1998c2e8227SGreg Roach			<?php
2008c2e8227SGreg Roach		}
2018c2e8227SGreg Roach
2028c2e8227SGreg Roach		///// MARR /////
2038c2e8227SGreg Roach		$found = false;
2048c2e8227SGreg Roach		$prev  = new Date('');
205a35df85eSGreg Roach		foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) {
2068c2e8227SGreg Roach			$found |= !$fact->isPendingDeletion();
2078c2e8227SGreg Roach			if ($fact->isPendingAddition()) {
208e0486a06SGreg Roach				$row_class = 'new';
2098c2e8227SGreg Roach			} elseif ($fact->isPendingDeletion()) {
210e0486a06SGreg Roach				$row_class = 'old';
2118c2e8227SGreg Roach			} else {
212e0486a06SGreg Roach				$row_class = '';
2138c2e8227SGreg Roach			}
2148c2e8227SGreg Roach			?>
215e0486a06SGreg Roach			<tr class="<?= $row_class ?>">
216e0486a06SGreg Roach				<th scope="row">
217e0486a06SGreg Roach				</th>
218e0486a06SGreg Roach				<td>
21915d603e7SGreg Roach					<?= GedcomTag::getLabelValue($fact->getTag(), $fact->getDate()->display() . ' — ' . $fact->getPlace()->getFullName()) ?>
2208c2e8227SGreg Roach				</td>
2218c2e8227SGreg Roach			</tr>
2228c2e8227SGreg Roach			<?php
2238c2e8227SGreg Roach			if (!$prev->isOK() && $fact->getDate()->isOK()) {
2248c2e8227SGreg Roach				$prev = $fact->getDate();
2258c2e8227SGreg Roach			}
2268c2e8227SGreg Roach		}
2278c2e8227SGreg Roach		if (!$found && $family->canShow() && $family->canEdit()) {
2288c2e8227SGreg Roach			// Add a new marriage
2298c2e8227SGreg Roach			?>
2308c2e8227SGreg Roach			<tr>
231e0486a06SGreg Roach				<th scope="row">
232e0486a06SGreg Roach				</th>
233e0486a06SGreg Roach				<td>
23415d603e7SGreg Roach					<a href="edit_interface.php?action=add&amp;ged=<?= $family->getTree()->getNameHtml() ?>&amp;xref=<?= $family->getXref() ?>&amp;fact=MARR">
23515d603e7SGreg Roach						<?= I18N::translate('Add marriage details') ?>
2368c2e8227SGreg Roach					</a>
2378c2e8227SGreg Roach				</td>
2388c2e8227SGreg Roach			</tr>
2398c2e8227SGreg Roach			<?php
2408c2e8227SGreg Roach		}
2418c2e8227SGreg Roach
2428c2e8227SGreg Roach		///// CHIL /////
2438c2e8227SGreg Roach		$child_number = 0;
2448c2e8227SGreg Roach		foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
2458c2e8227SGreg Roach			$person = $fact->getTarget();
2468c2e8227SGreg Roach			if ($person instanceof Individual) {
247e0486a06SGreg Roach				$row_class = 'wt-gender-' . $person->getSex();
2488c2e8227SGreg Roach				if ($fact->isPendingAddition()) {
2498c2e8227SGreg Roach					$child_number++;
250e0486a06SGreg Roach					$row_class .= ' new';
2518c2e8227SGreg Roach				} elseif ($fact->isPendingDeletion()) {
252e0486a06SGreg Roach					$row_class .= ' old';
2538c2e8227SGreg Roach				} else {
2548c2e8227SGreg Roach					$child_number++;
2558c2e8227SGreg Roach				}
2568c2e8227SGreg Roach				$next = new Date('');
257fd0dfcc2SGreg Roach				foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) {
2588c2e8227SGreg Roach					if ($bfact->getDate()->isOK()) {
2598c2e8227SGreg Roach						$next = $bfact->getDate();
2608c2e8227SGreg Roach						break;
2618c2e8227SGreg Roach					}
2628c2e8227SGreg Roach				}
2638c2e8227SGreg Roach				?>
264e0486a06SGreg Roach				<tr class="<?= $row_class ?>">
265e0486a06SGreg Roach					<th scope="row">
26615d603e7SGreg Roach						<?= self::ageDifference($prev, $next, $child_number) ?>
26715d603e7SGreg Roach						<?= Functions::getCloseRelationshipName($controller->record, $person) ?>
268e0486a06SGreg Roach					</th>
269e0486a06SGreg Roach					<td class="border-0 p-0">
27015d603e7SGreg Roach						<?= Theme::theme()->individualBoxLarge($person) ?>
2718c2e8227SGreg Roach					</td>
2728c2e8227SGreg Roach				</tr>
2738c2e8227SGreg Roach				<?php
2748c2e8227SGreg Roach				$prev = $next;
2758c2e8227SGreg Roach			}
2768c2e8227SGreg Roach		}
2778c2e8227SGreg Roach		// Re-order children / add a new child
2788c2e8227SGreg Roach		if ($family->canEdit()) {
2798c2e8227SGreg Roach			if ($type == 'FAMS') {
28029bb8efbSGreg Roach				$add_child_text = I18N::translate('Add a son or daughter');
2818c2e8227SGreg Roach			} else {
28229bb8efbSGreg Roach				$add_child_text = I18N::translate('Add a brother or sister');
2838c2e8227SGreg Roach			}
2848c2e8227SGreg Roach			?>
28515d603e7SGreg Roach			<tr>
286e0486a06SGreg Roach				<th scope="row">
28715d603e7SGreg Roach					<?php if (count($family->getChildren()) > 1): ?>
28868b32ba8SGreg Roach					<a href="edit_interface.php?action=reorder-children&amp;ged=<?= $family->getTree()->getNameHtml() ?>&amp;xref=<?= $family->getXref() ?>">
28915d603e7SGreg Roach						<i class="icon-media-shuffle"></i> <?= I18N::translate('Re-order children') ?>
29015d603e7SGreg Roach					</a>
29115d603e7SGreg Roach					<?php endif; ?>
292e0486a06SGreg Roach				</th>
293e0486a06SGreg Roach				<td>
29415d603e7SGreg Roach					<a href="edit_interface.php?action=add_child_to_family&amp;ged=<?= $family->getTree()->getNameHtml() ?>&amp;xref=<?= $family->getXref() ?>&amp;gender=U">
29515d603e7SGreg Roach						<?= $add_child_text ?>
29615d603e7SGreg Roach					</a>
2978c2e8227SGreg Roach					<span style='white-space:nowrap;'>
29815d603e7SGreg Roach						<a href="edit_interface.php?action=add_child_to_family&amp;ged=<?= $family->getTree()->getNameHtml() ?>&amp;xref=<?= $family->getXref() ?>&amp;gender=M" class="icon-sex_m_15x15"></a>
29915d603e7SGreg Roach						<a href="edit_interface.php?action=add_child_to_family&amp;ged=<?= $family->getTree()->getNameHtml() ?>&amp;xref=<?= $family->getXref() ?>&amp;gender=F" class="icon-sex_f_15x15"></a>
3008c2e8227SGreg Roach					</span>
3018c2e8227SGreg Roach				</td>
3028c2e8227SGreg Roach			</tr>
3038c2e8227SGreg Roach			<?php
3048c2e8227SGreg Roach		}
3058c2e8227SGreg Roach
306e0486a06SGreg Roach		echo '</tbody>';
3078c2e8227SGreg Roach		echo '</table>';
3088c2e8227SGreg Roach	}
3098c2e8227SGreg Roach
3108c2e8227SGreg Roach	/** {@inheritdoc} */
3118c2e8227SGreg Roach	public function getTabContent() {
31215d603e7SGreg Roach		global $controller;
3138c2e8227SGreg Roach
3148c2e8227SGreg Roach		ob_start();
3158c2e8227SGreg Roach		?>
316*024989f8SCarmen Pijpers		<table class="table table-sm wt-facts-table" role="presentation">
317e0486a06SGreg Roach			<tbody>
31815d603e7SGreg Roach				<tr>
319e0486a06SGreg Roach					<td>
320877e7017SGreg Roach						<label>
32123c362a9SGreg Roach							<input id="show-date-differences" type="checkbox" checked>
32215d603e7SGreg Roach							<?= I18N::translate('Date differences') ?>
32307660c67SGreg Roach						</label>
32407660c67SGreg Roach					</td>
32507660c67SGreg Roach				</tr>
326e0486a06SGreg Roach			</tbody>
32707660c67SGreg Roach		</table>
3288c2e8227SGreg Roach		<?php
3298c2e8227SGreg Roach		$families = $controller->record->getChildFamilies();
3308c2e8227SGreg Roach		if (!$families && $controller->record->canEdit()) {
3318c2e8227SGreg Roach			?>
332e0486a06SGreg Roach			<table class="table table-sm wt-facts-table">
333e0486a06SGreg Roach				<tbody>
3348c2e8227SGreg Roach					<tr>
335e0486a06SGreg Roach						<td>
33615d603e7SGreg Roach							<a href="edit_interface.php?action=add_parent_to_individual&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>&amp;gender=M">
33715d603e7SGreg Roach								<?= I18N::translate('Add a father') ?>
33815d603e7SGreg Roach							</a>
33915d603e7SGreg Roach						</td>
3408c2e8227SGreg Roach					</tr>
3418c2e8227SGreg Roach					<tr>
342e0486a06SGreg Roach						<td>
34315d603e7SGreg Roach							<a href="edit_interface.php?action=add_parent_to_individual&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>&amp;gender=F">
34415d603e7SGreg Roach								<?= I18N::translate('Add a mother') ?>
34515d603e7SGreg Roach							</a>
34615d603e7SGreg Roach						</td>
3478c2e8227SGreg Roach					</tr>
348e0486a06SGreg Roach				</tbody>
3498c2e8227SGreg Roach			</table>
3508c2e8227SGreg Roach			<?php
3518c2e8227SGreg Roach		}
3528c2e8227SGreg Roach
3538c2e8227SGreg Roach		// parents
3548c2e8227SGreg Roach		foreach ($families as $family) {
3558c2e8227SGreg Roach			$this->printFamily($family, 'FAMC', $controller->record->getChildFamilyLabel($family));
3568c2e8227SGreg Roach		}
3578c2e8227SGreg Roach
3588c2e8227SGreg Roach		// step-parents
3598c2e8227SGreg Roach		foreach ($controller->record->getChildStepFamilies() as $family) {
3608c2e8227SGreg Roach			$this->printFamily($family, 'FAMC', $controller->record->getStepFamilyLabel($family));
3618c2e8227SGreg Roach		}
3628c2e8227SGreg Roach
3638c2e8227SGreg Roach		// spouses
3648c2e8227SGreg Roach		$families = $controller->record->getSpouseFamilies();
3658c2e8227SGreg Roach		foreach ($families as $family) {
366268bcb45SGreg Roach			$this->printFamily($family, 'FAMS', $controller->getSpouseFamilyLabel($family, $controller->record));
3678c2e8227SGreg Roach		}
3688c2e8227SGreg Roach
3698c2e8227SGreg Roach		// step-children
3708c2e8227SGreg Roach		foreach ($controller->record->getSpouseStepFamilies() as $family) {
3718c2e8227SGreg Roach			$this->printFamily($family, 'FAMS', $family->getFullName());
3728c2e8227SGreg Roach		}
3738c2e8227SGreg Roach
3748c2e8227SGreg Roach		if ($controller->record->canEdit()) {
3758c2e8227SGreg Roach		?>
376e0486a06SGreg Roach		<br>
377e0486a06SGreg Roach		<table class="table table-sm wt-facts-table">
378e0486a06SGreg Roach			<tbody>
379e0486a06SGreg Roach				<?php if (count($families) > 1) { ?>
3808c2e8227SGreg Roach				<tr>
381e0486a06SGreg Roach					<td>
38268b32ba8SGreg Roach						<a href="edit_interface.php?action=reorder-spouses&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>">
38315d603e7SGreg Roach						<?= I18N::translate('Re-order families') ?>
38415d603e7SGreg Roach						</a>
3858c2e8227SGreg Roach					</td>
3868c2e8227SGreg Roach				</tr>
3878c2e8227SGreg Roach			<?php } ?>
3888c2e8227SGreg Roach				<tr>
389e0486a06SGreg Roach					<td>
39015d603e7SGreg Roach					<a href="edit_interface.php?action=addfamlink&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>"><?= I18N::translate('Link this individual to an existing family as a child') ?></a>
3918c2e8227SGreg Roach					</td>
3928c2e8227SGreg Roach				</tr>
39315d603e7SGreg Roach				<?php if ($controller->record->getSex() !== 'F') { ?>
3948c2e8227SGreg Roach				<tr>
395e0486a06SGreg Roach					<td>
39615d603e7SGreg Roach					<a href="edit_interface.php?action=add_spouse_to_individual&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>&amp;sex=F"><?= I18N::translate('Add a wife') ?></a>
3978c2e8227SGreg Roach					</td>
3988c2e8227SGreg Roach				</tr>
3998c2e8227SGreg Roach				<tr>
400e0486a06SGreg Roach					<td>
40115d603e7SGreg Roach					<a href="edit_interface.php?action=linkspouse&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>&amp;famtag=WIFE"><?= I18N::translate('Add a wife using an existing individual') ?></a>
4028c2e8227SGreg Roach					</td>
4038c2e8227SGreg Roach				</tr>
404e0486a06SGreg Roach				<?php } ?>
405e0486a06SGreg Roach				<?php if ($controller->record->getSex() !== 'M') { ?>
4068c2e8227SGreg Roach				<tr>
407e0486a06SGreg Roach					<td>
40815d603e7SGreg Roach					<a href="edit_interface.php?action=add_spouse_to_individual&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>&amp;sex=M"><?= I18N::translate('Add a husband') ?></a>
4098c2e8227SGreg Roach					</td>
4108c2e8227SGreg Roach				</tr>
4118c2e8227SGreg Roach				<tr>
412e0486a06SGreg Roach					<td>
41315d603e7SGreg Roach					<a href="edit_interface.php?action=linkspouse&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>&amp;famtag=HUSB"><?= I18N::translate('Add a husband using an existing individual') ?></a>
4148c2e8227SGreg Roach					</td>
4158c2e8227SGreg Roach				</tr>
4168c2e8227SGreg Roach				<?php } ?>
4178c2e8227SGreg Roach				<tr>
418e0486a06SGreg Roach					<td>
41915d603e7SGreg Roach						<a href="edit_interface.php?action=add_child_to_individual&amp;ged=<?= $controller->record->getTree()->getNameHtml() ?>&amp;xref=<?= $controller->record->getXref() ?>&amp;gender=U">
42015d603e7SGreg Roach							<?= I18N::translate('Add a child to create a one-parent family') ?>
42115d603e7SGreg Roach						</a>
4228c2e8227SGreg Roach					</td>
4238c2e8227SGreg Roach				</tr>
424e0486a06SGreg Roach			</tbody>
4258c2e8227SGreg Roach		</table>
4268c2e8227SGreg Roach		<?php } ?>
4278c2e8227SGreg Roach		<br>
428f591304fSGreg Roach		<script>
42915d603e7SGreg Roach			//persistent_toggle("show-date-differences", ".elderdate");
430f591304fSGreg Roach		</script>
4318c2e8227SGreg Roach		<?php
4328c2e8227SGreg Roach
4338c2e8227SGreg Roach		return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
4348c2e8227SGreg Roach	}
4358c2e8227SGreg Roach
4368c2e8227SGreg Roach	/** {@inheritdoc} */
4378c2e8227SGreg Roach	public function hasTabContent() {
4388c2e8227SGreg Roach		return true;
4398c2e8227SGreg Roach	}
4408c2e8227SGreg Roach	/** {@inheritdoc} */
4418c2e8227SGreg Roach	public function isGrayedOut() {
4428c2e8227SGreg Roach		return false;
4438c2e8227SGreg Roach	}
4448c2e8227SGreg Roach	/** {@inheritdoc} */
4458c2e8227SGreg Roach	public function canLoadAjax() {
44615d603e7SGreg Roach		return false;
4478c2e8227SGreg Roach	}
4488c2e8227SGreg Roach
4498c2e8227SGreg Roach	/** {@inheritdoc} */
4508c2e8227SGreg Roach	public function getPreLoadContent() {
4518c2e8227SGreg Roach		return '';
4528c2e8227SGreg Roach	}
4538c2e8227SGreg Roach}
454