/** * get edit menu */ public function getEditMenu() { if (!$this->record || $this->record->isPendingDeletion()) { return null; } // edit menu $menu = new Menu(I18N::translate('Edit'), '#', 'menu-record'); // edit raw if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) { $menu->addSubmenu(new Menu(I18N::translate('Edit raw GEDCOM'), '#', 'menu-record-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");'))); } // delete if (Auth::isEditor($this->record->getTree())) { $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-record-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");'))); } // add to favorites if (Module::getModuleByName('user_favorites')) { $menu->addSubmenu(new Menu(I18N::translate('Add to favorites'), '#', 'menu-record-addfav', array('onclick' => 'jQuery.post("module.php?mod=user_favorites&mod_action=menu-add-favorite" ,{xref:"' . $this->record->getXref() . '"},function(){location.reload();})'))); } // Get the link for the first submenu and set it as the link for the main menu if ($menu->getSubmenus()) { $submenus = $menu->getSubmenus(); $menu->setLink($submenus[0]->getLink()); $menu->setAttrs($submenus[0]->getAttrs()); } return $menu; }
/** * Startup activity */ public function __construct() { // Automatically fix broken links if ($this->record && $this->record->canEdit()) { $broken_links = 0; foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) { if (!$fact->isPendingDeletion() && $fact->getTarget() === null) { $this->record->deleteFact($fact->getFactId(), false); FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) { // These can be links or inline. Only delete links. if (!$fact->isPendingDeletion() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) { $this->record->deleteFact($fact->getFactId(), false); FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue())); $broken_links = true; } } if ($broken_links) { // Reload the updated family $this->record = GedcomRecord::getInstance($this->record->getXref(), $this->record->getTree()); } } parent::__construct(); // We want robots to index this page $this->setMetaRobots('index,follow'); // Set a page title if ($this->record) { if ($this->record->canShowName()) { // e.g. "John Doe" or "1881 Census of Wales" $this->setPageTitle($this->record->getFullName()); } else { // e.g. "Individual" or "Source" $record = $this->record; $this->setPageTitle(GedcomTag::getLabel($record::RECORD_TYPE)); } } else { // No such record $this->setPageTitle(I18N::translate('Private')); } }
/** * get edit menu */ public function getEditMenu() { if (!$this->record || $this->record->isPendingDeletion()) { return null; } // edit menu $menu = new Menu(I18N::translate('Edit'), '#', 'menu-record'); // edit raw if (Auth::isAdmin() || Auth::isEditor($this->record->getTree()) && $this->record->getTree()->getPreference('SHOW_GEDCOM_RECORD')) { $menu->addSubmenu(new Menu(I18N::translate('Edit the raw GEDCOM'), '#', 'menu-record-editraw', array('onclick' => 'return edit_raw("' . $this->record->getXref() . '");'))); } // delete if (Auth::isEditor($this->record->getTree())) { $menu->addSubmenu(new Menu(I18N::translate('Delete'), '#', 'menu-record-del', array('onclick' => 'return delete_record("' . I18N::translate('Are you sure you want to delete “%s”?', Filter::escapeJs(Filter::unescapeHtml($this->record->getFullName()))) . '", "' . $this->record->getXref() . '");'))); } return $menu; }
/** * Get the description for the family. * * For example, "XXX's family with new wife". * * @param Family $family * @param Individual $individual * * @return string */ public function getSpouseFamilyLabel(Family $family, Individual $individual) { $spouse = $family->getSpouse($individual); if ($spouse) { return I18N::translate('Family with %s', $spouse->getFullName()); } else { return $family->getFullName(); } }
/** * print the parents table for a family * * @param Family $family family gedcom ID * @param int $sosa child sosa number * @param string $label indi label (descendancy booklet) * @param string $parid parent ID (descendancy booklet) * @param string $gparid gd-parent ID (descendancy booklet) * @param int $show_full large or small box */ public static function printFamilyParents(Family $family, $sosa = 0, $label = '', $parid = '', $gparid = '', $show_full = 1) { if ($show_full) { $pbheight = Theme::theme()->parameter('chart-box-y') + 14; } else { $pbheight = Theme::theme()->parameter('compact-chart-box-y') + 14; } $husb = $family->getHusband(); if ($husb) { echo '<a name="', $husb->getXref(), '"></a>'; } else { $husb = new Individual('M', "0 @M@ INDI\n1 SEX M", null, $family->getTree()); } $wife = $family->getWife(); if ($wife) { echo '<a name="', $wife->getXref(), '"></a>'; } else { $wife = new Individual('F', "0 @F@ INDI\n1 SEX F", null, $family->getTree()); } if ($sosa) { echo '<p class="name_head">', $family->getFullName(), '</p>'; } /** * husband side */ echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">"; echo "<table border='0'><tr>"; if ($parid) { if ($husb->getXref() == $parid) { self::printSosaNumber($label); } else { self::printSosaNumber($label, "", "blank"); } } elseif ($sosa) { self::printSosaNumber($sosa * 2); } if ($husb->isPendingAddtion()) { echo '<td valign="top" class="facts_value new">'; } elseif ($husb->isPendingDeletion()) { echo '<td valign="top" class="facts_value old">'; } else { echo '<td valign="top">'; } FunctionsPrint::printPedigreePerson($husb, $show_full); echo "</td></tr></table>"; echo "</td>"; // husband’s parents $hfam = $husb->getPrimaryChildFamily(); if ($hfam) { // remove the|| test for $sosa echo "<td rowspan=\"2\"><img src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td rowspan=\"2\"><img src=\"" . Theme::theme()->parameter('image-vline') . "\" width=\"3\" height=\"" . ($pbheight + 9) . "\" alt=\"\"></td>"; echo "<td><img class=\"line5\" src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>"; // husband’s father if ($hfam && $hfam->getHusband()) { echo "<table border='0'><tr>"; if ($sosa > 0) { self::printSosaNumber($sosa * 4, $hfam->getHusband()->getXref(), "down"); } if (!empty($gparid) && $hfam->getHusband()->getXref() == $gparid) { self::printSosaNumber(trim(substr($label, 0, -3), ".") . "."); } echo "<td valign=\"top\">"; FunctionsPrint::printPedigreePerson($hfam->getHusband(), $show_full); echo "</td></tr></table>"; } elseif ($hfam && !$hfam->getHusband()) { // Empty box for grandfather echo "<table border='0'><tr>"; echo '<td valign="top">'; FunctionsPrint::printPedigreePerson($hfam->getHusband(), $show_full); echo '</td></tr></table>'; } echo "</td>"; } if ($hfam && $sosa != -1) { echo '<td valign="middle" rowspan="2">'; self::printUrlArrow($sosa == 0 ? '?famid=' . $hfam->getXref() . '&ged=' . $hfam->getTree()->getNameUrl() : '#' . $hfam->getXref(), $hfam->getXref(), 1); echo '</td>'; } if ($hfam) { // husband’s mother echo "</tr><tr><td><img src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>"; if ($hfam && $hfam->getWife()) { echo "<table border='0'><tr>"; if ($sosa > 0) { self::printSosaNumber($sosa * 4 + 1, $hfam->getWife()->getXref(), "down"); } if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) { self::printSosaNumber(trim(substr($label, 0, -3), ".") . "."); } echo '<td valign="top">'; FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full); echo '</td></tr></table>'; } elseif ($hfam && !$hfam->getWife()) { // Empty box for grandmother echo "<table border='0'><tr>"; echo '<td valign="top">'; FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full); echo '</td></tr></table>'; } echo '</td>'; } echo '</tr></table>'; if ($sosa && $family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo '<a href="', $family->getHtmlUrl(), '" class="details1">'; echo str_repeat(' ', 10); echo $fact->summary(); echo '</a>'; } } else { echo '<br>'; } /** * wife side */ echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">"; echo "<table><tr>"; if ($parid) { if ($wife->getXref() == $parid) { self::printSosaNumber($label); } else { self::printSosaNumber($label, "", "blank"); } } elseif ($sosa) { self::printSosaNumber($sosa * 2 + 1); } if ($wife->isPendingAddtion()) { echo '<td valign="top" class="facts_value new">'; } elseif ($wife->isPendingDeletion()) { echo '<td valign="top" class="facts_value old">'; } else { echo '<td valign="top">'; } FunctionsPrint::printPedigreePerson($wife, $show_full); echo "</td></tr></table>"; echo "</td>"; // wife’s parents $hfam = $wife->getPrimaryChildFamily(); if ($hfam) { echo "<td rowspan=\"2\"><img src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td rowspan=\"2\"><img src=\"" . Theme::theme()->parameter('image-vline') . "\" width=\"3\" height=\"" . ($pbheight + 9) . "\" alt=\"\"></td>"; echo "<td><img class=\"line5\" src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>"; // wife’s father if ($hfam && $hfam->getHusband()) { echo "<table><tr>"; if ($sosa > 0) { self::printSosaNumber($sosa * 4 + 2, $hfam->getHusband()->getXref(), "down"); } if (!empty($gparid) && $hfam->getHusband()->getXref() == $gparid) { self::printSosaNumber(trim(substr($label, 0, -3), ".") . "."); } echo "<td valign=\"top\">"; FunctionsPrint::printPedigreePerson($hfam->getHusband(), $show_full); echo "</td></tr></table>"; } elseif ($hfam && !$hfam->getHusband()) { // Empty box for grandfather echo "<table border='0'><tr>"; echo '<td valign="top">'; FunctionsPrint::printPedigreePerson($hfam->getHusband(), $show_full); echo '</td></tr></table>'; } echo "</td>"; } if ($hfam && $sosa != -1) { echo '<td valign="middle" rowspan="2">'; self::printUrlArrow($sosa == 0 ? '?famid=' . $hfam->getXref() . '&ged=' . $hfam->getTree()->getNameUrl() : '#' . $hfam->getXref(), $hfam->getXref(), 1); echo '</td>'; } if ($hfam) { // wife’s mother echo "</tr><tr><td><img src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\"></td><td>"; if ($hfam && $hfam->getWife()) { echo "<table><tr>"; if ($sosa > 0) { self::printSosaNumber($sosa * 4 + 3, $hfam->getWife()->getXref(), "down"); } if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) { self::printSosaNumber(trim(substr($label, 0, -3), ".") . "."); } echo "<td valign=\"top\">"; FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full); echo "</td></tr></table>"; } elseif ($hfam && !$hfam->getWife()) { // Empty box for grandmother echo "<table border='0'><tr>"; echo '<td valign="top">'; FunctionsPrint::printPedigreePerson($hfam->getWife(), $show_full); echo '</td></tr></table>'; } echo '</td>'; } echo "</tr></table>"; }