Exemplo n.º 1
0
function print_fact(WT_Fact $fact, WT_GedcomRecord $record)
{
    global $HIDE_GEDCOM_ERRORS, $SHOW_FACT_ICONS;
    static $n_chil = 0, $n_gchi = 0;
    $parent = $fact->getParent();
    // Some facts don't get printed here ...
    switch ($fact->getTag()) {
        case 'NOTE':
            print_main_notes($fact, 1);
            return;
        case 'SOUR':
            print_main_sources($fact, 1);
            return;
        case 'OBJE':
            print_main_media($fact, 1);
            return;
        case 'FAMC':
        case 'FAMS':
        case 'CHIL':
        case 'HUSB':
        case 'WIFE':
            // These are internal links, not facts
            return;
        case '_WT_OBJE_SORT':
            // These links are used internally to record the sort order.
            return;
        default:
            // Hide unrecognized/custom tags?
            if ($HIDE_GEDCOM_ERRORS && !WT_Gedcom_Tag::isTag($fact->getTag())) {
                return;
            }
            break;
    }
    // Who is this fact about?  Need it to translate fact label correctly
    if ($parent instanceof WT_Family && $record instanceof WT_Individual) {
        // Family event
        $label_person = $fact->getParent()->getSpouse($record);
    } else {
        // Individual event
        $label_person = $parent;
    }
    // New or deleted facts need different styling
    $styleadd = '';
    if ($fact->isNew()) {
        $styleadd = 'new';
    }
    if ($fact->isOld()) {
        $styleadd = 'old';
    }
    // Event of close relative
    if (preg_match('/^_[A-Z_]{3,5}_[A-Z0-9]{4}$/', $fact->getTag())) {
        $styleadd = trim($styleadd . ' rela');
    }
    // Event of close associates
    if ($fact->getFactId() == 'asso') {
        $styleadd = trim($styleadd . ' rela');
    }
    // historical facts
    if ($fact->getFactId() == 'histo') {
        $styleadd = trim($styleadd . ' histo');
    }
    // Does this fact have a type?
    if (preg_match('/\\n2 TYPE (.+)/', $fact->getGedcom(), $match)) {
        $type = $match[1];
    } else {
        $type = '';
    }
    switch ($fact->getTag()) {
        case 'EVEN':
        case 'FACT':
            if (WT_Gedcom_Tag::isTag($type)) {
                // Some users (just Meliza?) use "1 EVEN/2 TYPE BIRT".  Translate the TYPE.
                $label = WT_Gedcom_Tag::getLabel($type, $label_person);
                $type = '';
                // Do not print this again
            } elseif ($type) {
                // We don't have a translation for $type - but a custom translation might exist.
                $label = WT_I18N::translate(WT_Filter::escapeHtml($type));
                $type = '';
                // Do not print this again
            } else {
                // An unspecified fact/event
                $label = $fact->getLabel();
            }
            break;
        case 'MARR':
            // This is a hack for a proprietory extension.  Is it still used/needed?
            $utype = strtoupper($type);
            if ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS') {
                $label = WT_Gedcom_Tag::getLabel('MARR_' . $utype, $label_person);
                $type = '';
                // Do not print this again
            } else {
                $label = $fact->getLabel();
            }
            break;
        default:
            // Normal fact/event
            $label = $fact->getLabel();
            break;
    }
    echo '<tr class="', $styleadd, '">';
    echo '<td class="descriptionbox width20">';
    if ($SHOW_FACT_ICONS) {
        echo $fact->Icon(), ' ';
    }
    if ($fact->getFactId() != 'histo' && $fact->canEdit()) {
        ?>
		<a
			href="#"
			title="<?php 
        echo WT_I18N::translate('Edit');
        ?>
"
			onclick="return edit_record('<?php 
        echo $parent->getXref();
        ?>
', '<?php 
        echo $fact->getFactId();
        ?>
');"
		><?php 
        echo $label;
        ?>
</a>
		<div class="editfacts">
			<div class="editlink">
				<a
					href="#"
					title="<?php 
        echo WT_I18N::translate('Edit');
        ?>
"
					class="editicon"
					onclick="return edit_record('<?php 
        echo $parent->getXref();
        ?>
', '<?php 
        echo $fact->getFactId();
        ?>
');"
				><span class="link_text"><?php 
        echo WT_I18N::translate('Edit');
        ?>
</span></a>
			</div>
			<div class="copylink">
				<a
					href="#"
					title="<?php 
        echo WT_I18N::translate('Copy');
        ?>
"
					class="copyicon"
					onclick="return copy_fact('<?php 
        echo $parent->getXref();
        ?>
', '<?php 
        echo $fact->getFactId();
        ?>
');"
				><span class="link_text"><?php 
        echo WT_I18N::translate('Copy');
        ?>
</span></a>
			</div>
			<div class="deletelink">
				<a
					href="#"
					title="<?php 
        echo WT_I18N::translate('Delete');
        ?>
"
					class="deleteicon"
					onclick="return delete_fact('<?php 
        echo WT_I18N::translate('Are you sure you want to delete this fact?');
        ?>
', '<?php 
        echo $parent->getXref();
        ?>
', '<?php 
        echo $fact->getFactId();
        ?>
');"
				><span class="link_text"><?php 
        echo WT_I18N::translate('Delete');
        ?>
</span></a>
			</div>
		</div>
		<?php 
    } else {
        echo $label;
    }
    switch ($fact->getTag()) {
        case '_BIRT_CHIL':
            echo '<br>', WT_I18N::translate('#%s', ++$n_chil);
            break;
        case '_BIRT_GCHI':
        case '_BIRT_GCH1':
        case '_BIRT_GCH2':
            echo '<br>', WT_I18N::translate('#%s', ++$n_gchi);
            break;
    }
    echo '</td><td class="optionbox ', $styleadd, ' wrap">';
    // Event from another record?
    if ($parent !== $record) {
        if ($parent instanceof WT_Family) {
            foreach ($parent->getSpouses() as $spouse) {
                if ($record !== $spouse) {
                    echo '<a href="', $spouse->getHtmlUrl(), '">', $spouse->getFullName(), '</a> — ';
                }
            }
            echo '<a href="', $parent->getHtmlUrl(), '">', WT_I18N::translate('View family'), '</a><br>';
        } elseif ($parent instanceof WT_Individual) {
            echo '<a href="', $parent->getHtmlUrl(), '">', $parent->getFullName(), '</a><br>';
        }
    }
    // Print the value of this fact/event
    switch ($fact->getTag()) {
        case 'ADDR':
            echo $fact->getValue();
            break;
        case 'AFN':
            echo '<div class="field"><a href="https://familysearch.org/search/tree/results#count=20&query=afn:', rawurlencode($fact->getValue()), '" target="new">', WT_Filter::escapeHtml($fact->getValue()), '</a></div>';
            break;
        case 'ASSO':
            // we handle this later, in format_asso_rela_record()
            break;
        case 'EMAIL':
        case 'EMAI':
        case '_EMAIL':
            echo '<div class="field"><a href="mailto:', WT_Filter::escapeHtml($fact->getValue()), '">', WT_Filter::escapeHtml($fact->getValue()), '</a></div>';
            break;
        case 'FILE':
            if (WT_USER_CAN_EDIT || WT_USER_CAN_ACCEPT) {
                echo '<div class="field">', WT_Filter::escapeHtml($fact->getValue()), '</div>';
            }
            break;
        case 'RESN':
            echo '<div class="field">';
            switch ($fact->getValue()) {
                case 'none':
                    // Note: "1 RESN none" is not valid gedcom.
                    // However, webtrees privacy rules will interpret it as "show an otherwise private record to public".
                    echo '<i class="icon-resn-none"></i> ', WT_I18N::translate('Show to visitors');
                    break;
                case 'privacy':
                    echo '<i class="icon-class-none"></i> ', WT_I18N::translate('Show to members');
                    break;
                case 'confidential':
                    echo '<i class="icon-confidential-none"></i> ', WT_I18N::translate('Show to managers');
                    break;
                case 'locked':
                    echo '<i class="icon-locked-none"></i> ', WT_I18N::translate('Only managers can edit');
                    break;
                default:
                    echo WT_Filter::escapeHtml($fact->getValue());
                    break;
            }
            echo '</div>';
            break;
        case 'PUBL':
            // Publication details might contain URLs.
            echo '<div class="field">', WT_Filter::expandUrls($fact->getValue()), '</div>';
            break;
        case 'REPO':
            if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
                print_repository_record($match[1]);
            } else {
                echo '<div class="error">', WT_Filter::escapeHtml($fact->getValue()), '</div>';
            }
            break;
        case 'URL':
        case '_URL':
        case 'WWW':
            echo '<div class="field"><a href="', WT_Filter::escapeHtml($fact->getValue()), '">', WT_Filter::escapeHtml($fact->getValue()), '</a></div>';
            break;
        case 'TEXT':
            // 0 SOUR / 1 TEXT
            echo '<div class="field">', nl2br(WT_Filter::escapeHtml($fact->getValue()), false), '</div>';
            break;
        default:
            // Display the value for all other facts/events
            switch ($fact->getValue()) {
                case '':
                    // Nothing to display
                    break;
                case 'N':
                    // Not valid GEDCOM
                    echo '<div class="field">', WT_I18N::translate('No'), '</div>';
                    break;
                case 'Y':
                    // Do not display "Yes".
                    break;
                default:
                    if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) {
                        $target = WT_GedcomRecord::getInstance($match[1]);
                        if ($target) {
                            echo '<div><a href="', $target->getHtmlUrl(), '">', $target->getFullName(), '</a></div>';
                        } else {
                            echo '<div class="error">', WT_Filter::escapeHtml($fact->getValue()), '</div>';
                        }
                    } else {
                        echo '<div class="field"><span dir="auto">', WT_Filter::escapeHtml($fact->getValue()), '</span></div>';
                    }
                    break;
            }
            break;
    }
    // Print the type of this fact/event
    if ($type) {
        $utype = strtoupper($type);
        // Events of close relatives, e.g. _MARR_CHIL
        if (substr($fact->getTag(), 0, 6) == '_MARR_' && ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS')) {
            // Translate MARR/TYPE using the code that supports MARR_CIVIL, etc. tags
            $type = WT_Gedcom_Tag::getLabel('MARR_' . $utype);
        } else {
            // Allow (custom) translations for other types
            $type = WT_I18N::translate($type);
        }
        echo WT_Gedcom_Tag::getLabelValue('TYPE', WT_Filter::escapeHtml($type));
    }
    // Print the date of this fact/event
    echo format_fact_date($fact, $record, true, true);
    // Print the place of this fact/event
    echo '<div class="place">', format_fact_place($fact, true, true, true), '</div>';
    // A blank line between the primary attributes (value, date, place) and the secondary ones
    echo '<br>';
    $addr = $fact->getAttribute('ADDR');
    if ($addr) {
        echo WT_Gedcom_Tag::getLabelValue('ADDR', $addr);
    }
    // Print the associates of this fact/event
    echo format_asso_rela_record($fact);
    // Print any other "2 XXXX" attributes, in the order in which they appear.
    preg_match_all('/\\n2 (' . WT_REGEX_TAG . ') (.+)/', $fact->getGedcom(), $matches, PREG_SET_ORDER);
    foreach ($matches as $match) {
        switch ($match[1]) {
            case 'DATE':
            case 'TIME':
            case 'AGE':
            case 'PLAC':
            case 'ADDR':
            case 'ALIA':
            case 'ASSO':
            case '_ASSO':
            case 'DESC':
            case 'RELA':
            case 'STAT':
            case 'TEMP':
            case 'TYPE':
            case 'FAMS':
            case 'CONT':
                // These were already shown at the beginning
                break;
            case 'NOTE':
            case 'OBJE':
            case 'SOUR':
                // These will be shown at the end
                break;
            case 'EVEN':
                // 0 SOUR / 1 DATA / 2 EVEN / 3 DATE / 3 PLAC
                $events = array();
                foreach (preg_split('/ *, */', $match[2]) as $event) {
                    $events[] = WT_Gedcom_Tag::getLabel($event);
                }
                if (count($events) == 1) {
                    echo WT_Gedcom_Tag::getLabelValue('EVEN', $event);
                } else {
                    echo WT_Gedcom_Tag::getLabelValue('EVEN', implode(WT_I18N::$list_separator, $events));
                }
                if (preg_match('/\\n3 DATE (.+)/', $fact->getGedcom(), $date_match)) {
                    $date = new WT_Date($date_match[1]);
                    echo WT_Gedcom_Tag::getLabelValue('DATE', $date->Display());
                }
                if (preg_match('/\\n3 PLAC (.+)/', $fact->getGedcom(), $plac_match)) {
                    echo WT_Gedcom_Tag::getLabelValue('PLAC', $plac_match[1]);
                }
                break;
            case 'FAMC':
                // 0 INDI / 1 ADOP / 2 FAMC / 3 ADOP
                $family = WT_Family::getInstance(str_replace('@', '', $match[2]));
                if ($family) {
                    // May be a pointer to a non-existant record
                    echo WT_Gedcom_Tag::getLabelValue('FAM', '<a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . '</a>');
                    if (preg_match('/\\n3 ADOP (HUSB|WIFE|BOTH)/', $fact->getGedcom(), $match)) {
                        echo WT_Gedcom_Tag::getLabelValue('ADOP', WT_Gedcom_Code_Adop::getValue($match[1], $label_person));
                    }
                } else {
                    echo WT_Gedcom_Tag::getLabelValue('FAM', '<span class="error">' . $match[2] . '</span>');
                }
                break;
            case '_WT_USER':
                $user = User::findByIdentifier($match[2]);
                // may not exist
                if ($user) {
                    echo WT_Gedcom_Tag::getLabelValue('_WT_USER', WT_Filter::escapeHtml($user->getRealName()));
                } else {
                    echo WT_Gedcom_Tag::getLabelValue('_WT_USER', WT_Filter::escapeHtml($match[2]));
                }
                break;
            case 'RESN':
                switch ($match[2]) {
                    case 'none':
                        // Note: "2 RESN none" is not valid gedcom.
                        // However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
                        echo WT_Gedcom_Tag::getLabelValue('RESN', '<i class="icon-resn-none"></i> ' . WT_I18N::translate('Show to visitors'));
                        break;
                    case 'privacy':
                        echo WT_Gedcom_Tag::getLabelValue('RESN', '<i class="icon-resn-privacy"></i> ' . WT_I18N::translate('Show to members'));
                        break;
                    case 'confidential':
                        echo WT_Gedcom_Tag::getLabelValue('RESN', '<i class="icon-resn-confidential"></i> ' . WT_I18N::translate('Show to managers'));
                        break;
                    case 'locked':
                        echo WT_Gedcom_Tag::getLabelValue('RESN', '<i class="icon-resn-locked"></i> ' . WT_I18N::translate('Only managers can edit'));
                        break;
                    default:
                        echo WT_Gedcom_Tag::getLabelValue('RESN', WT_Filter::escapeHtml($match[2]));
                        break;
                }
                break;
            case 'CALN':
                echo WT_Gedcom_Tag::getLabelValue('CALN', WT_Filter::expandUrls($match[2]));
                break;
            case 'FORM':
                // 0 OBJE / 1 FILE / 2 FORM / 3 TYPE
                echo WT_Gedcom_Tag::getLabelValue('FORM', $match[2]);
                if (preg_match('/\\n3 TYPE (.+)/', $fact->getGedcom(), $type_match)) {
                    echo WT_Gedcom_Tag::getLabelValue('TYPE', WT_Gedcom_Tag::getFileFormTypeValue($type_match[1]));
                }
                break;
            case 'URL':
            case '_URL':
            case 'WWW':
                $link = '<a href="' . WT_Filter::escapeHtml($match[2]) . '">' . WT_Filter::escapeHtml($match[2]) . '</a>';
                echo WT_Gedcom_Tag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
                break;
            default:
                if (!$HIDE_GEDCOM_ERRORS || WT_Gedcom_Tag::isTag($match[1])) {
                    if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $match[2], $xmatch)) {
                        // Links
                        $linked_record = WT_GedcomRecord::getInstance($xmatch[1]);
                        if ($linked_record) {
                            $link = '<a href="' . $linked_record->getHtmlUrl() . '">' . $linked_record->getFullName() . '</a>';
                            echo WT_Gedcom_Tag::getLabelValue($fact->getTag() . ':' . $match[1], $link);
                        } else {
                            echo WT_Gedcom_Tag::getLabelValue($fact->getTag() . ':' . $match[1], WT_Filter::escapeHtml($match[2]));
                        }
                    } else {
                        // Non links
                        echo WT_Gedcom_Tag::getLabelValue($fact->getTag() . ':' . $match[1], WT_Filter::escapeHtml($match[2]));
                    }
                }
                break;
        }
    }
    echo print_fact_sources($fact->getGedcom(), 2);
    echo print_fact_notes($fact->getGedcom(), 2);
    print_media_links($fact->getGedcom(), 2);
    echo '</td></tr>';
}
Exemplo n.º 2
0
/**
 * print the facts table for a family
 *
 * @param string $famid family gedcom ID
 * @param int $sosa optional child sosa number
 */
function print_family_facts(&$family, $sosa = 0)
{
    global $pgv_lang, $pbwidth, $pbheight, $view;
    global $nonfacts, $factarray;
    global $TEXT_DIRECTION, $GEDCOM, $SHOW_ID_NUMBERS;
    global $show_changes, $pgv_changes;
    global $linkToID;
    $famid = $family->getXref();
    // -- if both parents are displayable then print the marriage facts
    if ($family->canDisplayDetails()) {
        $linkToID = $famid;
        // -- Tell addmedia.php what to link to
        // -- array of GEDCOM elements that will be found but should not be displayed
        $nonfacts = array("FAMS", "FAMC", "MAY", "BLOB", "HUSB", "WIFE", "CHIL", "");
        // -- find all the fact information
        $indifacts = $family->getFacts();
        if (count($indifacts) > 0) {
            sort_facts($indifacts);
            print "\n\t<span class=\"subheaders\">" . $pgv_lang["family_group_info"];
            if ($SHOW_ID_NUMBERS and $famid != "") {
                print "&nbsp;&nbsp;&nbsp;({$famid})";
            }
            print "</span><br />\n\t<table class=\"facts_table\">";
            /* @var $value Event */
            foreach ($indifacts as $key => $value) {
                if ($value->getTag() != "SOUR" && $value->getTag() != "OBJE" && $value->getTag() != "NOTE") {
                    print_fact($value);
                }
            }
            // do not print otheritems for sosa
            if ($sosa == 0) {
                foreach ($indifacts as $key => $value) {
                    $fact = $value->getTag();
                    // -- handle special source fact case
                    if ($fact == "SOUR") {
                        print_main_sources($value->getGedComRecord(), 1, $famid, $value->getLineNumber());
                    } else {
                        if ($fact == "NOTE") {
                            print_main_notes($value->getGedComRecord(), 1, $famid, $value->getLineNumber());
                        }
                    }
                }
                // NOTE: Print the media
                print_main_media($famid);
            }
        } else {
            if ($sosa == 0) {
                print "\n\t<span class=\"subheaders\">" . $pgv_lang["family_group_info"];
                if ($SHOW_ID_NUMBERS and $famid != "") {
                    print "&nbsp;&nbsp;&nbsp;({$famid})";
                }
                print "</span><br />\n\t";
            }
            print "<table class=\"facts_table\">";
            if ($sosa == 0) {
                print "<tr><td class=\"messagebox\" colspan=\"2\">";
                print $pgv_lang["no_family_facts"];
                print "</td></tr>\n";
            }
        }
        // -- new fact link
        if ($view != "preview" && $sosa == 0 && PGV_USER_CAN_EDIT) {
            print_add_new_fact($famid, $indifacts, "FAM");
            // -- new note
            print "<tr><td class=\"descriptionbox\">";
            print_help_link("add_note_help", "qm", "add_note_lbl");
            print $pgv_lang["add_note_lbl"] . "</td>";
            print "<td class=\"optionbox\">";
            print "<a href=\"javascript:;\" onclick=\"return add_new_record('{$famid}','NOTE');\">" . $pgv_lang["add_note"] . "</a>";
            print "<br />\n";
            print "</td></tr>\n";
            // -- new shared note
            print "<tr><td class=\"descriptionbox\">";
            print_help_link("add_shared_note_help", "qm", "add_shared_note_lbl");
            print $pgv_lang["add_shared_note_lbl"] . "</td>";
            print "<td class=\"optionbox\">";
            print "<a href=\"javascript:;\" onclick=\"return add_new_record('{$famid}','SHARED_NOTE');\">" . $pgv_lang["add_shared_note"] . "</a>";
            print "<br />\n";
            print "</td></tr>\n";
            // -- new media
            print "<tr><td class=\"descriptionbox\">";
            print_help_link("add_media_help", "qm", "add_media_lbl");
            print $pgv_lang["add_media_lbl"] . "</td>";
            print "<td class=\"optionbox\">";
            print "<a href=\"javascript: " . $pgv_lang["add_media_lbl"] . "\" onclick=\"window.open('addmedia.php?action=showmediaform&linktoid={$famid}', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1'); return false;\">" . $pgv_lang["add_media"] . "</a>";
            print "<br />\n";
            print "<a href=\"javascript:;\" onclick=\"window.open('inverselink.php?linktoid={$famid}&linkto=family', '_blank', 'top=50,left=50,width=400,height=300,resizable=1,scrollbars=1'); return false;\">" . $pgv_lang["link_to_existing_media"] . "</a>";
            print "</td></tr>\n";
            // -- new source citation
            print "<tr><td class=\"descriptionbox\">";
            print_help_link("add_source_help", "qm", "add_source_lbl");
            print $pgv_lang["add_source_lbl"] . "</td>";
            print "<td class=\"optionbox\">";
            print "<a href=\"javascript:;\" onclick=\"return add_new_record('{$famid}','SOUR');\">" . $pgv_lang["add_source"] . "</a>";
            print "<br />\n";
            print "</td></tr>\n";
            // -- end new objects
        }
        print "\n\t</table>\n";
    }
}
Exemplo n.º 3
0
    function print_notes_tab()
    {
        global $pgv_lang, $factarray, $CONTACT_EMAIL, $FACT_COUNT;
        global $SHOW_LEVEL2_NOTES;
        global $Fam_Navigator, $NAV_NOTES;
        //if (isset($_COOKIE['row_note2'])) $SHOW_LEVEL2_NOTES = ($_COOKIE['row_note2']);
        // Use Show or Hide Navigator Cookie -----------
        if (isset($_COOKIE['famnav'])) {
            $Fam_Navigator = $_COOKIE['famnav'];
        } else {
            $Fam_Navigator = "YES";
        }
        // Hide/Show the Family Navigator on this tab =========
        if (isset($NAV_NOTES) && $NAV_NOTES == "SHOW") {
            $Fam_Navigator = "YES";
        } else {
            $Fam_Navigator = "HIDE";
        }
        // ===============================================
        if ($Fam_Navigator == "YES") {
            print "<table cellpadding=\"0\" ><tr><td valign=\"top\" width=\"100%\" >";
        }
        ?>
		<table class="facts_table" >
		<?php 
        if (!$this->indi->canDisplayDetails()) {
            print "<tr><td class=\"facts_value\">";
            print_privacy_error($CONTACT_EMAIL);
            print "</td></tr>";
        } else {
            ?>
			<tr>
				<td></td>
				<td class="descriptionbox rela">
					<input id="checkbox_note2" type="checkbox" <?php 
            if ($SHOW_LEVEL2_NOTES) {
                echo " checked=\"checked\"";
            }
            ?>
 onclick="toggleByClassName('TR', 'row_note2');" />
					<label for="checkbox_note2"><?php 
            echo $pgv_lang["show_fact_notes"];
            ?>
</label>
					<?php 
            print_help_link("show_fact_sources_help", "qm", "show_fact_notes");
            ?>
				</td>
			</tr>
			<?php 
            $otherfacts = $this->getOtherFacts();
            foreach ($otherfacts as $key => $event) {
                $fact = $event->getTag();
                if ($fact == "NOTE") {
                    print_main_notes($event->getGedcomRecord(), 1, $this->pid, $event->getLineNumber());
                }
                $FACT_COUNT++;
            }
            // 2nd to 5th level notes/sources
            $this->indi->add_family_facts(false);
            foreach ($this->getIndiFacts() as $key => $factrec) {
                for ($i = 2; $i < 6; $i++) {
                    print_main_notes($factrec->getGedcomRecord(), $i, $this->pid, $factrec->getLineNumber(), true);
                }
            }
            if ($this->get_note_count() == 0) {
                print "<tr><td id=\"no_tab2\" colspan=\"2\" class=\"facts_value\">" . $pgv_lang["no_tab2"] . "</td></tr>\n";
            }
            //-- New Note Link
            if (!$this->isPrintPreview() && PGV_USER_CAN_EDIT && $this->indi->canDisplayDetails()) {
                ?>
				<tr>
					<td class="facts_label"><?php 
                print_help_link("add_note_help", "qm");
                echo $pgv_lang["add_note_lbl"];
                ?>
</td>
					<td class="facts_value"><a href="javascript:;" onclick="add_new_record('<?php 
                echo $this->pid;
                ?>
','NOTE'); return false;"><?php 
                echo $pgv_lang["add_note"];
                ?>
</a>
					<br />
					</td>
				</tr>
				<tr>
					<td class="facts_label"><?php 
                print_help_link("add_shared_note_help", "qm");
                echo $pgv_lang["add_shared_note_lbl"];
                ?>
</td>
					<td class="facts_value">
					<a href="javascript:;" onclick="add_new_record('<?php 
                echo $this->pid;
                ?>
','SHARED_NOTE'); return false;"><?php 
                echo $pgv_lang["add_shared_note"];
                ?>
</a>
					<br />
					</td>
				</tr>
			<?php 
            }
        }
        ?>
		</table>
		<br />

		<?php 
        // ==================== Start Notes Tab Navigator ========================================
        if ($Fam_Navigator == "YES") {
            ?>
			</td>
			<td valign="top">
				<table class="optionbox" width="220px" cellpadding="0"><tr><td align="center">
				<b><?php 
            print $pgv_lang["view_fam_nav_notes"];
            ?>
</b><br /><br />
				<?php 
            include_once 'includes/family_nav.php';
            ?>
				<br />
				</td></tr></table>
			</td></tr></table>
			<?php 
        }
        // ==================== End Notes Tab Navigator =========================================
        ?>

		<?php 
        if (!$SHOW_LEVEL2_NOTES) {
            ?>
			<script language="JavaScript" type="text/javascript">
			<!--
			toggleByClassName('TR', 'row_note2');
			//-->
			</script>
		<?php 
        }
    }
Exemplo n.º 4
0
    public function getTabContent()
    {
        global $SHOW_LEVEL2_NOTES, $NAV_NOTES, $controller;
        ob_start();
        echo '<table class="facts_table">';
        ?>
		<tr>
			<td colspan="2" class="descriptionbox rela">
				<input id="checkbox_note2" type="checkbox" <?php 
        if ($SHOW_LEVEL2_NOTES) {
            echo ' checked="checked"';
        }
        ?>
 onclick="jQuery('tr.row_note2').toggle();">
				<label for="checkbox_note2"><?php 
        echo WT_I18N::translate('Show all notes');
        ?>
</label>
				<?php 
        echo help_link('show_fact_sources');
        ?>
			</td>
		</tr>
		<?php 
        foreach ($this->get_facts() as $fact) {
            if ($fact->getTag() == 'NOTE') {
                print_main_notes($fact, 1);
            } else {
                for ($i = 2; $i < 4; ++$i) {
                    print_main_notes($fact, $i);
                }
            }
        }
        if (!$this->get_facts()) {
            echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', WT_I18N::translate('There are no notes for this individual.'), '</td></tr>';
        }
        // New note link
        if ($controller->record->canEdit()) {
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            echo WT_Gedcom_Tag::getLabel('NOTE');
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="add_new_record('<?php 
            echo $controller->record->getXref();
            ?>
','NOTE'); return false;">
						<?php 
            echo WT_I18N::translate('Add a new note');
            ?>
					</a>
					<?php 
            echo help_link('add_note');
            ?>
				</td>
			</tr>
			<tr>
				<td class="facts_label">
					<?php 
            echo WT_Gedcom_Tag::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 WT_I18N::translate('Add a new shared note');
            ?>
					</a>
					<?php 
            echo help_link('add_shared_note');
            ?>
				</td>
			</tr>
			<?php 
        }
        ?>
		</table>
		<?php 
        if (!$SHOW_LEVEL2_NOTES) {
            echo '<script>jQuery("tr.row_note2").toggle();</script>';
        }
        return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
    }