Example #1
0
/***************************************************************************
 *   nolink.php                                                            *
 *   Yggdrasil: Unidentified people mentioned in sources                   *
 *   (Part of the experimental source linkage                              *
 *                                                                         *
 *   Copyright (C) 2009-2011 by Leif B. Kristensen <*****@*****.**>   *
 *   All rights reserved. For terms of use, see LICENSE.txt                *
 ***************************************************************************/
require "./settings/settings.php";
require_once "./langs/{$language}.php";
require "./functions.php";
$title = 'Uidentifiserte personer';
require "./header.php";
echo "<div class=\"normal\">\n";
echo "<h2>Uidentifiserte personer fra lenking:</h2>\n";
$handle = pg_query("\n    SELECT\n        s.source_id AS source,\n        part_ldesc(s.part_type) AS s_type,\n        get_lsurety(l.surety_fk) AS surety,\n        get_lrole(l.role_fk) AS rolle,\n        l.s_name AS name,\n        get_source_text(s.source_id) AS txt,\n        link_expand(l.sl_note) AS note\n    FROM\n        sources s,\n        source_linkage l\n    WHERE\n        l.source_fk = s.source_id\n    AND\n        l.person_fk IS NULL\n    ORDER BY\n        s.source_date,\n        s.sort_order,\n        l.per_id\n");
echo "<ol>\n";
while ($row = pg_fetch_assoc($handle)) {
    $principal = fetch_val("\n        SELECT person_fk FROM source_linkage\n        WHERE source_fk = " . $row['source'] . " AND role_fk = 1\n    ");
    echo "<li>" . bold($row['name']) . '<br />' . $row['surety'] . ' ' . $row['rolle'] . ' ved ' . $row['s_type'];
    if ($principal) {
        echo ' av ' . linked_name($principal, './family.php');
    }
    echo '. ' . $row['txt'];
    echo conc(italic($row['note']));
    echo conc(paren(to_url('./source_manager.php', array('node' => $row['source']), 'Til kildebehandler')));
    echo "</li>\n";
}
echo "</ol>\n";
echo "</div>\n";
include "./footer.php";
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";
}
 *                                                                         *
 *   Copyright (C) 2006-2011 by Leif B. Kristensen <*****@*****.**>   *
 *   All rights reserved. For terms of use, see LICENSE.txt                *
 ***************************************************************************/
// This script is basically a report listing events and persons associated
// with a tag. It is accessed from the Tag Manager via the 'report' link.
require "./settings/settings.php";
require "./functions.php";
require_once "./langs/{$language}.php";
$tag = $_GET['tag'];
$tag_name = fetch_val("SELECT get_tag_name({$tag})");
$title = "{$_All} {$_events} {$_of} type {$tag_name}";
require "./header.php";
echo "<div class=\"normal\">\n";
echo "<h2>{$title}</h2>\n";
$handle = pg_query("\n    SELECT\n        event_id,\n        event_name,\n        event_date,\n        place_name,\n        p1,\n        p2\n    FROM\n        tag_events\n    WHERE\n        tag_fk = {$tag}\n    ORDER BY\n        event_date,\n        event_id\n");
while ($row = pg_fetch_assoc($handle)) {
    echo '<p>[' . $row['event_id'] . '] ';
    echo $row['event_name'];
    echo ' ' . fuzzydate($row['event_date']);
    echo ' ' . $row['place_name'] . ': ';
    echo list_participants($row['event_id']);
    // print source(s)
    $innerhandle = pg_query("\n    SELECT\n        source_text\n    FROM\n        event_notes\n    WHERE\n        note_id = " . $row['event_id']);
    while ($row = pg_fetch_assoc($innerhandle)) {
        echo conc(paren($_Source . ':' . conc(ltrim($row['source_text']))));
    }
    echo "</p>\n";
}
echo "</div>\n";
include "./footer.php";
 *   Copyright (C) 2011 by Leif B. Kristensen <*****@*****.**>        *
 *   All rights reserved. For terms of use, see LICENSE.txt                *
 ***************************************************************************/
// This script is basically a report listing sources of one type.
// It is accessed from the Source Part Type Manager via the 'report' link.
require "./settings/settings.php";
require "./functions.php";
require_once "./langs/{$language}.php";
$spt = $_GET['spt'];
$label = 'label_' . $language;
$spt_name = fetch_val("\n    SELECT {$label} FROM source_part_types WHERE part_type_id = {$spt}\n");
$title = "{$_All} {$_sources} {$_of} type {$spt_name}";
require "./header.php";
echo "<div class=\"normal\">\n";
echo "<h2>{$title}</h2>\n";
echo "<table>";
$handle = pg_query("\n    SELECT\n        source_id,\n        link_expand(source_text) AS txt,\n        source_date,\n        ecc(source_id) AS e,\n        rcc(source_id) AS r,\n        ssc(source_id) AS s,\n        usc(source_id) AS u,\n        spt.{$label} AS {$label}\n    FROM\n        sources, source_part_types spt\n    WHERE\n        spt.part_type_id = sources.part_type\n    AND\n        spt.part_type_id = {$spt}\n    AND\n        source_id <> 0\n    ORDER BY\n        source_date,\n        source_text\n");
while ($row = pg_fetch_assoc($handle)) {
    $id = $row['source_id'];
    echo '<tr>';
    echo td(paren(to_url('source_manager.php', array('node' => $id), $_Select) . '&nbsp;/&nbsp;' . to_url('./forms/source_edit.php', array('person' => 0, 'source' => $id), $_Edit)));
    if ($row['e'] || $row['r'] || $row['s']) {
        echo td(square_brace(italic($row['source_date'])) . ' ' . $row['txt'] . node_details($row['e'], $row['r'], $row['s'], $row['u']));
    } else {
        // source is unused, print with gray text
        echo td(span_type(square_brace(italic($row['source_date'])) . conc($row['txt']), "faded"));
    }
    echo "</tr>\n";
}
echo "</table>\n";
include "./footer.php";
Example #5
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";
}
Example #6
0
}
// by default, we will display the 50 most recently edited persons.
if (!isset($given) && !isset($surname)) {
    $headline = "{$_The_last_50_edited}";
    // This query is sluggish without the following db modification:
    // create index last_edited_persons_key on persons(last_edit,person_id);
    $query = "select person_id, last_edit from persons\n               where is_merged(person_id) is false\n               order by last_edit desc, person_id desc limit 50";
} else {
    if (substr($surname, 0, 1) == '!') {
        $literal = ltrim($surname, '!');
    } else {
        $literal = "%{$surname}%";
    }
    $headline = "{$_Search_result}";
    $query = "SELECT\n            person_id,\n            get_pbdate(person_id) as pbd\n        FROM\n            persons\n        WHERE\n            given LIKE '%{$given}%'\n            AND (\n                patronym LIKE '%{$surname}%'\n                OR toponym LIKE '{$literal}'\n                OR surname LIKE '%{$surname}%'\n                OR occupation LIKE '%{$surname}%'\n            )\n            AND is_merged(person_id) IS FALSE\n        ";
    if ($bdate) {
        $query .= "\n            AND f_year(get_pbdate(person_id))\n                    BETWEEN (({$bdate})::INTEGER - {$diff})\n                    AND (({$bdate})::INTEGER + {$diff})\n            ";
    }
    $query .= "\n    ORDER BY pbd";
}
echo "<h3>{$headline}:</h3>\n";
$handle = pg_query($query);
echo "<p>";
while ($row = pg_fetch_row($handle)) {
    $p = $row[0];
    echo get_name_and_dates("./family.php", $p) . conc(child_of($p)) . "<br />\n";
}
echo "</p>\n";
echo para(paren(fetch_num_rows($query) . conc($_persons)));
echo "</div>\n";
include "./footer.php";