/** {@inheritdoc} */ public function getTabContent() { global $controller, $WT_TREE; ob_start(); ?> <table class="facts_table"> <tr> <td colspan="2" class="descriptionbox rela"> <input id="checkbox_sour2" type="checkbox" <?php echo $WT_TREE->getPreference('SHOW_LEVEL2_NOTES') ? 'checked' : ''; ?> onclick="jQuery('tr.row_sour2').toggle();"> <label for="checkbox_sour2"><?php echo I18N::translate('Show all sources'); ?> </label> </td> </tr> <?php foreach ($this->getFactsWithSources() as $fact) { if ($fact->getTag() == 'SOUR') { FunctionsPrintFacts::printMainSources($fact, 1); } else { FunctionsPrintFacts::printMainSources($fact, 2); } } if (!$this->getFactsWithSources()) { echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', I18N::translate('There are no source citations for this individual.'), '</td></tr>'; } // New Source Link if ($controller->record->canEdit()) { ?> <tr> <td class="facts_label"> <?php echo GedcomTag::getLabel('SOUR'); ?> </td> <td class="facts_value"> <a href="#" onclick="add_new_record('<?php echo $controller->record->getXref(); ?> ','SOUR'); return false;"> <?php echo I18N::translate('Add a new source citation'); ?> </a> </td> </tr> <?php } ?> </table> <?php if (!$WT_TREE->getPreference('SHOW_LEVEL2_NOTES')) { echo '<script>jQuery("tr.row_sour2").toggle();</script>'; } return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; }
/** {@inheritdoc} */ public function getTabContent() { global $controller; ob_start(); ?> <table class="facts_table"> <tr class="noprint"> <td colspan="2" class="descriptionbox rela"> <label> <input id="show-level-2-sources" type="checkbox"> <?php echo I18N::translate('Show all sources'); ?> </label> </td> </tr> <?php foreach ($this->getFactsWithSources() as $fact) { if ($fact->getTag() == 'SOUR') { FunctionsPrintFacts::printMainSources($fact, 1); } else { FunctionsPrintFacts::printMainSources($fact, 2); } } if (!$this->getFactsWithSources()) { echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', I18N::translate('There are no source citations for this individual.'), '</td></tr>'; } // New Source Link if ($controller->record->canEdit()) { ?> <tr class="noprint"> <td class="facts_label"> <?php echo GedcomTag::getLabel('SOUR'); ?> </td> <td class="facts_value"> <a href="#" onclick="add_new_record('<?php echo $controller->record->getXref(); ?> ','SOUR'); return false;"> <?php echo I18N::translate('Add a source citation'); ?> </a> </td> </tr> <?php } ?> </table> <script> persistent_toggle("show-level-2-sources", ".row_sour2"); </script> <?php return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; }
/** * Load this sidebar synchronously. * * @return string */ public function getSidebarContent() { global $controller; $indifacts = array(); // The individual’s own facts foreach ($controller->record->getFacts() as $fact) { if (self::showFact($fact)) { $indifacts[] = $fact; } } ob_start(); if (!$indifacts) { echo I18N::translate('There are no facts for this individual.'); } else { foreach ($indifacts as $fact) { FunctionsPrintFacts::printFact($fact, $controller->record); } } return strip_tags(ob_get_clean(), '<a><div><span>'); }
/** * print information for a name record * * @param Fact $event the event object */ public function printNameRecord(Fact $event) { $factrec = $event->getGedcom(); // Create a dummy record, so we can extract the formatted NAME value from the event. $dummy = new Individual('xref', "0 @xref@ INDI\n1 DEAT Y\n" . $factrec, null, $event->getParent()->getTree()); $all_names = $dummy->getAllNames(); $primary_name = $all_names[0]; $this->name_count++; if ($this->name_count > 1) { echo '<h3 class="name_two">', $dummy->getFullName(), '</h3>'; } //Other names accordion element echo '<div class="indi_name_details'; if ($event->isPendingDeletion()) { echo ' old'; } if ($event->isPendingAddition()) { echo ' new'; } echo '">'; echo '<div class="name1">'; echo '<dl><dt class="label">', I18N::translate('Name'), '</dt>'; $dummy->setPrimaryName(0); echo '<dd class="field">', $dummy->getFullName(); if ($this->name_count == 1) { if (Auth::isAdmin()) { $user = User::findByGenealogyRecord($this->record); if ($user) { echo '<span> - <a class="warning" href="admin_users.php?filter=' . Filter::escapeHtml($user->getUserName()) . '">' . Filter::escapeHtml($user->getUserName()) . '</a></span>'; } } } if ($this->record->canEdit() && !$event->isPendingDeletion()) { echo "<div class=\"deletelink\"><a class=\"deleteicon\" href=\"#\" onclick=\"return delete_fact('" . I18N::translate('Are you sure you want to delete this fact?') . "', '" . $this->record->getXref() . "', '" . $event->getFactId() . "');\" title=\"" . I18N::translate('Delete this name') . "\"><span class=\"link_text\">" . I18N::translate('Delete this name') . "</span></a></div>"; echo "<div class=\"editlink\"><a href=\"#\" class=\"editicon\" onclick=\"edit_name('" . $this->record->getXref() . "', '" . $event->getFactId() . "'); return false;\" title=\"" . I18N::translate('Edit name') . "\"><span class=\"link_text\">" . I18N::translate('Edit name') . "</span></a></div>"; } echo '</dd>'; echo '</dl>'; echo '</div>'; $ct = preg_match_all('/\\n2 (\\w+) (.*)/', $factrec, $nmatch, PREG_SET_ORDER); for ($i = 0; $i < $ct; $i++) { echo '<div>'; $fact = $nmatch[$i][1]; if ($fact != 'SOUR' && $fact != 'NOTE' && $fact != 'SPFX') { echo '<dl><dt class="label">', GedcomTag::getLabel($fact, $this->record), '</dt>'; echo '<dd class="field">'; // Before using dir="auto" on this field, note that Gecko treats this as an inline element but WebKit treats it as a block element if (isset($nmatch[$i][2])) { $name = Filter::escapeHtml($nmatch[$i][2]); $name = str_replace('/', '', $name); $name = preg_replace('/(\\S*)\\*/', '<span class="starredname">\\1</span>', $name); switch ($fact) { case 'TYPE': echo GedcomCodeName::getValue($name, $this->record); break; case 'SURN': // The SURN field is not necessarily the surname. // Where it is not a substring of the real surname, show it after the real surname. $surname = Filter::escapeHtml($primary_name['surname']); if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) { echo '<span dir="auto">' . $surname . '</span>'; } else { echo I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $surname . '</span>', '<span dir="auto">' . $name . '</span>'); } break; default: echo '<span dir="auto">' . $name . '</span>'; break; } } echo '</dd>'; echo '</dl>'; } echo '</div>'; } if (preg_match("/\n2 SOUR/", $factrec)) { echo '<div id="indi_sour" class="clearfloat">', FunctionsPrintFacts::printFactSources($factrec, 2), '</div>'; } if (preg_match("/\n2 NOTE/", $factrec)) { echo '<div id="indi_note" class="clearfloat">', FunctionsPrint::printFactNotes($factrec, 2), '</div>'; } echo '</div>'; }
if ($controller->record->getTree()->getPreference('SHOW_MEDIA_DOWNLOAD')) { echo '<p><a href="' . $tmp->getHtmlUrlDirect('main', true) . '">' . I18N::translate('Download file') . '</a></p>'; } } else { echo '<p class="ui-state-error">' . I18N::translate('The file “%s” does not exist.', $tmp->getFilename()) . '</p>'; } } echo '</td> <td valign="top"> <table width="100%"> <tr> <td> <table class="facts_table">'; $facts = $controller->getFacts(); foreach ($facts as $f => $fact) { FunctionsPrintFacts::printFact($fact, $controller->record); } echo '</table> </td> </tr> </table> </td> </tr> </table> </div>'; echo '<ul>'; if ($linked_indi) { echo '<li><a href="#indi-media"><span id="indimedia">', I18N::translate('Individuals'), '</span></a></li>'; } if ($linked_fam) { echo '<li><a href="#fam-media"><span id="fammedia">', I18N::translate('Families'), '</span></a></li>';
/** * Print all of the notes in this fact record * * @param string $factrec The factrecord to print the notes from * @param int $level The level of the factrecord * @param bool $textOnly Don't print the "Note: " introduction * * @return string HTML */ public static function printFactNotes($factrec, $level, $textOnly = false) { global $WT_TREE; $data = ''; $previous_spos = 0; $nlevel = $level + 1; $ct = preg_match_all("/{$level} NOTE (.*)/", $factrec, $match, PREG_SET_ORDER); for ($j = 0; $j < $ct; $j++) { $spos1 = strpos($factrec, $match[$j][0], $previous_spos); $spos2 = strpos($factrec . "\n{$level}", "\n{$level}", $spos1 + 1); if (!$spos2) { $spos2 = strlen($factrec); } $previous_spos = $spos2; $nrec = substr($factrec, $spos1, $spos2 - $spos1); if (!isset($match[$j][1])) { $match[$j][1] = ''; } if (!preg_match('/@(.*)@/', $match[$j][1], $nmatch)) { $data .= self::printNoteRecord($match[$j][1], $nlevel, $nrec, $textOnly); } else { $note = Note::getInstance($nmatch[1], $WT_TREE); if ($note) { if ($note->canShow()) { $noterec = $note->getGedcom(); $nt = preg_match("/0 @{$nmatch['1']}@ NOTE (.*)/", $noterec, $n1match); $data .= self::printNoteRecord($nt > 0 ? $n1match[1] : "", 1, $noterec, $textOnly); if (!$textOnly) { if (strpos($noterec, '1 SOUR') !== false) { $data .= FunctionsPrintFacts::printFactSources($noterec, 1); } } } } else { $data = '<div class="fact_NOTE"><span class="label">' . I18N::translate('Note') . '</span>: <span class="field error">' . $nmatch[1] . '</span></div>'; } } if (!$textOnly) { if (strpos($factrec, "{$nlevel} SOUR") !== false) { $data .= "<div class=\"indent\">"; $data .= FunctionsPrintFacts::printFactSources($nrec, $nlevel); $data .= "</div>"; } } } return $data; }
/** * This function should be redefined in derived classes to show any major * identifying characteristics of this record. * * @return string */ public function formatListDetails() { ob_start(); FunctionsPrintFacts::printMediaLinks('1 OBJE @' . $this->getXref() . '@', 1); return ob_get_clean(); }
/** * Print the facts */ public function printFamilyFacts() { global $linkToID; $linkToID = $this->record->getXref(); // -- Tell addmedia.php what to link to $indifacts = $this->record->getFacts(); if ($indifacts) { Functions::sortFacts($indifacts); foreach ($indifacts as $fact) { FunctionsPrintFacts::printFact($fact, $this->record); } } else { echo '<tr><td class="messagebox" colspan="2">', I18N::translate('No facts exist for this family.'), '</td></tr>'; } if (Auth::isEditor($this->record->getTree())) { FunctionsPrint::printAddNewFact($this->record->getXref(), $indifacts, 'FAM'); echo '<tr><td class="descriptionbox">'; echo I18N::translate('Note'); echo '</td><td class="optionbox">'; echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','NOTE');\">", I18N::translate('Add a note'), '</a>'; echo '</td></tr>'; echo '<tr><td class="descriptionbox">'; echo I18N::translate('Shared note'); echo '</td><td class="optionbox">'; echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SHARED_NOTE');\">", I18N::translate('Add a shared note'), '</a>'; echo '</td></tr>'; if ($this->record->getTree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($this->record->getTree())) { echo '<tr><td class="descriptionbox">'; echo I18N::translate('Media object'); echo '</td><td class="optionbox">'; echo "<a href=\"#\" onclick=\"window.open('addmedia.php?action=showmediaform&linktoid=" . $this->record->getXref() . "', '_blank', edit_window_specs); return false;\">", I18N::translate('Add a media object'), '</a>'; echo FunctionsPrint::helpLink('OBJE'); echo '<br>'; echo "<a href=\"#\" onclick=\"window.open('inverselink.php?linktoid=" . $this->record->getXref() . "&linkto=family', '_blank', find_window_specs); return false;\">", I18N::translate('Link to an existing media object'), '</a>'; echo '</td></tr>'; } echo '<tr><td class="descriptionbox">'; echo I18N::translate('Source'); echo '</td><td class="optionbox">'; echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SOUR');\">", I18N::translate('Add a source citation'), '</a>'; echo '</td></tr>'; } }
echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($mediatype)); } } echo GedcomTag::getLabelValue('FORM', $mediaobject->mimeType()); echo GedcomTag::getLabelValue('__FILE_SIZE__', $mediaobject->getFilesize()); $imgsize = $mediaobject->getImageAttributes(); if ($imgsize['WxH']) { echo GedcomTag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']); } } else { echo '<p class="ui-state-error">', I18N::translate('The file “%s” does not exist.', $mediaobject->getFilename()), '</p>'; } } echo '<br>'; echo '<div>'; echo FunctionsPrintFacts::printFactSources($mediaobject->getGedcom(), 1); echo FunctionsPrint::printFactNotes($mediaobject->getGedcom(), 1); echo '</div>'; foreach ($mediaobject->linkedIndividuals('OBJE') as $individual) { echo '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View individual') . ' — ' . $individual->getFullName() . '</a><br>'; } foreach ($mediaobject->linkedFamilies('OBJE') as $family) { echo '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View family') . ' — ' . $family->getFullName() . '</a><br>'; } foreach ($mediaobject->linkedSources('OBJE') as $source) { echo '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View source') . ' — ' . $source->getFullName() . '</a><br>'; } echo '</td></tr></table>'; echo '</td>'; if (++$n % $columns == 0 && $n < $count) { echo '</tr><tr>';
/** {@inheritdoc} */ public function getTabContent() { global $WT_TREE, $controller; ob_start(); echo '<table class="facts_table">'; foreach ($this->getFactsWithMedia() as $fact) { if ($fact->getTag() == 'OBJE') { FunctionsPrintFacts::printMainMedia($fact, 1); } else { for ($i = 2; $i < 4; ++$i) { FunctionsPrintFacts::printMainMedia($fact, $i); } } } if (!$this->getFactsWithMedia()) { echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', I18N::translate('There are no media objects for this individual.'), '</td></tr>'; } // New media link if ($controller->record->canEdit() && $WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($controller->record->getTree())) { ?> <tr> <td class="facts_label"> <?php echo GedcomTag::getLabel('OBJE'); ?> </td> <td class="facts_value"> <a href="#" onclick="window.open('addmedia.php?action=showmediaform&linktoid=<?php echo $controller->record->getXref(); ?> &ged=<?php echo $controller->record->getTree()->getNameUrl(); ?> ', '_blank', edit_window_specs); return false;"> <?php echo I18N::translate('Add a new media object'); ?> </a> <?php echo FunctionsPrint::helpLink('OBJE'); ?> <br> <a href="#" onclick="window.open('inverselink.php?linktoid=<?php echo $controller->record->getXref(); ?> &ged=<?php echo $WT_TREE->getNameUrl(); ?> &linkto=person', '_blank', find_window_specs); return false;"> <?php echo I18N::translate('Link to an existing media object'); ?> </a> </td> </tr> <?php } ?> </table> <?php return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; }
/** {@inheritdoc} */ public function getTabContent() { global $controller; $EXPAND_HISTO_EVENTS = false; $indifacts = array(); // The individual’s own facts foreach ($controller->record->getFacts() as $fact) { switch ($fact->getTag()) { case 'SEX': case 'NAME': case 'SOUR': case 'OBJE': case 'NOTE': case 'FAMC': case 'FAMS': break; default: if (!array_key_exists('extra_info', Module::getActiveSidebars($controller->record->getTree())) || !ExtraInformationModule::showFact($fact)) { $indifacts[] = $fact; } break; } } // Add spouse-family facts foreach ($controller->record->getSpouseFamilies() as $family) { foreach ($family->getFacts() as $fact) { switch ($fact->getTag()) { case 'SOUR': case 'NOTE': case 'OBJE': case 'CHAN': case '_UID': case 'RIN': case 'HUSB': case 'WIFE': case 'CHIL': break; default: $indifacts[] = $fact; break; } } $spouse = $family->getSpouse($controller->record); if ($spouse) { foreach (self::spouseFacts($controller->record, $spouse) as $fact) { $indifacts[] = $fact; } } foreach (self::childFacts($controller->record, $family, '_CHIL', '') as $fact) { $indifacts[] = $fact; } } foreach (self::parentFacts($controller->record, 1) as $fact) { $indifacts[] = $fact; } foreach (self::historicalFacts($controller->record) as $fact) { $indifacts[] = $fact; } foreach (self::associateFacts($controller->record) as $fact) { $indifacts[] = $fact; } Functions::sortFacts($indifacts); ob_start(); echo '<table class="facts_table">'; echo '<tbody>'; if (!$indifacts) { echo '<tr><td colspan="2" class="facts_value">', I18N::translate('There are no facts for this individual.'), '</td></tr>'; } echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox" '; echo $controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS') ? 'checked' : ''; echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', I18N::translate('Events of close relatives'), '</label>'; if (file_exists(Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) { echo ' <input id="checkbox_histo" type="checkbox" '; echo $EXPAND_HISTO_EVENTS ? 'checked' : ''; echo ' onclick="jQuery(\'tr.histo\').toggle();"><label for="checkbox_histo">', I18N::translate('Historical facts'), '</label>'; } echo '</form></td></tr>'; foreach ($indifacts as $fact) { FunctionsPrintFacts::printFact($fact, $controller->record); } //-- new fact link if ($controller->record->canEdit()) { FunctionsPrint::printAddNewFact($controller->record->getXref(), $indifacts, 'INDI'); } echo '</tbody>'; echo '</table>'; if (!$controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS')) { echo '<script>jQuery("tr.rela").toggle();</script>'; } if (!$EXPAND_HISTO_EVENTS) { echo '<script>jQuery("tr.histo").toggle();</script>'; } return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; }
/** {@inheritdoc} */ public function getTabContent() { global $controller; ob_start(); ?> <table class="facts_table"> <colgroup> <col class="width20"> <col class="width80"> </colgroup> <tr class="noprint"> <td colspan="2" class="descriptionbox rela"> <label> <input id="show-level-2-notes" type="checkbox"> <?php echo I18N::translate('Show all notes'); ?> </label> </td> </tr> <?php foreach ($this->getFactsWithNotes() as $fact) { if ($fact->getTag() == 'NOTE') { FunctionsPrintFacts::printMainNotes($fact, 1); } else { for ($i = 2; $i < 4; ++$i) { FunctionsPrintFacts::printMainNotes($fact, $i); } } } if (!$this->getFactsWithNotes()) { echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', I18N::translate('There are no notes for this individual.'), '</td></tr>'; } // New note link if ($controller->record->canEdit()) { ?> <tr class="noprint"> <td class="facts_label"> <?php echo GedcomTag::getLabel('NOTE'); ?> </td> <td class="facts_value"> <a href="#" onclick="add_new_record('<?php echo $controller->record->getXref(); ?> ','NOTE'); return false;"> <?php echo I18N::translate('Add a note'); ?> </a> </td> </tr> <tr class="noprint"> <td class="facts_label"> <?php echo GedcomTag::getLabel('SHARED_NOTE'); ?> </td> <td class="facts_value"> <a href="#" onclick="add_new_record('<?php echo $controller->record->getXref(); ?> ','SHARED_NOTE'); return false;"> <?php echo I18N::translate('Add a shared note'); ?> </a> </td> </tr> <?php } ?> </table> <script> persistent_toggle("show-level-2-notes", ".row_note2"); </script> <?php return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; }