xref: /webtrees/app/Module/RelativesTabModule.php (revision 8593c473faa31f2615cc145c51982b372d724614)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roach/**
38c2e8227SGreg Roach * webtrees: online genealogy
4369c0ce6SGreg Roach * Copyright (C) 2016 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>
117*8593c473SDavid Drury					<span class="subheaders"> <?php echo $label; ?></span>
118*8593c473SDavid Drury					<a class="noprint" href="<?php echo $family->getHtmlUrl(); ?>"> - <?php echo I18N::translate('View the 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>
1408c2e8227SGreg Roach					<td class="<?php echo $class; ?>">
1413d7a8a4cSGreg Roach						<?php echo Functions::getCloseRelationshipName($controller->record, $person); ?>
1428c2e8227SGreg Roach					</td>
1438c2e8227SGreg Roach					<td class="<?php echo $controller->getPersonStyle($person); ?>">
1448c2e8227SGreg Roach						<?php echo 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>
1548c2e8227SGreg Roach				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?>', 'HUSB');"><?php echo I18N::translate('Add a husband to this family'); ?></a></td>
1558c2e8227SGreg Roach			</tr>
1568c2e8227SGreg Roach			<?php
1578c2e8227SGreg Roach		}
1588c2e8227SGreg Roach
1598c2e8227SGreg Roach		///// WIFE /////
1608c2e8227SGreg Roach		$found = false;
1618c2e8227SGreg Roach		foreach ($family->getFacts('WIFE', false, $access_level) as $fact) {
1628c2e8227SGreg Roach			$person = $fact->getTarget();
1638c2e8227SGreg Roach			if ($person instanceof Individual) {
1648c2e8227SGreg Roach				$found |= !$fact->isPendingDeletion();
1658c2e8227SGreg Roach				if ($fact->isPendingAddition()) {
1668c2e8227SGreg Roach					$class = 'facts_label new';
1678c2e8227SGreg Roach				} elseif ($fact->isPendingDeletion()) {
1688c2e8227SGreg Roach					$class = 'facts_label old';
1698c2e8227SGreg Roach				} else {
1708c2e8227SGreg Roach					$class = 'facts_label';
1718c2e8227SGreg Roach				}
1728c2e8227SGreg Roach				?>
1738c2e8227SGreg Roach				<tr>
1748c2e8227SGreg Roach					<td class="<?php echo $class; ?>">
1753d7a8a4cSGreg Roach						<?php echo Functions::getCloseRelationshipName($controller->record, $person); ?>
1768c2e8227SGreg Roach					</td>
1778c2e8227SGreg Roach					<td class="<?php echo $controller->getPersonStyle($person); ?>">
1788c2e8227SGreg Roach						<?php echo Theme::theme()->individualBoxLarge($person); ?>
1798c2e8227SGreg Roach					</td>
1808c2e8227SGreg Roach				</tr>
1818c2e8227SGreg Roach				<?php
1828c2e8227SGreg Roach			}
1838c2e8227SGreg Roach		}
1848c2e8227SGreg Roach		if (!$found && $family->canEdit()) {
1858c2e8227SGreg Roach			?>
1868c2e8227SGreg Roach			<tr>
1878c2e8227SGreg Roach				<td class="facts_label"></td>
1888c2e8227SGreg Roach				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?>', 'WIFE');"><?php echo I18N::translate('Add a wife to this family'); ?></a></td>
1898c2e8227SGreg Roach			</tr>
1908c2e8227SGreg Roach			<?php
1918c2e8227SGreg Roach		}
1928c2e8227SGreg Roach
1938c2e8227SGreg Roach		///// MARR /////
1948c2e8227SGreg Roach		$found = false;
1958c2e8227SGreg Roach		$prev  = new Date('');
19607a50bfcSGreg Roach		foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV) as $fact) {
1978c2e8227SGreg Roach			$found |= !$fact->isPendingDeletion();
1988c2e8227SGreg Roach			if ($fact->isPendingAddition()) {
1998c2e8227SGreg Roach				$class = ' new';
2008c2e8227SGreg Roach			} elseif ($fact->isPendingDeletion()) {
2018c2e8227SGreg Roach				$class = ' old';
2028c2e8227SGreg Roach			} else {
2038c2e8227SGreg Roach				$class = '';
2048c2e8227SGreg Roach			}
2058c2e8227SGreg Roach			?>
2068c2e8227SGreg Roach			<tr>
2078c2e8227SGreg Roach				<td class="facts_label">
2088c2e8227SGreg Roach				</td>
2098c2e8227SGreg Roach				<td class="facts_value<?php echo $class; ?>">
210764a01d9SGreg Roach					<?php echo GedcomTag::getLabelValue($fact->getTag(), $fact->getDate()->display() . ' — ' . $fact->getPlace()->getFullName()); ?>
2118c2e8227SGreg Roach				</td>
2128c2e8227SGreg Roach			</tr>
2138c2e8227SGreg Roach			<?php
2148c2e8227SGreg Roach			if (!$prev->isOK() && $fact->getDate()->isOK()) {
2158c2e8227SGreg Roach				$prev = $fact->getDate();
2168c2e8227SGreg Roach			}
2178c2e8227SGreg Roach		}
2188c2e8227SGreg Roach		if (!$found && $family->canShow() && $family->canEdit()) {
2198c2e8227SGreg Roach			// Add a new marriage
2208c2e8227SGreg Roach			?>
2218c2e8227SGreg Roach			<tr>
2228c2e8227SGreg Roach				<td class="facts_label">
2238c2e8227SGreg Roach				</td>
2248c2e8227SGreg Roach				<td class="facts_value">
2258c2e8227SGreg Roach					<a href="#" onclick="return add_new_record('<?php echo $family->getXref(); ?>', 'MARR');">
2268c2e8227SGreg Roach						<?php echo I18N::translate('Add marriage details'); ?>
2278c2e8227SGreg Roach					</a>
2288c2e8227SGreg Roach				</td>
2298c2e8227SGreg Roach			</tr>
2308c2e8227SGreg Roach			<?php
2318c2e8227SGreg Roach		}
2328c2e8227SGreg Roach
2338c2e8227SGreg Roach		///// CHIL /////
2348c2e8227SGreg Roach		$child_number = 0;
2358c2e8227SGreg Roach		foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
2368c2e8227SGreg Roach			$person = $fact->getTarget();
2378c2e8227SGreg Roach			if ($person instanceof Individual) {
2388c2e8227SGreg Roach				if ($fact->isPendingAddition()) {
2398c2e8227SGreg Roach					$child_number++;
2408c2e8227SGreg Roach					$class = 'facts_label new';
2418c2e8227SGreg Roach				} elseif ($fact->isPendingDeletion()) {
2428c2e8227SGreg Roach					$class = 'facts_label old';
2438c2e8227SGreg Roach				} else {
2448c2e8227SGreg Roach					$child_number++;
2458c2e8227SGreg Roach					$class = 'facts_label';
2468c2e8227SGreg Roach				}
2478c2e8227SGreg Roach				$next = new Date('');
248fd0dfcc2SGreg Roach				foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) {
2498c2e8227SGreg Roach					if ($bfact->getDate()->isOK()) {
2508c2e8227SGreg Roach						$next = $bfact->getDate();
2518c2e8227SGreg Roach						break;
2528c2e8227SGreg Roach					}
2538c2e8227SGreg Roach				}
2548c2e8227SGreg Roach				?>
2558c2e8227SGreg Roach				<tr>
2568c2e8227SGreg Roach					<td class="<?php echo $class; ?>">
2578c2e8227SGreg Roach						<?php echo self::ageDifference($prev, $next, $child_number); ?>
2583d7a8a4cSGreg Roach						<?php echo Functions::getCloseRelationshipName($controller->record, $person); ?>
2598c2e8227SGreg Roach					</td>
2608c2e8227SGreg Roach					<td class="<?php echo $controller->getPersonStyle($person); ?>">
2618c2e8227SGreg Roach						<?php echo Theme::theme()->individualBoxLarge($person); ?>
2628c2e8227SGreg Roach					</td>
2638c2e8227SGreg Roach				</tr>
2648c2e8227SGreg Roach				<?php
2658c2e8227SGreg Roach				$prev = $next;
2668c2e8227SGreg Roach			}
2678c2e8227SGreg Roach		}
2688c2e8227SGreg Roach		// Re-order children / add a new child
2698c2e8227SGreg Roach		if ($family->canEdit()) {
2708c2e8227SGreg Roach			if ($type == 'FAMS') {
27129bb8efbSGreg Roach				$add_child_text = I18N::translate('Add a son or daughter');
2728c2e8227SGreg Roach			} else {
27329bb8efbSGreg Roach				$add_child_text = I18N::translate('Add a brother or sister');
2748c2e8227SGreg Roach			}
2758c2e8227SGreg Roach			?>
276*8593c473SDavid Drury			<tr class="noprint">
2778c2e8227SGreg Roach				<td class="facts_label">
2788c2e8227SGreg Roach					<?php if (count($family->getChildren()) > 1) { ?>
2798c2e8227SGreg Roach					<a href="#" onclick="reorder_children('<?php echo $family->getXref(); ?>');tabswitch(5);"><i class="icon-media-shuffle"></i> <?php echo I18N::translate('Re-order children'); ?></a>
2808c2e8227SGreg Roach					<?php } ?>
2818c2e8227SGreg Roach				</td>
2828c2e8227SGreg Roach				<td class="facts_value">
2838c2e8227SGreg Roach					<a href="#" onclick="return add_child_to_family('<?php echo $family->getXref(); ?>');"><?php echo $add_child_text; ?></a>
2848c2e8227SGreg Roach					<span style='white-space:nowrap;'>
2858c2e8227SGreg Roach						<a href="#" class="icon-sex_m_15x15" onclick="return add_child_to_family('<?php echo $family->getXref(); ?>','M');"></a>
2868c2e8227SGreg Roach						<a href="#" class="icon-sex_f_15x15" onclick="return add_child_to_family('<?php echo $family->getXref(); ?>','F');"></a>
2878c2e8227SGreg Roach					</span>
2888c2e8227SGreg Roach				</td>
2898c2e8227SGreg Roach			</tr>
2908c2e8227SGreg Roach			<?php
2918c2e8227SGreg Roach		}
2928c2e8227SGreg Roach
2938c2e8227SGreg Roach		echo '</table>';
2948c2e8227SGreg Roach
2958c2e8227SGreg Roach		return;
2968c2e8227SGreg Roach	}
2978c2e8227SGreg Roach
2988c2e8227SGreg Roach	/** {@inheritdoc} */
2998c2e8227SGreg Roach	public function getTabContent() {
3008c2e8227SGreg Roach		global $WT_TREE, $show_full, $controller;
3018c2e8227SGreg Roach
3028c2e8227SGreg Roach		if (isset($show_full)) {
3038c2e8227SGreg Roach			$saved_show_full = $show_full;
3048c2e8227SGreg Roach		}
3058c2e8227SGreg Roach		// We always want to see full details here
3068c2e8227SGreg Roach		$show_full = 1;
3078c2e8227SGreg Roach
3088c2e8227SGreg Roach		ob_start();
3098c2e8227SGreg Roach		?>
310*8593c473SDavid Drury		<table class="facts_table"><tr class="noprint"><td class="descriptionbox rela">
3118c2e8227SGreg Roach		<input id="checkbox_elder" type="checkbox" onclick="jQuery('div.elderdate').toggle();" <?php echo $WT_TREE->getPreference('SHOW_AGE_DIFF') ? 'checked' : ''; ?>>
3128c2e8227SGreg Roach		<label for="checkbox_elder"><?php echo I18N::translate('Show date differences'); ?></label>
3138c2e8227SGreg Roach		</td></tr></table>
3148c2e8227SGreg Roach		<?php
3158c2e8227SGreg Roach		$families = $controller->record->getChildFamilies();
3168c2e8227SGreg Roach		if (!$families && $controller->record->canEdit()) {
3178c2e8227SGreg Roach			?>
3188c2e8227SGreg Roach			<table class="facts_table">
3198c2e8227SGreg Roach				<tr>
32029bb8efbSGreg Roach					<td class="facts_value"><a href="#" onclick="return add_parent_to_individual('<?php echo $controller->record->getXref(); ?>', 'M');"><?php echo I18N::translate('Add a father'); ?></td>
3218c2e8227SGreg Roach				</tr>
3228c2e8227SGreg Roach				<tr>
32329bb8efbSGreg Roach					<td class="facts_value"><a href="#" onclick="return add_parent_to_individual('<?php echo $controller->record->getXref(); ?>', 'F');"><?php echo I18N::translate('Add a mother'); ?></a></td>
3248c2e8227SGreg Roach				</tr>
3258c2e8227SGreg Roach			</table>
3268c2e8227SGreg Roach			<?php
3278c2e8227SGreg Roach		}
3288c2e8227SGreg Roach
3298c2e8227SGreg Roach		// parents
3308c2e8227SGreg Roach		foreach ($families as $family) {
3318c2e8227SGreg Roach			$this->printFamily($family, 'FAMC', $controller->record->getChildFamilyLabel($family));
3328c2e8227SGreg Roach		}
3338c2e8227SGreg Roach
3348c2e8227SGreg Roach		// step-parents
3358c2e8227SGreg Roach		foreach ($controller->record->getChildStepFamilies() as $family) {
3368c2e8227SGreg Roach			$this->printFamily($family, 'FAMC', $controller->record->getStepFamilyLabel($family));
3378c2e8227SGreg Roach		}
3388c2e8227SGreg Roach
3398c2e8227SGreg Roach		// spouses
3408c2e8227SGreg Roach		$families = $controller->record->getSpouseFamilies();
3418c2e8227SGreg Roach		foreach ($families as $family) {
342268bcb45SGreg Roach			$this->printFamily($family, 'FAMS', $controller->getSpouseFamilyLabel($family, $controller->record));
3438c2e8227SGreg Roach		}
3448c2e8227SGreg Roach
3458c2e8227SGreg Roach		// step-children
3468c2e8227SGreg Roach		foreach ($controller->record->getSpouseStepFamilies() as $family) {
3478c2e8227SGreg Roach			$this->printFamily($family, 'FAMS', $family->getFullName());
3488c2e8227SGreg Roach		}
3498c2e8227SGreg Roach
3508c2e8227SGreg Roach		if (!$WT_TREE->getPreference('SHOW_AGE_DIFF')) {
3518c2e8227SGreg Roach			echo '<script>jQuery("DIV.elderdate").toggle();</script>';
3528c2e8227SGreg Roach		}
3538c2e8227SGreg Roach
3548c2e8227SGreg Roach		if ($controller->record->canEdit()) {
3558c2e8227SGreg Roach		?>
356*8593c473SDavid Drury		<br><table class="facts_table noprint">
3578c2e8227SGreg Roach		<?php
3588c2e8227SGreg Roach			if (count($families) > 1) { ?>
3598c2e8227SGreg Roach			<tr>
3608c2e8227SGreg Roach				<td class="facts_value">
3618c2e8227SGreg Roach				<a href="#" onclick="return reorder_families('<?php echo $controller->record->getXref(); ?>');"><?php echo I18N::translate('Re-order families'); ?></a>
3628c2e8227SGreg Roach				</td>
3638c2e8227SGreg Roach			</tr>
3648c2e8227SGreg Roach		<?php } ?>
3658c2e8227SGreg Roach			<tr>
3668c2e8227SGreg Roach				<td class="facts_value">
3678c2e8227SGreg Roach				<a href="#" onclick="return add_famc('<?php echo $controller->record->getXref(); ?>');"><?php echo I18N::translate('Link this individual to an existing family as a child'); ?></a>
3688c2e8227SGreg Roach				</td>
3698c2e8227SGreg Roach			</tr>
3708c2e8227SGreg Roach			<?php if ($controller->record->getSex() != "F") { ?>
3718c2e8227SGreg Roach			<tr>
3728c2e8227SGreg Roach				<td class="facts_value">
37329bb8efbSGreg Roach				<a href="#" onclick="return add_spouse_to_individual('<?php echo $controller->record->getXref(); ?>','WIFE');"><?php echo I18N::translate('Add a wife'); ?></a>
3748c2e8227SGreg Roach				</td>
3758c2e8227SGreg Roach			</tr>
3768c2e8227SGreg Roach			<tr>
3778c2e8227SGreg Roach				<td class="facts_value">
3788c2e8227SGreg Roach				<a href="#" onclick="return linkspouse('<?php echo $controller->record->getXref(); ?>','WIFE');"><?php echo I18N::translate('Add a wife using an existing individual'); ?></a>
3798c2e8227SGreg Roach				</td>
3808c2e8227SGreg Roach			</tr>
3818c2e8227SGreg Roach			<?php }
3828c2e8227SGreg Roach			if ($controller->record->getSex() != "M") { ?>
3838c2e8227SGreg Roach			<tr>
3848c2e8227SGreg Roach				<td class="facts_value">
38529bb8efbSGreg Roach				<a href="#" onclick="return add_spouse_to_individual('<?php echo $controller->record->getXref(); ?>','HUSB');"><?php echo I18N::translate('Add a husband'); ?></a>
3868c2e8227SGreg Roach				</td>
3878c2e8227SGreg Roach			</tr>
3888c2e8227SGreg Roach			<tr>
3898c2e8227SGreg Roach				<td class="facts_value">
3908c2e8227SGreg Roach				<a href="#" onclick="return linkspouse('<?php echo $controller->record->getXref(); ?>','HUSB');"><?php echo I18N::translate('Add a husband using an existing individual'); ?></a>
3918c2e8227SGreg Roach				</td>
3928c2e8227SGreg Roach			</tr>
3938c2e8227SGreg Roach			<?php } ?>
3948c2e8227SGreg Roach			<tr>
3958c2e8227SGreg Roach				<td class="facts_value">
3968c2e8227SGreg Roach				<a href="#" onclick="return add_child_to_individual('<?php echo $controller->record->getXref(); ?>','U');"><?php echo I18N::translate('Add a child to create a one-parent family'); ?></a>
3978c2e8227SGreg Roach				</td>
3988c2e8227SGreg Roach			</tr>
3998c2e8227SGreg Roach		</table>
4008c2e8227SGreg Roach		<?php } ?>
4018c2e8227SGreg Roach		<br>
4028c2e8227SGreg Roach		<?php
4038c2e8227SGreg Roach
4048c2e8227SGreg Roach		unset($show_full);
4058c2e8227SGreg Roach		if (isset($saved_show_full)) {
4068c2e8227SGreg Roach			$show_full = $saved_show_full;
4078c2e8227SGreg Roach		}
4088c2e8227SGreg Roach
4098c2e8227SGreg Roach		return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
4108c2e8227SGreg Roach	}
4118c2e8227SGreg Roach
4128c2e8227SGreg Roach	/** {@inheritdoc} */
4138c2e8227SGreg Roach	public function hasTabContent() {
4148c2e8227SGreg Roach		return true;
4158c2e8227SGreg Roach	}
4168c2e8227SGreg Roach	/** {@inheritdoc} */
4178c2e8227SGreg Roach	public function isGrayedOut() {
4188c2e8227SGreg Roach		return false;
4198c2e8227SGreg Roach	}
4208c2e8227SGreg Roach	/** {@inheritdoc} */
4218c2e8227SGreg Roach	public function canLoadAjax() {
4228c2e8227SGreg Roach		return !Auth::isSearchEngine(); // Search engines cannot use AJAX
4238c2e8227SGreg Roach	}
4248c2e8227SGreg Roach
4258c2e8227SGreg Roach	/** {@inheritdoc} */
4268c2e8227SGreg Roach	public function getPreLoadContent() {
4278c2e8227SGreg Roach		return '';
4288c2e8227SGreg Roach	}
4298c2e8227SGreg Roach}
430