예제 #1
0
function list_mentioned($node, $hotlink = 0)
{
    global $app_path, $_edit, $_delete;
    echo "<ol>\n";
    $handle = pg_query("\n        SELECT\n            per_id,\n            get_role(role_fk) AS rolle,\n            person_fk,\n            get_surety(surety_fk) AS surety,\n            s_name,\n            link_expand(sl_note) AS note\n        FROM\n            source_linkage\n        WHERE\n            source_fk = {$node}\n        ORDER BY\n            role_fk,\n            per_id\n    ");
    while ($row = pg_fetch_assoc($handle)) {
        echo '<li>' . $row['rolle'] . ': ';
        echo '«' . $row['s_name'] . '»';
        if ($row['person_fk']) {
            echo conc(curly_brace($row['surety'])) . conc(linked_name($row['person_fk'], "{$app_path}/family.php"));
        }
        if (has_parents($row['person_fk'])) {
            echo conc(child_of($row['person_fk']));
        }
        if ($row['note']) {
            echo ': ' . $row['note'];
        }
        if ($hotlink) {
            echo conc(paren(to_url("{$app_path}/forms/linkage_edit.php", array('node' => $node, 'id' => $row['per_id']), $_edit) . ' / ' . to_url("{$app_path}/forms/linkage_delete.php", array('node' => $node, 'id' => $row['per_id']), $_delete)));
        }
        echo "</li>\n";
    }
    if ($hotlink) {
        echo '<li>' . to_url("{$app_path}/forms/linkage_add.php", array('node' => $node), "Legg til lenke") . "</li>\n";
    }
    echo "</ol>\n";
}
예제 #2
0
function show_parent($person, $gender)
{
    // print names and lifespans of parents.
    // valid $gender values are 1=father, 2=mother
    global $language, $_Add, $_Insert, $_edit, $_delete, $_Father, $_father, $_Mother, $_mother, $_toolhelp_edit_parent, $_toolhelp_add_parent, $_toolhelp_insert_parent, $_toolhelp_delete_parent;
    $parent_id = fetch_val("SELECT get_parent({$person}, {$gender})");
    $surety = fetch_val("\n        SELECT get_lsurety((\n            SELECT surety_fk\n            FROM relations\n            WHERE parent_fk = {$parent_id}\n            AND child_fk = {$person}\n        ), '{$language}')\n    ");
    if ($gender == 1) {
        $Parent = $_Father;
        $parent = $_father;
        $para = '<p>';
        $newline = '<br />';
    } else {
        // $gender == 2
        $Parent = $_Mother;
        $parent = $_mother;
        $para = '';
        $newline = '</p>';
    }
    echo $para . conc(bold($Parent) . ':') . conc(get_name_and_dates('', $parent_id));
    if ($parent_id) {
        echo conc(curly_brace($surety)) . conc(span_type(paren(to_url('./forms/relation_edit.php', array('person' => $person, 'parent' => $parent_id), $_edit, sprintf($_toolhelp_edit_parent, $parent)) . ' / ' . to_url('./forms/relation_delete.php', array('person' => $person, 'parent' => $parent_id), $_delete, sprintf($_toolhelp_delete_parent, $parent))), "hotlink")) . cite(get_relation_id($person, $gender), 'relation', $person);
    } else {
        echo conc(span_type(paren(to_url('./forms/person_insert.php', array('person' => $person, 'addparent' => 'true', 'gender' => $gender), "{$_Add} {$parent}", sprintf($_toolhelp_add_parent, $parent)) . ' / ' . to_url('./forms/relation_edit.php', array('person' => $person, 'gender' => $gender), "{$_Insert} {$parent}", sprintf($_toolhelp_insert_parent, $parent))), "hotlink"));
    }
    echo "{$newline}\n";
}