function build_tree($person, $henry, $level, $total)
{
    // Recursive routine that does the major work.
    global $coparents, $descendants;
    $maxlevel = 15;
    $count = 0;
    $family = find_family($person);
    while (isset($family[$count][0])) {
        $coparent = $family[$count][1];
        $coparents++;
        printf("<li>~ %s\n<ul class=\"descendants\">\n", get_name_and_dates('', $coparent));
        while (isset($family[$count][1]) && $family[$count][1] == $coparent) {
            $henry[$level] = $count + 1;
            $descendants++;
            printf("<li>%s %s", get_henry($henry, $level), get_name_and_dates('', $family[$count][0]));
            if ($level == $maxlevel && has_descendants($family[$count][0])) {
                print " <strong>+</strong>";
            }
            print "</li>\n";
            if ($level < $maxlevel) {
                // point of recursion
                build_tree($family[$count][0], $henry, $level + 1, $total);
            }
            $count++;
        }
        echo "</ul></li>\n";
    }
    return;
}
示例#2
0
function pop_child($child, $parent, $coparent = 0)
{
    global $_Child, $_Source, $_with, $_toolhelp_has_descendants;
    $name = get_name($child);
    $sentence = bold($_Child . ':') . conc(linked_name($child));
    if ($coparent) {
        // illegitimate child, print coparent
        $sentence .= conc($_with) . conc(linked_name($coparent));
    }
    if (has_descendants($child)) {
        $sentence .= conc(span_type('+', "alert", sprintf($_toolhelp_has_descendants, $child)));
    }
    $sentence = para($sentence, "name");
    /*
    // This section has become obsolete with the addition of inline source
    // citations in print_bd() above. Left here because you may prefer to
    // document parent/child relations rather than BD events of spouses and
    // children, or maybe both.
    // print relation source(s)
    $handle = pg_query("
        SELECT
            source_text
        FROM
            relation_notes
        WHERE
            note_id = (
            SELECT
                relation_id
            FROM
                relations
            WHERE
                child_fk = $child
            AND
                parent_fk = $parent
        )
    ");
    while ($row = pg_fetch_assoc($handle)) {
        $sentence .= para(paren($_Source . ':'
            . conc(ltrim($row['source_text']))), "childsource");
    }
    */
    echo $sentence;
    print_bd($child, 1);
    print_marriage($child);
    print_bd($child, 3);
    pg_query("DELETE FROM tmp_children WHERE child = {$child}");
}
示例#3
0
function get_sidebar_name($p)
{
    $name = get_name($p);
    $name .= has_descendants($p) ? '+' : '';
    return to_url('./pedigree.php', array('person' => $p), $name);
}