/** * Generate the likely value of this census column, based on available information. * * @param Individual $individual * @param Individual|null $head * * @return string */ public function generate(Individual $individual, Individual $head = null) { if ($head === null) { return ''; } elseif ($individual == $head) { return 'head'; } else { return Functions::getCloseRelationshipName($head, $individual); } }
/** * Create a family on the census navigator. * * @param CensusInterface $census * @param Family $family * @param Individual $head * * @return string */ public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head) { $headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>'; foreach ($family->getSpouses() as $spouse) { $menu = new Menu(Functions::getCloseRelationshipName($head, $spouse)); foreach ($spouse->getChildFamilies() as $grandparents) { foreach ($grandparents->getSpouses() as $grandparent) { $submenu = new Menu(Functions::getCloseRelationshipName($head, $grandparent) . ' - ' . $grandparent->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $grandparent, $head)) . '");')); $submenu->addClass('submenuitem', ''); $menu->addSubmenu($submenu); $menu->addClass('', 'submenu'); } } ?> <tr> <td class="optionbox"> <?php echo $menu->getMenu(); ?> </td> <td class="facts_value nowrap"> <a href="#" onclick="return appendCensusRow('<?php echo Filter::escapeJs(self::censusTableRow($census, $spouse, $head)); ?> ');"> <?php echo $spouse->getFullName(); ?> </a> </td> <td class="facts_value"> <?php if ($head !== $spouse) { ?> <a href="edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=<?php echo $spouse->getXref(); ?> &gedcom=<?php echo $spouse->getTree()->getNameUrl(); ?> &census=<?php echo get_class($census); ?> "> <?php echo $headImg2; ?> </a> <?php } ?> </td> </tr> <?php } foreach ($family->getChildren() as $child) { $menu = new Menu(Functions::getCloseRelationshipName($head, $child)); foreach ($child->getSpouseFamilies() as $spouse_family) { foreach ($spouse_family->getSpouses() as $spouse_family_spouse) { if ($spouse_family_spouse != $child) { $submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_spouse) . ' - ' . $spouse_family_spouse->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_spouse, $head)) . '");')); $submenu->addClass('submenuitem', ''); $menu->addSubmenu($submenu); $menu->addClass('', 'submenu'); } } foreach ($spouse_family->getChildren() as $spouse_family_child) { $submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_child) . ' - ' . $spouse_family_child->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_child, $head)) . '");')); $submenu->addClass('submenuitem', ''); $menu->addSubmenu($submenu); $menu->addClass('', 'submenu'); } } ?> <tr> <td class="optionbox"> <?php echo $menu->getMenu(); ?> </td> <td class="facts_value"> <a href="#" onclick="return appendCensusRow('<?php echo Filter::escapeJs(self::censusTableRow($census, $child, $head)); ?> ');"> <?php echo $child->getFullName(); ?> </a> </td> <td class="facts_value"> <?php if ($head !== $child) { ?> <a href="edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=<?php echo $child->getXref(); ?> &gedcom=<?php echo $child->getTree()->getNameUrl(); ?> &census=<?php echo get_class($census); ?> "> <?php echo $headImg2; ?> </a> <?php } ?> </td> </tr> <?php } echo '<tr><td><br></td></tr>'; }
/** * Format a family. * * @param Family $family * @param string $title */ private function drawFamily(Family $family, $title) { global $controller; ?> <tr> <td class="center" colspan="2"> <a class="famnav_title" href="<?php echo $family->getHtmlUrl(); ?> "> <?php echo $title; ?> </a> </td> </tr> <?php foreach ($family->getSpouses() as $spouse) { $menu = new Menu(Functions::getCloseRelationshipName($controller->record, $spouse)); $menu->addClass('', 'submenu flyout'); $menu->addSubmenu(new Menu($this->getParents($spouse))); ?> <tr> <td class="facts_label"> <?php echo $menu->getMenu(); ?> </td> <td class="center <?php echo $controller->getPersonStyle($spouse); ?> nam"> <a class="famnav_link" href="<?php echo $spouse->getHtmlUrl(); ?> "> <?php echo $spouse->getFullName(); ?> </a> <div class="font9"> <?php echo $spouse->getLifeSpan(); ?> </div> </td> </tr> <?php } foreach ($family->getChildren() as $child) { $menu = new Menu(Functions::getCloseRelationshipName($controller->record, $child)); $menu->addClass('', 'submenu flyout'); $menu->addSubmenu(new Menu($this->getFamily($child))); ?> <tr> <td class="facts_label"> <?php echo $menu->getMenu(); ?> </td> <td class="center <?php echo $controller->getPersonStyle($child); ?> nam"> <a class="famnav_link" href="<?php echo $child->getHtmlUrl(); ?> "> <?php echo $child->getFullName(); ?> </a> <div class="font9"> <?php echo $child->getLifeSpan(); ?> </div> </td> </tr> <?php } }
/** * 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()); } ?> <table> <tr> <td> <i class="icon-cfamily"></i> </td> <td> <span class="subheaders"> <?php echo $label; ?> </span> <a class="noprint" href="<?php echo $family->getHtmlUrl(); ?> "> - <?php echo I18N::translate('View this family'); ?> </a> </td> </tr> </table> <table class="facts_table"> <?php ///// HUSB ///// $found = false; foreach ($family->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'; } ?> <tr> <td class="<?php echo $class; ?> "> <?php echo Functions::getCloseRelationshipName($controller->record, $person); ?> </td> <td class="<?php echo $controller->getPersonStyle($person); ?> "> <?php echo Theme::theme()->individualBoxLarge($person); ?> </td> </tr> <?php } } if (!$found && $family->canEdit()) { ?> <tr> <td class="facts_label"></td> <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> </tr> <?php } ///// WIFE ///// $found = false; foreach ($family->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'; } ?> <tr> <td class="<?php echo $class; ?> "> <?php echo Functions::getCloseRelationshipName($controller->record, $person); ?> </td> <td class="<?php echo $controller->getPersonStyle($person); ?> "> <?php echo Theme::theme()->individualBoxLarge($person); ?> </td> </tr> <?php } } if (!$found && $family->canEdit()) { ?> <tr> <td class="facts_label"></td> <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> </tr> <?php } ///// MARR ///// $found = false; $prev = new Date(''); foreach ($family->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 = ''; } ?> <tr> <td class="facts_label"> </td> <td class="facts_value<?php echo $class; ?> "> <?php echo GedcomTag::getLabelValue($fact->getTag(), $fact->getDate()->display() . ' — ' . $fact->getPlace()->getFullName()); ?> </td> </tr> <?php if (!$prev->isOK() && $fact->getDate()->isOK()) { $prev = $fact->getDate(); } } if (!$found && $family->canShow() && $family->canEdit()) { // Add a new marriage ?> <tr> <td class="facts_label"> </td> <td class="facts_value"> <a href="#" onclick="return add_new_record('<?php echo $family->getXref(); ?> ', 'MARR');"> <?php echo I18N::translate('Add marriage details'); ?> </a> </td> </tr> <?php } ///// CHIL ///// $child_number = 0; foreach ($family->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; } } ?> <tr> <td class="<?php echo $class; ?> "> <?php echo self::ageDifference($prev, $next, $child_number); ?> <?php echo Functions::getCloseRelationshipName($controller->record, $person); ?> </td> <td class="<?php echo $controller->getPersonStyle($person); ?> "> <?php echo Theme::theme()->individualBoxLarge($person); ?> </td> </tr> <?php $prev = $next; } } // Re-order children / add a new child if ($family->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'); } ?> <tr class="noprint"> <td class="facts_label"> <?php if (count($family->getChildren()) > 1) { ?> <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> <?php } ?> </td> <td class="facts_value"> <a href="#" onclick="return add_child_to_family('<?php echo $family->getXref(); ?> ');"><?php echo $add_child_text; ?> </a> <span style='white-space:nowrap;'> <a href="#" class="icon-sex_m_15x15" onclick="return add_child_to_family('<?php echo $family->getXref(); ?> ','M');"></a> <a href="#" class="icon-sex_f_15x15" onclick="return add_child_to_family('<?php echo $family->getXref(); ?> ','F');"></a> </span> </td> </tr> <?php } echo '</table>'; return; }
$chdod = $chchild->getDeathDate()->julianDay(); // Child’s Date of Death (Julian) $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } } // Get Spouse child’s details $nam = $child->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; foreach ($nam as $n) { if ($n['type'] === '_MARNM') { $fulmn = strip_tags($n['full']); } } $label = Functions::getCloseRelationshipName($person, $child); $menu = new Menu($label); print_pedigree_person_nav_cens($child->getXref(), $label, $censyear); $submenu = new Menu($spouselinks); $menu->addSubmenu($submenu); ?> <tr> <td align="left" class="linkcell optionbox"> <?php echo $menu->getMenu(); ?> </td> <td align="left" class="facts_value"> <?php echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $child->getXref() . "&gedcom=" . $child->getTree()->getNameUrl() . "\">"; echo $headImg2;