. */ /** * Class RelativesTabModule */ class RelativesTabModule extends Module implements ModuleTabInterface { /** {@inheritdoc} */ public function getTitle() { return /* I18N: Name of a module */ I18N::translate('Families'); } /** {@inheritdoc} */ public function getDescription() { return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); } /** {@inheritdoc} */ public function defaultTabOrder() { return 20; } /** * @param Date $prev * @param Date $next * @param integer $child_number * * @return string */ 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('%d year', '%d years', round($months / 12), round($months / 12)); } elseif ($months != 0) { $diff .= I18N::plural('%d month', '%d months', $months, $months); } return '
' . $diff . '
'; } else { return ''; } } /** * @param Family $family * @param string $type * @param string $label */ 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) 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) as $bfact) { if ($bfact->getDate()->isOK()) { $next = $bfact->getDate(); break; } } ?> canEdit()) { if ($type == 'FAMS') { $add_child_text = I18N::translate('Add a new son or daughter'); } else { $add_child_text = I18N::translate('Add a new brother or sister'); } ?> '; return; } /** {@inheritdoc} */ public function getTabContent() { global $WT_TREE, $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) { ?>
getPreference('SHOW_AGE_DIFF') ? 'checked' : ''; ?>>
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->record->getSpouseFamilyLabel($family)); } // step-children foreach ($controller->record->getSpouseStepFamilies() as $family) { $this->printFamily($family, 'FAMS', $family->getFullName()); } if (!$WT_TREE->getPreference('SHOW_AGE_DIFF')) { echo ''; } 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 ''; } }