. */ namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Date; use Fisharebest\Webtrees\Family; use Fisharebest\Webtrees\Functions\Functions; use Fisharebest\Webtrees\GedcomTag; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Theme; /** * Class RelativesTabModule */ class RelativesTabModule extends AbstractModule implements ModuleTabInterface { /** * How should this module be labelled on tabs, menus, etc.? * * @return string */ public function getTitle() { return /* I18N: Name of a module */ I18N::translate('Families'); } /** * A sentence describing what this module does. * * @return string */ public function getDescription() { return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); } /** * The user can re-arrange the tab order, but until they do, this * is the order in which tabs are shown. * * @return int */ public function defaultTabOrder() { return 20; } /** * Display the age difference between marriages and the births of children. * * @param Date $prev * @param Date $next * @param int $child_number * * @return string */ private static function ageDifference(Date $prev, Date $next, $child_number = 0) { if ($prev->isOK() && $next->isOK()) { $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); if ($days < 0) { // Show warning triangle if dates in reverse order $diff = ' '; } elseif ($child_number > 1 && $days > 1 && $days < 240) { // Show warning triangle if children born too close together $diff = ' '; } else { $diff = ''; } $months = round($days * 12 / 365.25); // Approximate - we do not know the calendar if (abs($months) == 12 || abs($months) >= 24) { $diff .= I18N::plural('%s year', '%s years', round($months / 12), I18N::number(round($months / 12))); } elseif ($months != 0) { $diff .= I18N::plural('%s month', '%s months', $months, I18N::number($months)); } return '
' . $diff . '
'; } else { return ''; } } /** * Print a family group. * * @param Family $family * @param string $type * @param string $label */ private function printFamily(Family $family, $type, $label) { global $controller; if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { $access_level = Auth::PRIV_HIDE; } else { $access_level = Auth::accessLevel($family->getTree()); } ?>
-
getFacts('HUSB', false, $access_level) as $fact) { $found |= !$fact->isPendingDeletion(); $person = $fact->getTarget(); if ($person instanceof Individual) { if ($fact->isPendingAddition()) { $class = 'facts_label new'; } elseif ($fact->isPendingDeletion()) { $class = 'facts_label old'; } else { $class = 'facts_label'; } ?> canEdit()) { ?> getFacts('WIFE', false, $access_level) as $fact) { $person = $fact->getTarget(); if ($person instanceof Individual) { $found |= !$fact->isPendingDeletion(); if ($fact->isPendingAddition()) { $class = 'facts_label new'; } elseif ($fact->isPendingDeletion()) { $class = 'facts_label old'; } else { $class = 'facts_label'; } ?> canEdit()) { ?> getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) { $found |= !$fact->isPendingDeletion(); if ($fact->isPendingAddition()) { $class = ' new'; } elseif ($fact->isPendingDeletion()) { $class = ' old'; } else { $class = ''; } ?> isOK() && $fact->getDate()->isOK()) { $prev = $fact->getDate(); } } if (!$found && $family->canShow() && $family->canEdit()) { // Add a new marriage ?> getFacts('CHIL', false, $access_level) as $fact) { $person = $fact->getTarget(); if ($person instanceof Individual) { if ($fact->isPendingAddition()) { $child_number++; $class = 'facts_label new'; } elseif ($fact->isPendingDeletion()) { $class = 'facts_label old'; } else { $child_number++; $class = 'facts_label'; } $next = new Date(''); foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) { if ($bfact->getDate()->isOK()) { $next = $bfact->getDate(); break; } } ?> canEdit()) { if ($type == 'FAMS') { $add_child_text = I18N::translate('Add a son or daughter'); } else { $add_child_text = I18N::translate('Add a brother or sister'); } ?> '; return; } /** {@inheritdoc} */ public function getTabContent() { global $show_full, $controller; if (isset($show_full)) { $saved_show_full = $show_full; } // We always want to see full details here $show_full = 1; ob_start(); ?>
record, $person); ?> individualBoxLarge($person); ?>
record, $person); ?> individualBoxLarge($person); ?>
getTag(), $fact->getDate()->display() . ' — ' . $fact->getPlace()->getFullName()); ?>
record, $person); ?> individualBoxLarge($person); ?>
getChildren()) > 1) { ?>
record->getChildFamilies(); if (!$families && $controller->record->canEdit()) { ?>
printFamily($family, 'FAMC', $controller->record->getChildFamilyLabel($family)); } // step-parents foreach ($controller->record->getChildStepFamilies() as $family) { $this->printFamily($family, 'FAMC', $controller->record->getStepFamilyLabel($family)); } // spouses $families = $controller->record->getSpouseFamilies(); foreach ($families as $family) { $this->printFamily($family, 'FAMS', $controller->getSpouseFamilyLabel($family, $controller->record)); } // step-children foreach ($controller->record->getSpouseStepFamilies() as $family) { $this->printFamily($family, 'FAMS', $family->getFullName()); } if ($controller->record->canEdit()) { ?>
1) { ?> record->getSex() != "F") { ?> record->getSex() != "M") { ?>

getName() . '_content">' . ob_get_clean() . ''; } /** {@inheritdoc} */ public function hasTabContent() { return true; } /** {@inheritdoc} */ public function isGrayedOut() { return false; } /** {@inheritdoc} */ public function canLoadAjax() { return !Auth::isSearchEngine(); // Search engines cannot use AJAX } /** {@inheritdoc} */ public function getPreLoadContent() { return ''; } }